Details
Description
Reproduction code
webdeveloper@webdevelopment ~/testing $ cat test_aclwhoswho.php <?php require_once 'Zend/Acl.php'; require_once 'Zend/Acl/Role.php'; require_once 'Zend/Acl/Resource.php'; class HasIQFor implements Zend_Acl_Assert_Interface { public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null) { echo "digging deeper"; echo var_dump($role); } } class Acl_Child implements Zend_Acl_Role_Interface { public function getRoleId() { return 'Child'; } } class Acl_Parent implements Zend_Acl_Role_Interface { public function getRoleId() { return 'Parent'; } } $acl = new Zend_Acl(); $acl->addRole(new Zend_Acl_Role('Child')) ->addRole(new Zend_Acl_Role('Parent'), 'Child') ->add(new Zend_Acl_Resource('Toy')) ->add(new Zend_Acl_Resource('PokerGame')) ->allow('Child', 'Toy', 'Play', new HasIQFor()) ->allow('Parent', 'PokerGame', 'Play', new HasIQFor()); $child = new Acl_Child(); $mommy = new Acl_Parent(); echo "Children and toys?\n"; echo $acl->isAllowed($child, 'Toy', 'Play'); echo "\n\nChildren and poker?\n"; echo $acl->isAllowed($child, 'PokerGame', 'Play'); echo "\n\nParents and toys?\n"; echo $acl->isAllowed($mommy, 'Toy', 'Play'); echo "\n\nParents and poker?\n"; echo $acl->isAllowed($mommy, 'PokerGame', 'Play'); webdeveloper@webdevelopment ~/testing $ php test_aclwhoswho.php Children and toys? digging deeperobject(Zend_Acl_Role)#2 (1) { ["_roleId:protected"]=> string(5) "Child" } Children and poker? Parents and toys? digging deeperobject(Zend_Acl_Role)#2 (1) { ["_roleId:protected"]=> string(5) "Child" } Parents and poker? digging deeperobject(Zend_Acl_Role)#4 (1) { ["_roleId:protected"]=> string(6) "Parent" }
you can notice the problem in the 3rd case where when trying to determine if the parent has the IQ to play with the toy, the parent object is not passed to the assertion.
Issue Links
| This issue is duplicated by: | ||||
| ZF-1765 | Asserts don't get role, resource and privilege parameters unless specified in allow() |
|
|
|
| ZF-5425 | Assertion implementation does not receive ACL query parameters. |
|
|
|
| ZF-3390 | Inheritage of roles: rules are checked by parent roles |
|
|
|
| This issue is related to: | ||||
| ZF-1721 | Zend_Acl::isAllowed does not support Role/Resource Inheritance down to Assertions |
|
|
|
| ZF-4460 | Resource objects passed in to ACL query methods are not passed through to registered assert()'s |
|
|
|
Postponing to after 1.0.1.