Perforce Chronicle 2012.2/486814
API Documentation
|
Extended P4Cms_User class to provide granting additional privileges on the fly. More...
Public Member Functions | |
allow ($resource, $privilege=null) | |
Grant additonal access to a given resource and (optionally) a given privilege on the resource for this user. | |
isAllowed ($resource, $privilege=null, P4Cms_Acl $acl=null) | |
Extended parent to also consider additionally granted access when evaluating if this user is allowed access to the given resource. | |
Protected Attributes | |
$_allowed = array() |
Extended P4Cms_User class to provide granting additional privileges on the fly.
Cron_Model_User::allow | ( | $ | resource, |
$ | privilege = null |
||
) |
Grant additonal access to a given resource and (optionally) a given privilege on the resource for this user.
string | $resource | resource to grant access for |
string | array | null | $privilege | resource privilege to grant access for |
{ $this->_allowed[] = array('resource' => $resource, 'privilege' => (array) $privilege); return $this; }
Cron_Model_User::isAllowed | ( | $ | resource, |
$ | privilege = null , |
||
P4Cms_Acl $ | acl = null |
||
) |
Extended parent to also consider additionally granted access when evaluating if this user is allowed access to the given resource.
P4Cms_Acl_Resource | string | $resource | the resource to check access to. |
P4Cms_Acl_Privilege | string | null | $privilege | optional - the privilege to check. |
P4Cms_Acl | null | $acl | optional - the acl to check against. defaults to the currently active acl. |
Reimplemented from P4Cms_User.
{ $resourceId = $resource instanceof Zend_Acl_Resource_Interface ? $resource->getResourceId() : $resource; // check for special (runtime) access. foreach ($this->_allowed as $allowed) { if ($allowed['resource'] !== $resourceId) { continue; } if (!$allowed['privilege'] || in_array($privilege, $allowed['privilege'])) { return true; } } return parent::isAllowed($resource, $privilege, $acl); }
Cron_Model_User::$_allowed = array() [protected] |