PHP Класс Acl\Adapter\Utility\PhpAro

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

Открытые свойства

Свойство Тип Описание
$aliases array aliases to map
$map array ['Users' => ['username' => 'jeff', 'role' => 'editor']] is passed as an ARO to one of the methods of AclComponent, PhpAcl will check if it can be resolved to an User or a Role defined in the configuration file.

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

Свойство Тип Описание
$_tree array internal ARO representation

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

Метод Описание
__construct ( array $aro = [], array $map = [], array $aliases = [] ) Constructor
addAlias ( array $alias ) : void adds one or more aliases to the internal map. Overwrites existing entries.
addRole ( array $aro ) : void adds a new ARO to the tree
build ( array $aros ) : void build an ARO tree structure for internal processing
resolve ( string | array $aro ) : string resolve an ARO identifier to an internal ARO string using the internal mapping information.
roles ( string | array $aro ) : array From the perspective of the given ARO, walk down the tree and collect all inherited AROs levelwise such that AROs from different branches with equal distance to the requested ARO will be collected at the same index. The resulting array will contain a prioritized list of (list of) roles ordered from the most distant AROs to the requested one itself.

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

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

Constructor
public __construct ( array $aro = [], array $map = [], array $aliases = [] )
$aro array Aro instance
$map array Map
$aliases array Aliases

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

adds one or more aliases to the internal map. Overwrites existing entries.
public addAlias ( array $alias ) : void
$alias array alias from => to (e.g. Role/13 -> Role/editor)
Результат void

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

adds a new ARO to the tree
public addRole ( array $aro ) : void
$aro array one or more ARO records
Результат void

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

build an ARO tree structure for internal processing
public build ( array $aros ) : void
$aros array array of AROs as key and their inherited AROs as values
Результат void

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

resolve an ARO identifier to an internal ARO string using the internal mapping information.
public resolve ( string | array $aro ) : string
$aro string | array ARO identifier (Users.jeff, ['Users' => ...], etc)
Результат string internal aro string (e.g. Users/jeff, Role/default)

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

From the perspective of the given ARO, walk down the tree and collect all inherited AROs levelwise such that AROs from different branches with equal distance to the requested ARO will be collected at the same index. The resulting array will contain a prioritized list of (list of) roles ordered from the most distant AROs to the requested one itself.
public roles ( string | array $aro ) : array
$aro string | array An ARO identifier
Результат array prioritized AROs

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

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

internal ARO representation
protected array $_tree
Результат array

$aliases публичное свойство

aliases to map
public array $aliases
Результат array

$map публичное свойство

['Users' => ['username' => 'jeff', 'role' => 'editor']] is passed as an ARO to one of the methods of AclComponent, PhpAcl will check if it can be resolved to an User or a Role defined in the configuration file.
public array $map
Результат array