Method |
Description |
|
__construct ( mixed $currentUser, mixed $dispatcher = null ) |
Authority constructor |
|
addAlias ( string $name, array $actions ) : authority\RuleAlias |
Define new alias for an action |
|
addRule ( boolean $allow, array | string $actions, mixed $resource, Closure | null $condition = null ) : array | Rule |
Define rule for a given action and resource |
|
allow ( array | string $actions, mixed $resource, Closure | null $condition = null ) : array | Rule |
Define privilege for a given action and resource |
|
can ( $action, $resource, $resourceValue = null ) : boolean |
Determine if current user can access the given action and resource |
|
cannot ( $action, $resource, $resourceValue = null ) : boolean |
Determine if current user cannot access the given action and resource
Returns negation of can() |
|
deny ( array | string $actions, mixed $resource, Closure | null $condition = null ) : array | Rule |
Define restriction for a given action and resource |
|
dispatch ( string $eventName, mixed $payload = [] ) : mixed | null |
Fires event from current dispatcher |
|
getAlias ( $name ) : authority\RuleAlias | null |
Returns a RuleAlias for a given action name |
|
getAliases ( ) : array |
Returns all aliases |
|
getAliasesForAction ( $action ) : array |
Returns all actions a given action applies to |
|
getCurrentUser ( ) : mixed |
Returns current user |
|
getRules ( ) : RuleRepository |
Returns the current rule set |
|
getRulesFor ( $action, $resource ) : RuleRepository |
Returns all rules relevant to the given action and resource |
|
setCurrentUser ( mixed $currentUser ) : void |
Set current user |
|
setDispatcher ( mixed $dispatcher ) : void |
Set dispatcher |
|
user ( ) : mixed |
Returns current user - alias of getCurrentUser() |
|