Darby, the problem with ACL at current is its goals and architecture. The impression is that by using a is-a (instanceof) architecture, you are implying that you can implement Base Roles and Resoures and expect them to persist through the isAllowed, which is not the case. The initial problem is that isAllowed will take any supplied object that implements the interface, and turn it into the object presented at ACL creation time.
This is not what I want, and I think that moving forward, as more people start to use ACL for runtime resource access checking, this will be a need.
That being said, the current code:
if (null !== $role) {
$role = $this->_getRoleRegistry()->get($role);
}
if (null !== $resource) {
$resource = $this->get($resource);
}
will always produce the same object supplied at ACL creation time.
Whereas, this code:
public function isAllowed($role = null, $resource = null, $privilege = null)
{
if (null !== $role) {
$registryRole = $this->_getRoleRegistry()->get($role);
if (!$role instanceof Zend_Acl_Role_Interface) {
$role = $registryRole;
}
}
if (null !== $resource) {
$registryResource = $this->get($resource); if (!$resource instanceof Zend_Acl_Resource_Interface) {
$resource = $registryResource;
}
}
Will allow an object that implements the interface to persist through the isAllowed, as long as the ID (object type) matches somethign that is in the ACL registry.
Again, its an architectual issue, but one that I will address in a few days with code.
Scratch that, this is a safer approach: