Perforce Chronicle 2012.2/486814
API Documentation
|
Proxy for an acl assert class that might not exist. More...
Public Member Functions | |
__construct ($assertClass) | |
Create a new acl assert proxy. | |
assert (Zend_Acl $acl, Zend_Acl_Role_Interface $role=null, Zend_Acl_Resource_Interface $resource=null, $privilege=null) | |
Tries to instantiate the assertion class we are proxying for. | |
Protected Attributes | |
$_assertClass = null |
Proxy for an acl assert class that might not exist.
P4Cms_Acl_Assert_Proxy::__construct | ( | $ | assertClass | ) |
Create a new acl assert proxy.
string | $assertClass | the name of the class to proxy for. |
{ $this->_assertClass = $assertClass; }
P4Cms_Acl_Assert_Proxy::assert | ( | Zend_Acl $ | acl, |
Zend_Acl_Role_Interface $ | role = null , |
||
Zend_Acl_Resource_Interface $ | resource = null , |
||
$ | privilege = null |
||
) |
Tries to instantiate the assertion class we are proxying for.
If the class exists and implements the assertion interface, returns result of assert(); otherwise returns false.
Zend_Acl | $acl | the acl instance |
Zend_Acl_Role_Interface | $role | the role to check access for |
Zend_Acl_Resource_Interface | $resource | the resource. |
string | $privilege | the privilege. |
{ // check if assert class we are proxying for exists. if (!class_exists($this->_assertClass)) { return false; } // instantiate the assertion $assertClass = new $this->_assertClass; // verify class implements assertion interface. if (!$assertClass instanceof Zend_Acl_Assert_Interface) { return false; } return $assertClass->assert($acl, $role, $resource, $privilege); }
P4Cms_Acl_Assert_Proxy::$_assertClass = null [protected] |