original_string: public function export()
      {
          $this->loadModel('User.Acos');
          $out = [];
          $permissions = $this->Acos->Permissions
              ->find()
              ->contain(['Acos', 'Roles'])
              ->all();
  
          foreach ($permissions as $permission) {
              if (!isset($out[$permission->role->slug])) {
                  $out[$permission->role->slug] = [];
              }
              $out[$permission->role->slug][] = implode(
                  '/',
                  $this->Acos
                  ->find('path', ['for' => $permission->aco->id])
                  ->extract('alias')
                  ->toArray()
              );
          }
  
          $this->title(__d('user', 'Export Permissions'));
          $this->response->body(json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
          $this->response->type('json');
          $this->response->download('permissions_' . date('Y-m-d@H:i:s-\U\TC', time()) . '.json');
  
          return $this->response;
      }
code: public function export()
      {
          $this->loadModel('User.Acos');
          $out = [];
          $permissions = $this->Acos->Permissions
              ->find()
              ->contain(['Acos', 'Roles'])
              ->all();
  
          foreach ($permissions as $permission) {
              if (!isset($out[$permission->role->slug])) {
                  $out[$permission->role->slug] = [];
              }
              $out[$permission->role->slug][] = implode(
                  '/',
                  $this->Acos
                  ->find('path', ['for' => $permission->aco->id])
                  ->extract('alias')
                  ->toArray()
              );
          }
  
          $this->title(__d('user', 'Export Permissions'));
          $this->response->body(json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
          $this->response->type('json');
          $this->response->download('permissions_' . date('Y-m-d@H:i:s-\U\TC', time()) . '.json');
  
          return $this->response;
      }
code_tokens: public function export ( ) { $ this -> loadModel ( 'User.Acos' ) ; $ out = [ ] ; $ permissions = $ this -> Acos -> Permissions -> find ( ) -> contain ( [ 'Acos' , 'Roles' ] ) -> all ( ) ; foreach ( $ permissions as $ permission ) { if ( ! isset ( $ out [ $ permission -> role -> slug ] ) ) { $ out [ $ permission -> role -> slug ] = [ ] ; } $ out [ $ permission -> role -> slug ] [ ] = implode ( '/' , $ this -> Acos -> find ( 'path' , [ 'for' => $ permission -> aco -> id ] ) -> extract ( 'alias' ) -> toArray ( ) ) ; } $ this -> title ( __d ( 'user' , 'Export Permissions' ) ) ; $ this -> response -> body ( json_encode ( $ out , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ) ; $ this -> response -> type ( 'json' ) ; $ this -> response -> download ( 'permissions_' . date ( 'Y-m-d@H:i:s-\U\TC' , time ( ) ) . '.json' ) ; return $ this -> response ; }
docstring: Exports all permissions as a JSON file.
  
  @return \Cake\Network\Response Forces JSON download
docstring_tokens: Exports all permissions as a JSON file .