PHP Класс Efficiently\AuthorityController\Authority

Наследование: extends Authority\Authority
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$aliasedActions

Открытые методы

Метод Описание
__construct ( mixed $currentUser, mixed $dispatcher = null ) Authority constructor
addAlias ( string $name, string | array $actions ) : RuleAlias Define new alias for an action
addRule ( boolean $allow, string | array $actions, mixed $resources, Closure | null $condition = null ) : array Define rule(s) for a given action(s) and resource(s)
addRules ( $allow, $actions, $resources, $condition = null ) alias of addRule()
authorize ( $action, $resource, $args = null )
can ( $action, $resource, $resourceValue = null ) : boolean Determine if current user can access the given action and resource
clearAliasedActions ( ) Removes previously aliased actions including the defaults.
getAliases ( ) : array Returns an associative array of aliases.
getAliasesForAction ( $action ) This does the opposite kind of lookup as 'getExpandActions()'.
getExpandActions ( $actions ) rely on the actions to be expanded.
getRelevantConditions ( string | array $action, string | object $resource ) : array
getRulesFor ( $action, $resource ) : RuleRepository Returns all rules relevant to the given action and resource
getUnauthorizedMessage ( $action, $subject )
hasCondition ( string | array $action, string | object $resource ) : boolean

Защищенные методы

Метод Описание
addAliasAction ( $target, $actions )
getAliasedActions ( ) The key is the target and the value is an array of actions aliasing the key.
getDefaultAliasActions ( )
getUnauthorizedMessageKeys ( $action, $subject )
initDefaultAliases ( )
validateTarget ( $target ) User shouldn't specify targets with names of real actions or it will cause Seg fault

Описание методов

__construct() публичный Метод

Authority constructor
public __construct ( mixed $currentUser, mixed $dispatcher = null )
$currentUser mixed Current user in the application
$dispatcher mixed Dispatcher used for firing events

addAlias() публичный Метод

$this->$authority->addAlias('read', ['index', 'show']); $this->$authority->addAlias('create', 'new'); $this->$authority->addAlias('update', 'edit'); This way one can use $params['action'] in the controller to determine the permission.
public addAlias ( string $name, string | array $actions ) : RuleAlias
$name string Name of action
$actions string | array Action(s) that $name aliases
Результат RuleAlias

addAliasAction() защищенный Метод

protected addAliasAction ( $target, $actions )

addRule() публичный Метод

Define rule(s) for a given action(s) and resource(s)
public addRule ( boolean $allow, string | array $actions, mixed $resources, Closure | null $condition = null ) : array
$allow boolean True if privilege, false if restriction
$actions string | array Action(s) for the rule(s)
$resources mixed Resource(s) for the rule(s)
$condition Closure | null Optional condition for the rule
Результат array

addRules() публичный Метод

alias of addRule()
public addRules ( $allow, $actions, $resources, $condition = null )

authorize() публичный Метод

public authorize ( $action, $resource, $args = null )

can() публичный Метод

Determine if current user can access the given action and resource
public can ( $action, $resource, $resourceValue = null ) : boolean
Результат boolean

clearAliasedActions() публичный Метод

Removes previously aliased actions including the defaults.
public clearAliasedActions ( )

getAliasedActions() защищенный Метод

The key is the target and the value is an array of actions aliasing the key.
protected getAliasedActions ( )

getAliases() публичный Метод

The key is the target and the value is an array of actions aliasing the key.
public getAliases ( ) : array
Результат array

getAliasesForAction() публичный Метод

This does the opposite kind of lookup as 'getExpandActions()'.
public getAliasesForAction ( $action )

getDefaultAliasActions() защищенный Метод

protected getDefaultAliasActions ( )

getExpandActions() публичный Метод

rely on the actions to be expanded.
public getExpandActions ( $actions )

getRelevantConditions() публичный Метод

public getRelevantConditions ( string | array $action, string | object $resource ) : array
$action string | array Name of action(s)
$resource string | object Resource for the rule
Результат array

getRulesFor() публичный Метод

Returns all rules relevant to the given action and resource
public getRulesFor ( $action, $resource ) : RuleRepository
Результат RuleRepository

getUnauthorizedMessage() публичный Метод

public getUnauthorizedMessage ( $action, $subject )

getUnauthorizedMessageKeys() защищенный Метод

protected getUnauthorizedMessageKeys ( $action, $subject )

hasCondition() публичный Метод

public hasCondition ( string | array $action, string | object $resource ) : boolean
$action string | array Name of action(s)
$resource string | object Resource for the rule
Результат boolean

initDefaultAliases() защищенный Метод

protected initDefaultAliases ( )

validateTarget() защищенный Метод

User shouldn't specify targets with names of real actions or it will cause Seg fault
protected validateTarget ( $target )

Описание свойств

$aliasedActions защищенное свойство

protected $aliasedActions