当前位置: 首页>>代码示例>>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;未经允许,请勿转载。