PHP Класс SimpleAcl\Acl

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$ruleClass string Class name used when rule created from string.
$rules SimpleAcl\Rule[] Contains registered rules.

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

Метод Описание
addRule ( ) Adds rule.
getRuleClass ( ) : string Return rule class.
hasRule ( SimpleAcl\Rule | mixed $needRule ) : boolean Return true if rule was already added.
isAllowed ( string | SimpleAcl\Role\RoleAggregateInterface $roleName, string | SimpleAcl\Resource\ResourceAggregateInterface $resourceName, string $ruleName ) : boolean Checks is access allowed.
isAllowedReturnResult ( string | SimpleAcl\Role\RoleAggregateInterface $roleAggregate, string | SimpleAcl\Resource\ResourceAggregateInterface $resourceAggregate, string $ruleName ) : SimpleAcl\RuleResultCollection Checks is access allowed.
removeAllRules ( ) Remove all rules.
removeRule ( null | string $roleName = null, null | string $resourceName = null, null | string $ruleName = null, boolean $all = true ) Remove rules by rule name and (or) role and resource.
removeRuleById ( mixed $ruleId ) Removes rule by its id.
setRuleClass ( string $ruleClass ) Set rule class.

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

Метод Описание
getNames ( string | SimpleAcl\Role\RoleAggregateInterface | SimpleAcl\Resource\ResourceAggregateInterface $object ) : array Get names.
isRuleAllow ( string $roleName, string $resourceName, $ruleName, SimpleAcl\RuleResultCollection $ruleResultCollection, string | SimpleAcl\Role\RoleAggregateInterface $roleAggregate, string | SimpleAcl\Resource\ResourceAggregateInterface $resourceAggregate ) Check is access allowed by some rule.

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

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

Assign $role, $resource and $action to added rule. If rule was already registered only change $role, $resource and $action for that rule. This method accept 1, 2, 3 or 4 arguments: addRule($rule) addRule($rule, $action) addRule($role, $resource, $rule) addRule($role, $resource, $rule, $action)
public addRule ( )

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

Get names.
protected getNames ( string | SimpleAcl\Role\RoleAggregateInterface | SimpleAcl\Resource\ResourceAggregateInterface $object ) : array
$object string | SimpleAcl\Role\RoleAggregateInterface | SimpleAcl\Resource\ResourceAggregateInterface
Результат array

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

Return rule class.
public getRuleClass ( ) : string
Результат string

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

Return true if rule was already added.
public hasRule ( SimpleAcl\Rule | mixed $needRule ) : boolean
$needRule SimpleAcl\Rule | mixed
Результат boolean

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

Checks is access allowed.
public isAllowed ( string | SimpleAcl\Role\RoleAggregateInterface $roleName, string | SimpleAcl\Resource\ResourceAggregateInterface $resourceName, string $ruleName ) : boolean
$roleName string | SimpleAcl\Role\RoleAggregateInterface
$resourceName string | SimpleAcl\Resource\ResourceAggregateInterface
$ruleName string
Результат boolean

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

Checks is access allowed.
public isAllowedReturnResult ( string | SimpleAcl\Role\RoleAggregateInterface $roleAggregate, string | SimpleAcl\Resource\ResourceAggregateInterface $resourceAggregate, string $ruleName ) : SimpleAcl\RuleResultCollection
$roleAggregate string | SimpleAcl\Role\RoleAggregateInterface
$resourceAggregate string | SimpleAcl\Resource\ResourceAggregateInterface
$ruleName string
Результат SimpleAcl\RuleResultCollection

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

Returns null if rule don't match any role or resource.
protected isRuleAllow ( string $roleName, string $resourceName, $ruleName, SimpleAcl\RuleResultCollection $ruleResultCollection, string | SimpleAcl\Role\RoleAggregateInterface $roleAggregate, string | SimpleAcl\Resource\ResourceAggregateInterface $resourceAggregate )
$roleName string
$resourceName string
$ruleName
$ruleResultCollection SimpleAcl\RuleResultCollection
$roleAggregate string | SimpleAcl\Role\RoleAggregateInterface
$resourceAggregate string | SimpleAcl\Resource\ResourceAggregateInterface

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

Remove all rules.
public removeAllRules ( )

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

Remove rules by rule name and (or) role and resource.
public removeRule ( null | string $roleName = null, null | string $resourceName = null, null | string $ruleName = null, boolean $all = true )
$roleName null | string
$resourceName null | string
$ruleName null | string
$all boolean

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

Removes rule by its id.
public removeRuleById ( mixed $ruleId )
$ruleId mixed

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

Set rule class.
public setRuleClass ( string $ruleClass )
$ruleClass string

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

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

Class name used when rule created from string.
protected string $ruleClass
Результат string

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

Contains registered rules.
protected Rule[],SimpleAcl $rules
Результат SimpleAcl\Rule[]