PHP Class Acl\Adapter\Utility\PhpAro

Afficher le fichier Open project: cakephp/acl Class Usage Examples

Méthodes publiques

Свойство Type Description
$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 Properties

Свойство Type Description
$_tree array internal ARO representation

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

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

addAlias() public méthode

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)
Résultat void

addRole() public méthode

adds a new ARO to the tree
public addRole ( array $aro ) : void
$aro array one or more ARO records
Résultat void

build() public méthode

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
Résultat void

resolve() public méthode

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)
Résultat string internal aro string (e.g. Users/jeff, Role/default)

roles() public méthode

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
Résultat array prioritized AROs

Property Details

$_tree protected_oe property

internal ARO representation
protected array $_tree
Résultat array

$aliases public_oe property

aliases to map
public array $aliases
Résultat array

$map public_oe property

['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
Résultat array