public function permissions()
    {
        if (is_array($this->_permissions)) {
            return $this->_permissions;
        }

        $out = [];
        $acosTable = TableRegistry::get('User.Acos');
        $permissions = $acosTable
            ->Permissions
            ->find()
            ->where(['Acos.plugin' => $this->name])
            ->contain(['Acos', 'Roles'])
            ->all();

        foreach ($permissions as $permission) {
            if (!isset($out[$permission->role->slug])) {
                $out[$permission->role->slug] = [];
            }
            $out[$permission->role->slug][] = implode(
                '/',
                $acosTable
                ->find('path', ['for' => $permission->aco->id])
                ->extract('alias')
                ->toArray()
            );
        }

        $this->_permissions = $out;

        return $out;
    }
public function permissions()
    {
        if (is_array($this->_permissions)) {
            return $this->_permissions;
        }

        $out = [];
        $acosTable = TableRegistry::get('User.Acos');
        $permissions = $acosTable
            ->Permissions
            ->find()
            ->where(['Acos.plugin' => $this->name])
            ->contain(['Acos', 'Roles'])
            ->all();

        foreach ($permissions as $permission) {
            if (!isset($out[$permission->role->slug])) {
                $out[$permission->role->slug] = [];
            }
            $out[$permission->role->slug][] = implode(
                '/',
                $acosTable
                ->find('path', ['for' => $permission->aco->id])
                ->extract('alias')
                ->toArray()
            );
        }

        $this->_permissions = $out;

        return $out;
    }
public function permissions ( ) { if ( is_array ( $ this -> _permissions ) ) { return $ this -> _permissions ; } $ out = [ ] ; $ acosTable = TableRegistry :: get ( 'User.Acos' ) ; $ permissions = $ acosTable -> Permissions -> find ( ) -> where ( [ 'Acos.plugin' => $ this -> name ] ) -> contain ( [ 'Acos' , 'Roles' ] ) -> all ( ) ; foreach ( $ permissions as $ permission ) { if ( ! isset ( $ out [ $ permission -> role -> slug ] ) ) { $ out [ $ permission -> role -> slug ] = [ ] ; } $ out [ $ permission -> role -> slug ] [ ] = implode ( '/' , $ acosTable -> find ( 'path' , [ 'for' => $ permission -> aco -> id ] ) -> extract ( 'alias' ) -> toArray ( ) ) ; } $ this -> _permissions = $ out ; return $ out ; }
Gets plugin's permissions tree.

### Output example:

```php
[
'administrator' => [
'Plugin/Controller/action',
'Plugin/Controller/action2',
...
],
'role-machine-name' => [
'Plugin/Controller/anotherAction',
'Plugin/Controller/anotherAction2',
],
...
]
```

@return array Permissions index by role's machine-name
Gets plugin s permissions tree .