Zend\Permissions\Acl\Acl::setRule
Performs operations on ACL rules
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.
Signature
public function setRule(string
$operation,
[AssertionInterface
$type = null,
[AssertionInterface
$roles = null,
[AssertionInterface
$resources = null,
[AssertionInterface
$privileges = null,
[AssertionInterface
$assert = null]]]]] )
Parameters
$operation
— string$type
— string$roles
— object
$resources
— object
$privileges
— object
$assert
— Zend\Permissions\Acl\Assertion\AssertionInterface
Returns
- Acl
- Provides a fluent interface