Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Acl_Assert_Proxy Class Reference

Proxy for an acl assert class that might not exist. More...

List of all members.

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

Detailed Description

Proxy for an acl assert class that might not exist.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Constructor & Destructor Documentation

P4Cms_Acl_Assert_Proxy::__construct ( assertClass)

Create a new acl assert proxy.

Parameters:
string$assertClassthe name of the class to proxy for.
    {
        $this->_assertClass = $assertClass;
    }

Member Function Documentation

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.

Parameters:
Zend_Acl$aclthe acl instance
Zend_Acl_Role_Interface$rolethe role to check access for
Zend_Acl_Resource_Interface$resourcethe resource.
string$privilegethe privilege.
Returns:
boolean true if the assertion class exists and asserts true.
    {
        // 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);
    }

Member Data Documentation

P4Cms_Acl_Assert_Proxy::$_assertClass = null [protected]

The documentation for this class was generated from the following file: