Permission
class Permission extends Object implements IAuthorizator
Access control list (ACL) functionality and privileges management.
This solution is mostly based on Zend_Acl (c) Zend Technologies USA Inc. (http://www.zend.com), new BSD license
Properties
array read-only | $roles | ||
array read-only | $resources | ||
mixed read-only | $queriedRole | ||
mixed read-only | $queriedResource |
Methods
Adds a Role to the list. The most recently added parent takes precedence over parents that were previously added.
Returns TRUE if the Role exists in the list.
Returns all Roles.
Returns existing Role's parents ordered by ascending priority.
Returns TRUE if $role inherits from $inherit. If $onlyParents is TRUE, then $role must inherit directly from $inherit.
Removes the Role from the list.
Removes all Roles from the list.
Adds a Resource having an identifier unique to the list.
Returns TRUE if the Resource exists in the list.
Returns all Resources.
Returns TRUE if $resource inherits from $inherit. If $onlyParents is TRUE, then $resource must inherit directly from $inherit.
Removes a Resource and all of its children.
Removes all Resources.
Allows one or more Roles access to [certain $privileges upon] the specified Resource(s).
Denies one or more Roles access to [certain $privileges upon] the specified Resource(s).
Removes "allow" permissions from the list in the context of the given Roles, Resources, and privileges.
Removes "deny" restrictions from the list in the context of the given Roles, Resources, and privileges.
Performs operations on Access Control List rules.
Returns TRUE if and only if the Role has access to [certain $privileges upon] the Resource.
Returns real currently queried Role. Use by assertion.
Returns real currently queried Resource. Use by assertion.
Details
at line 65
Permission
addRole($role, $parents = NULL)
Adds a Role to the list. The most recently added parent takes precedence over parents that were previously added.
at line 100
bool
hasRole($role)
Returns TRUE if the Role exists in the list.
at line 129
array
getRoles()
Returns all Roles.
at line 140
array
getRoleParents($role)
Returns existing Role's parents ordered by ascending priority.
at line 156
bool
roleInheritsFrom($role, $inherit, $onlyParents = FALSE)
Returns TRUE if $role inherits from $inherit. If $onlyParents is TRUE, then $role must inherit directly from $inherit.
at line 184
Permission
removeRole($role)
Removes the Role from the list.
at line 223
Permission
removeAllRoles()
Removes all Roles from the list.
at line 253
Permission
addResource($resource, $parent = NULL)
Adds a Resource having an identifier unique to the list.
at line 280
bool
hasResource($resource)
Returns TRUE if the Resource exists in the list.
at line 309
array
getResources()
Returns all Resources.
at line 325
bool
resourceInheritsFrom($resource, $inherit, $onlyParent = FALSE)
Returns TRUE if $resource inherits from $inherit. If $onlyParents is TRUE, then $resource must inherit directly from $inherit.
at line 360
Permission
removeResource($resource)
Removes a Resource and all of its children.
at line 392
Permission
removeAllResources()
Removes all Resources.
at line 420
Permission
allow($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL, $assertion = NULL)
Allows one or more Roles access to [certain $privileges upon] the specified Resource(s).
If $assertion is provided, then it must return TRUE in order for rule to apply.
at line 437
Permission
deny($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL, $assertion = NULL)
Denies one or more Roles access to [certain $privileges upon] the specified Resource(s).
If $assertion is provided, then it must return TRUE in order for rule to apply.
at line 452
Permission
removeAllow($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL)
Removes "allow" permissions from the list in the context of the given Roles, Resources, and privileges.
at line 467
Permission
removeDeny($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL)
Removes "deny" restrictions from the list in the context of the given Roles, Resources, and privileges.
at line 485
protected Permission
setRule($toAdd, $type, $roles, $resources, $privileges, $assertion = NULL)
Performs operations on Access Control List rules.
at line 598
bool
isAllowed($role = self::ALL, $resource = self::ALL, $privilege = self::ALL)
Returns TRUE if and only if the Role has access to [certain $privileges upon] the Resource.
This method checks Role inheritance using a depth-first traversal of the Role list. The highest priority parent (i.e., the parent most recently added) is checked first, and its respective parents are checked similarly before the lower-priority parents of the Role are checked.
at line 654
mixed
getQueriedRole()
Returns real currently queried Role. Use by assertion.
at line 664
mixed
getQueriedResource()
Returns real currently queried Resource. Use by assertion.