original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Gets plugin s permissions tree .