Beruflich Dokumente
Kultur Dokumente
Zend_Acl
Acl l ch vit tt ca access control list (danh sch iu khin truy cp). Zend_Acl gip chng ta phn quyn cho ng dng. N gip chng ta c th phn quyn chi tit trn tng action, controller v module Group
(Zend_Acl_Role)
Pemissions
($privileges)
Parent
($parents)
- Trong phng thc allow() nu tham s $privileges khng xut hin ngha l nhm c ton quyn 5. Cm truy cp - Ngc li vi phng thc allow() l phng thc deny(). Phng thc ny s cp quyn cm truy cp vo
$acl->allow('Guest', null, $guestPrivileges); $acl->allow('Member', null, $memberPrivileges); $acl->allow('Moderator', null, $moderatorPrivileges); $acl->deny('Moderator', null, 'delete'); $acl->allow('Administrator');
GV: Phm V Khnh Email: zendvn@yahoo.com
6. Kim tra quyn truy cp - kim tra quyn truy cp vo mt phn no ca ng dng ta s s dng phng thc kim tra isAllowed
if($acl->isAllowed('Moderator', null, 'delete')){ echo 'Ban co quyen truy cap action nay'; }else{ echo 'Ban khong quyen truy cap action nay'; }
7. Resource - Trong Acl ny xut hin mt tham s l $resource v s dng n chng ta thng dng phng thc add().
$acl->add(new Zend_Acl_Resource('admin')); $acl->add(new Zend_Acl_Resource('admin:author'),'admin'); $acl->add(new Zend_Acl_Resource('admin:member'),'admin');