當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AppController::isAuthorized方法代碼示例

本文整理匯總了PHP中App\Controller\AppController::isAuthorized方法的典型用法代碼示例。如果您正苦於以下問題:PHP AppController::isAuthorized方法的具體用法?PHP AppController::isAuthorized怎麽用?PHP AppController::isAuthorized使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在App\Controller\AppController的用法示例。


在下文中一共展示了AppController::isAuthorized方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isAuthorized

 public function isAuthorized($user)
 {
     if ($this->request->action === 'index') {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:Cylindric,項目名稱:edge,代碼行數:7,代碼來源:WeaponsController.php

示例2: isAuthorized

 public function isAuthorized($user)
 {
     if (in_array($this->request->action, ['addComment'])) {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:webroup17,項目名稱:social_networking,代碼行數:7,代碼來源:CommentsController.php

示例3: isAuthorized

 public function isAuthorized($user)
 {
     if ($user['role'] != 'admin') {
         return false;
     }
     return parent::isAuthorized($user);
 }
開發者ID:esaul314,項目名稱:norn-cms,代碼行數:7,代碼來源:CategoriesController.php

示例4: isAuthorized

 public function isAuthorized($user)
 {
     // All registered users can add projects and view the index.
     if (in_array($this->request->action, ['add', 'index'])) {
         return true;
     }
     // The owner of an project can edit and delete it.
     if (in_array($this->request->action, ['view', 'edit', 'delete'])) {
         $projectId = (int) $this->request->params['pass'][0];
         if ($this->Projects->isOwnedBy($projectId, $user['id'])) {
             return true;
         }
     }
     $ProjectsUsers = TableRegistry::get('ProjectsUsers');
     // Check from the ProjectsUsers table if the person trying to access
     // is a moderator of that project.
     if (in_array($this->request->action, ['view'])) {
         $projectId = (int) $this->request->params['pass'][0];
         if ($ProjectsUsers->isModeratedBy($projectId, $user['id'])) {
             return true;
         }
     }
     // Check from the ProjectsUsers table if the person trying to access
     // is assigned to that project.
     if (in_array($this->request->action, ['view'])) {
         $projectId = (int) $this->request->params['pass'][0];
         if ($ProjectsUsers->isAssignedTo($projectId, $user['id'])) {
             return true;
         }
     }
     return parent::isAuthorized($user);
 }
開發者ID:Custodia,項目名稱:caketickets,代碼行數:32,代碼來源:ProjectsController.php

示例5: isAuthorized

 public function isAuthorized($user)
 {
     if (in_array($this->request->action, ['weeklyBets', 'add'])) {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:vetusbs,項目名稱:quiniela,代碼行數:7,代碼來源:MatchBetsController.php

示例6: isAuthorized

 public function isAuthorized($user = null)
 {
     //DTR: Por defecto no se autoriza el acceso al usuario/rol/controlador/accion.
     $res = false;
     //DTR: Si se quiere controlar en herencia, reusar el metodo padre...
     //...pero solo en herencia de "AppController"
     $res = parent::isAuthorized($user);
     //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' usuario= '.var_export( $user, true));
     //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' _SESSION= '.var_export( $_SESSION, true));
     //Cualquiera de las acciones de este controlador se permiten SOLO para
     //los  usuarios de rol administrador, y eso se controla ya en
     //"AppController".
     if (!$res) {
         $rol = $user['rol'];
         $controlador = $this->request->params['controller'];
         $accion = $this->request->params['action'];
         //Permite el aceso al usuario 'sysadmin
         if ($user['rol'] === 'sysadmin') {
             $res = true;
         }
         //Permite el acceso al método 'cambiarRol' al usuario 'sysadmin' únicamente
         if ($user['nombre'] === 'sysadmin' && $accion === 'cambiarRol') {
             //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' rol= '.$rol.', acceso= '.$controlador.'::'.$accion.', res= '.var_export( $res, true));
             //\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' _SESSION= '.var_export( $_SESSION, true));
             $res = true;
         }
     }
     if (isset($user) && $this->request->params['action'] === 'logout') {
         $res = true;
     }
     return $res;
 }
開發者ID:EPSZ-DAW2,項目名稱:daw2-2015-recetas-cocina,代碼行數:32,代碼來源:UsuariosController.php

示例7: isAuthorized

 public function isAuthorized($user)
 {
     if (in_array($this->request->action, ['addPost', 'indexPost', 'viewPost', 'deletePost'])) {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:webroup17,項目名稱:social_networking,代碼行數:7,代碼來源:PostsController.php

示例8: isAuthorized

 public function isAuthorized($user)
 {
     if (in_array($this->request->action, ['today', 'view', 'edit'])) {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:vetusbs,項目名稱:quiniela,代碼行數:7,代碼來源:FootballDaysController.php

示例9: isAuthorized

 public function isAuthorized($user = null)
 {
     if (in_array($this->request->action, ['index', 'view', 'logout'])) {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:alricklovesballs,項目名稱:M1BdD,代碼行數:7,代碼來源:UsersController.php

示例10: isAuthorized

 /**
  * isAuthorized method
  *
  * @param array $user User
  * @return bool
  */
 public function isAuthorized($user)
 {
     if (parent::isAuthorized($user)) {
         return true;
     }
     $accessible = ['changePassword', 'updateContact'];
     return in_array($this->request->action, $accessible);
 }
開發者ID:BallStateCBER,項目名稱:cri,代碼行數:14,代碼來源:UsersController.php

示例11: isAuthorized

 public function isAuthorized($user)
 {
     if (isset($user['role']) and $user['role'] === 'user') {
         if (in_array($this->request->action, ['home', 'view', 'logout'])) {
             return true;
         }
     }
     return parent::isAuthorized($user);
 }
開發者ID:edsonmgoz,項目名稱:pocake,代碼行數:9,代碼來源:UsersController.php

示例12: isAuthorized

 public function isAuthorized($user)
 {
     if (in_array($this->request->action, ['add', 'edit', 'delete'])) {
         if ($this->Auth->user('role') === 'admin') {
             return true;
         }
     }
     return parent::isAuthorized($user);
 }
開發者ID:EngenhariaLivre,項目名稱:Discussion,代碼行數:9,代碼來源:CategoriesController.php

示例13: isAuthorized

 /**
  * Check if user is authorized
  * Authorization restricted by ownership should use the method check() within Ownership Component
  * 
  * @param array $user
  * @return boolean
  */
 public function isAuthorized($user)
 {
     if (parent::isAuthorized($user)) {
         $action = $this->request->params['action'];
         // Allowing actions for logged users (excluding admin actions)
         return true;
     }
     return false;
 }
開發者ID:beyondkeysystem,項目名稱:CakePhp3-AppStarter,代碼行數:16,代碼來源:UsersController.php

示例14: isAuthorized

 public function isAuthorized($user)
 {
     $action = $this->request->params['action'];
     // The add and dashboard actions are always allowed.
     if (in_array($action, ['popup', 'popupadd'])) {
         return true;
     }
     return parent::isAuthorized($user);
 }
開發者ID:nadymain,項目名稱:quebolu,代碼行數:9,代碼來源:UploadsController.php

示例15: isAuthorized

 public function isAuthorized($user = null)
 {
     if (isset($user['role']) && $user['role'] !== $this->roles['Admin']) {
         if ($this->request->action === 'view') {
             return false;
         }
     }
     // Par défaut n'autorise pas
     return parent::isAuthorized($user);
 }
開發者ID:AFPA-Dijon,項目名稱:afpa,代碼行數:10,代碼來源:EditeursController.php


注:本文中的App\Controller\AppController::isAuthorized方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。