Class PhpAro

Access Request Object

Package: Cake\Controller\Component\Acl
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Controller/Component/Acl/PhpAcl.php

Constants summary

Properties summary

  • $_tree protected
    array
    internal ARO representation
  • $aliases public
    array
    aliases to map
  • $map public
    array
    map external identifiers. E.g. if

Method Summary

  • __construct() public
    Constructor
  • addAlias() public
    adds one or more aliases to the internal map. Overwrites existing entries.
  • addRole() public
    adds a new ARO to the tree
  • build() public
    build an ARO tree structure for internal processing
  • resolve() public

    resolve an ARO identifier to an internal ARO string using the internal mapping information.

  • roles() public

    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 Detail

__construct()source public

__construct( array $aro array() , array $map array() , array $aliases array() )

Constructor

Parameters

array $aro optional array()
The aro data
array $map optional array()
The identifier mappings
array $aliases optional array()
The aliases to map.

addAlias()source public

addAlias( array $alias )

adds one or more aliases to the internal map. Overwrites existing entries.

Parameters

array $alias
alias from => to (e.g. Role/13 -> Role/editor)

addRole()source public

addRole( array $aro )

adds a new ARO to the tree

Parameters

array $aro
one or more ARO records

build()source public

build( array $aros )

build an ARO tree structure for internal processing

Parameters

array $aros
array of AROs as key and their inherited AROs as values

resolve()source public

resolve( string|array $aro )

resolve an ARO identifier to an internal ARO string using the internal mapping information.

Parameters

string|array $aro
ARO identifier (User.jeff, array('User' => ...), etc)

Returns

string
internal aro string (e.g. User/jeff, Role/default)

roles()source public

roles( string|array $aro )

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.

Parameters

string|array $aro
An ARO identifier

Returns

array
prioritized AROs

Properties detail

$_treesource

protected array

internal ARO representation

array()

$aliasessource

public array

aliases to map

array()

$mapsource

public array

map external identifiers. E.g. if

array('User' => array('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.

See

app/Config/acl.php
array(
    'User' => 'User/username',
    'Role' => 'User/role',
)

© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-PhpAro.html