addResource()
addRole()
allow()
deny()
getResource()
getResources()
getRole()
getRoles()
hasResource()
hasRole()
inheritsResource()
inheritsRole()
isAllowed()
removeAllow()
removeDeny()
removeResource()
removeResourceAll()
removeRole()
removeRoleAll()
setRule()
getChildResources()
getRoleRegistry()
getRuleType()
getRules()
roleDFSAllPrivileges()
roleDFSOnePrivilege()
roleDFSVisitAllPrivileges()
roleDFSVisitOnePrivilege()
$isAllowedPrivilege
$isAllowedResource
$isAllowedRole
$resources
$roleRegistry
$rules
OP_ADD
OP_REMOVE
TYPE_ALLOW
TYPE_DENY
addResource(\Zend\Permissions\Acl\Resource\ResourceInterface | string $resource, \Zend\Permissions\Acl\Resource\ResourceInterface | string $parent) : \Zend\Permissions\Acl\Acl
The $parent parameter may be a reference to, or the string identifier for, the existing Resource from which the newly added Resource will inherit.
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
\Zend\Permissions\Acl\Exception\InvalidArgumentException |
---|
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceaddRole(\Zend\Permissions\Acl\Role\RoleInterface | string $role, \Zend\Permissions\Acl\Role\RoleInterface | string | array $parents) : \Zend\Permissions\Acl\Acl
The $parents parameter may be a reference to, or the string identifier for, a Role existing in the registry, or $parents may be passed as an array of these - mixing string identifiers and objects is ok - to indicate the Roles from which the newly added Role will directly inherit.
In order to resolve potential ambiguities with conflicting rules inherited from different parents, the most recently added parent takes precedence over parents that were previously added. In other words, the first parent added will have the least priority, and the last parent added will have the highest priority.
\Zend\Permissions\Acl\Role\RoleInterfacestring
\Zend\Permissions\Acl\Role\RoleInterfacestringarray
\Zend\Permissions\Acl\Exception\InvalidArgumentException |
---|
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceallow(\Zend\Permissions\Acl\Role\RoleInterface | string | array $roles, \Zend\Permissions\Acl\Resource\ResourceInterface | string | array $resources, string | array $privileges, \Zend\Permissions\Acl\Assertion\AssertionInterface $assert) : \Zend\Permissions\Acl\Acl
\Zend\Permissions\Acl\Role\RoleInterfacestringarray
\Zend\Permissions\Acl\Resource\ResourceInterfacestringarray
stringarray
\Zend\Permissions\Acl\Acl
Provides a fluent interfacedeny(\Zend\Permissions\Acl\Role\RoleInterface | string | array $roles, \Zend\Permissions\Acl\Resource\ResourceInterface | string | array $resources, string | array $privileges, \Zend\Permissions\Acl\Assertion\AssertionInterface $assert) : \Zend\Permissions\Acl\Acl
\Zend\Permissions\Acl\Role\RoleInterfacestringarray
\Zend\Permissions\Acl\Resource\ResourceInterfacestringarray
stringarray
\Zend\Permissions\Acl\Acl
Provides a fluent interfacegetResource(\Zend\Permissions\Acl\Resource\ResourceInterface | string $resource) : Resource
The $resource parameter can either be a Resource or a Resource identifier.
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
\Zend\Permissions\Acl\Exception\InvalidArgumentException |
---|
Resource
getResources() : array
array
of registered resourcesgetRole(\Zend\Permissions\Acl\Role\RoleInterface | string $role) : \Zend\Permissions\Acl\Role\RoleInterface
The $role parameter can either be a Role or Role identifier.
\Zend\Permissions\Acl\Role\RoleInterfacestring
getRoles() : array
array
of registered roleshasResource(\Zend\Permissions\Acl\Resource\ResourceInterface | string $resource) : bool
The $resource parameter can either be a Resource or a Resource identifier.
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
bool
hasRole(\Zend\Permissions\Acl\Role\RoleInterface | string $role) : bool
The $role parameter can either be a Role or a Role identifier.
\Zend\Permissions\Acl\Role\RoleInterfacestring
bool
inheritsResource(\Zend\Permissions\Acl\Resource\ResourceInterface | string $resource, \Zend\Permissions\Acl\Resource\ResourceInterface | string $inherit, bool $onlyParent) : bool
Both parameters may be either a Resource or a Resource identifier. If $onlyParent is true, then $resource must inherit directly from $inherit in order to return true. By default, this method looks through the entire inheritance tree to determine whether $resource inherits from $inherit through its ancestor Resources.
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
bool
\Zend\Permissions\Acl\Exception\InvalidArgumentException |
---|
bool
inheritsRole(\Zend\Permissions\Acl\Role\RoleInterface | string $role, \Zend\Permissions\Acl\Role\RoleInterface | string $inherit, bool $onlyParents) : bool
Both parameters may be either a Role or a Role identifier. If $onlyParents is true, then $role must inherit directly from $inherit in order to return true. By default, this method looks through the entire inheritance DAG to determine whether $role inherits from $inherit through its ancestor Roles.
\Zend\Permissions\Acl\Role\RoleInterfacestring
\Zend\Permissions\Acl\Role\RoleInterfacestring
bool
bool
isAllowed(\Zend\Permissions\Acl\Role\RoleInterface | string $role, \Zend\Permissions\Acl\Resource\ResourceInterface | string $resource, string $privilege) : bool
The $role and $resource parameters may be references to, or the string identifiers for, an existing Resource and Role combination.
If either $role or $resource is null, then the query applies to all Roles or all Resources, respectively. Both may be null to query whether the ACL has a "blacklist" rule (allow everything to all). By default, Zend\Permissions\Acl creates a "whitelist" rule (deny everything to all), and this method would return false unless this default has been overridden (i.e., by executing $acl->allow()).
If a $privilege is not provided, then this method returns false if and only if the Role is denied access to at least one privilege upon the Resource. In other words, this method returns true if and only if the Role is allowed all privileges on the Resource.
This method checks Role inheritance using a depth-first traversal of the Role registry. 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.
\Zend\Permissions\Acl\Role\RoleInterfacestring
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
string
bool
removeAllow(\Zend\Permissions\Acl\Role\RoleInterface | string | array $roles, \Zend\Permissions\Acl\Resource\ResourceInterface | string | array $resources, string | array $privileges) : \Zend\Permissions\Acl\Acl
\Zend\Permissions\Acl\Role\RoleInterfacestringarray
\Zend\Permissions\Acl\Resource\ResourceInterfacestringarray
stringarray
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceremoveDeny(\Zend\Permissions\Acl\Role\RoleInterface | string | array $roles, \Zend\Permissions\Acl\Resource\ResourceInterface | string | array $resources, string | array $privileges) : \Zend\Permissions\Acl\Acl
\Zend\Permissions\Acl\Role\RoleInterfacestringarray
\Zend\Permissions\Acl\Resource\ResourceInterfacestringarray
stringarray
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceremoveResource(\Zend\Permissions\Acl\Resource\ResourceInterface | string $resource) : \Zend\Permissions\Acl\Acl
The $resource parameter can either be a Resource or a Resource identifier.
\Zend\Permissions\Acl\Resource\ResourceInterfacestring
\Zend\Permissions\Acl\Exception\InvalidArgumentException |
---|
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceremoveResourceAll() : \Zend\Permissions\Acl\Acl
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceremoveRole(\Zend\Permissions\Acl\Role\RoleInterface | string $role) : \Zend\Permissions\Acl\Acl
The $role parameter can either be a Role or a Role identifier.
\Zend\Permissions\Acl\Role\RoleInterfacestring
\Zend\Permissions\Acl\Acl
Provides a fluent interfaceremoveRoleAll() : \Zend\Permissions\Acl\Acl
\Zend\Permissions\Acl\Acl
Provides a fluent interfacesetRule(string $operation, string $type, \Zend\Permissions\Acl\Role\RoleInterface | string | array $roles, \Zend\Permissions\Acl\Resource\ResourceInterface | string | array $resources, string | array $privileges, \Zend\Permissions\Acl\Assertion\AssertionInterface $assert) : \Zend\Permissions\Acl\Acl
The $operation parameter may be either OP_ADD or OP_REMOVE, depending on whether the user wants to add or remove a rule, respectively:
OP_ADD specifics:
A rule is added that would allow one or more Roles access to [certain $privileges
upon] the specified Resource(s).
OP_REMOVE specifics:
The rule is removed only in the context of the given Roles, Resources, and privileges.
Existing rules to which the remove operation does not apply would remain in the
ACL.
The $type parameter may be either TYPE_ALLOW or TYPE_DENY, depending on whether the rule is intended to allow or deny permission, respectively.
The $roles and $resources parameters may be references to, or the string identifiers for, existing Resources/Roles, or they may be passed as arrays of these - mixing string identifiers and objects is ok - to indicate the Resources and Roles to which the rule applies. If either $roles or $resources is null, then the rule applies to all Roles or all Resources, respectively. Both may be null in order to work with the default rule of the ACL.
The $privileges parameter may be used to further specify that the rule applies only to certain privileges upon the Resource(s) in question. This may be specified to be a single privilege with a string, and multiple privileges may be specified as an array of strings.
If $assert is provided, then its assert() method must return true in order for the rule to apply. If $assert is provided with $roles, $resources, and $privileges all equal to null, then a rule having a type of:
TYPE_ALLOW will imply a type of TYPE_DENY, and
TYPE_DENY will imply a type of TYPE_ALLOW
when the rule's assertion fails. This is because the ACL needs to provide expected behavior when an assertion upon the default ACL rule fails.
string
string
\Zend\Permissions\Acl\Role\RoleInterfacestringarray
\Zend\Permissions\Acl\Resource\ResourceInterfacestringarray
stringarray
\Zend\Permissions\Acl\Exception\InvalidArgumentException |
---|
\Zend\Permissions\Acl\Acl
Provides a fluent interfacegetChildResources(\Zend\Permissions\Acl\Resource\ResourceInterface $resource) : \Zend\Permissions\Acl\Resource\ResourceInterface[]
getRoleRegistry() : \Zend\Permissions\Acl\Role\Registry
If no Role registry has been created yet, a new default Role registry is created and returned.
getRuleType(\Zend\Permissions\Acl\Resource\ResourceInterface $resource, \Zend\Permissions\Acl\Role\RoleInterface $role, null | string $privilege) : string | null
If a rule does not exist or its attached assertion fails, which means that the rule is not applicable, then this method returns null. Otherwise, the rule type applies and is returned as either TYPE_ALLOW or TYPE_DENY.
If $resource or $role is null, then this means that the rule must apply to all Resources or Roles, respectively.
If $privilege is null, then the rule must apply to all privileges.
If all three parameters are null, then the default ACL rule type is returned, based on whether its assertion method passes.
null\Zend\Permissions\Acl\Resource\ResourceInterface
null\Zend\Permissions\Acl\Role\RoleInterface
nullstring
string
null
getRules(\Zend\Permissions\Acl\Resource\ResourceInterface $resource, \Zend\Permissions\Acl\Role\RoleInterface $role, bool $create) : array | null
If either $resource or $role is null, this means that the rules returned are for all Resources or all Roles, respectively. Both can be null to return the default rule set for all Resources and all Roles.
If the $create parameter is true, then a rule set is first created and then returned to the caller.
bool
array
null
roleDFSAllPrivileges(\Zend\Permissions\Acl\Role\RoleInterface $role, \Zend\Permissions\Acl\Resource\ResourceInterface $resource) : bool | null
This method returns true if a rule is found and allows access. If a rule exists and denies access, then this method returns false. If no applicable rule is found, then this method returns null.
bool
null
roleDFSOnePrivilege(\Zend\Permissions\Acl\Role\RoleInterface $role, \Zend\Permissions\Acl\Resource\ResourceInterface $resource, string $privilege) : bool | null
This method returns true if a rule is found and allows access. If a rule exists and denies access, then this method returns false. If no applicable rule is found, then this method returns null.
string
\Zend\Permissions\Acl\Exception\RuntimeException |
---|
bool
null
roleDFSVisitAllPrivileges(\Zend\Permissions\Acl\Role\RoleInterface $role, \Zend\Permissions\Acl\Resource\ResourceInterface $resource, array $dfs) : bool | null
This method returns true if a rule is found and allows access. If a rule exists and denies access, then this method returns false. If no applicable rule is found, then this method returns null.
This method is used by the internal depth-first search algorithm and may modify the DFS data structure.
array
\Zend\Permissions\Acl\Exception\RuntimeException |
---|
bool
null
roleDFSVisitOnePrivilege(\Zend\Permissions\Acl\Role\RoleInterface $role, \Zend\Permissions\Acl\Resource\ResourceInterface $resource, string $privilege, array $dfs) : bool | null
This method returns true if a rule is found and allows access. If a rule exists and denies access, then this method returns false. If no applicable rule is found, then this method returns null.
This method is used by the internal depth-first search algorithm and may modify the DFS data structure.
string
array
\Zend\Permissions\Acl\Exception\RuntimeException |
---|
bool
null
$isAllowedPrivilege : string
$isAllowedResource : Resource
$resources : array
$rules : array
OP_ADD
OP_REMOVE
TYPE_ALLOW
TYPE_DENY