当前位置: 首页>>代码示例>>PHP>>正文


PHP AccessControl::beforeAction方法代码示例

本文整理汇总了PHP中yii\filters\AccessControl::beforeAction方法的典型用法代码示例。如果您正苦于以下问题:PHP AccessControl::beforeAction方法的具体用法?PHP AccessControl::beforeAction怎么用?PHP AccessControl::beforeAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\filters\AccessControl的用法示例。


在下文中一共展示了AccessControl::beforeAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeAction

 /**
  * This method is invoked right before an action is to be executed (after all possible filters.)
  * You may override this method to do last-minute preparation for the action.
  * @param \yii\base\Action $action the action to be executed.
  * @return boolean whether the action should continue to be executed.
  */
 public function beforeAction($action)
 {
     $user = Yii::$app->getUser();
     $uniqueId = $action->getUniqueId();
     if ($user->can($uniqueId)) {
         return true;
     }
     return parent::beforeAction($action);
 }
开发者ID:apurey,项目名称:cmf,代码行数:15,代码来源:AccessControl.php

示例2: beforeAction

 /**
  * @inheritdoc
  */
 public function beforeAction($action)
 {
     $controller = $action->controller;
     $params = ArrayHelper::getValue($this->params, $action->id, []);
     if (Yii::$app->user->can('/' . $action->getUniqueId(), $params)) {
         return true;
     }
     do {
         if (Yii::$app->user->can('/' . ltrim($controller->getUniqueId() . '/*', '/'))) {
             return true;
         }
         $controller = $controller->module;
     } while ($controller !== null);
     return parent::beforeAction($action);
 }
开发者ID:yii2mod,项目名称:yii2-rbac,代码行数:18,代码来源:AccessControl.php

示例3: beforeAction

 /**
  * This method is invoked right before an action is to be executed (after all possible filters.)
  * You may override this method to do last-minute preparation for the action.
  * @param InlineAction $action the action to be executed.
  * @return boolean whether the action should continue to be executed.
  */
 public function beforeAction($action)
 {
     $actionId = $action->getUniqueId();
     $user = Yii::$app->getUser();
     if ($user->can('/' . $actionId)) {
         return true;
     }
     $controller = $action->controller;
     do {
         if ($user->can('/' . ltrim($controller->getUniqueId() . '/*', '/'))) {
             return true;
         }
         $controller = $controller->module;
     } while ($controller !== null);
     return parent::beforeAction($action);
 }
开发者ID:reuhtte,项目名称:yii2-admin,代码行数:22,代码来源:AccessControl.php

示例4: beforeAction

 /**
  * This method is invoked right before an action is to be executed (after all possible filters.)
  * You may override this method to do last-minute preparation for the action.
  * @param Action $action the action to be executed.
  * @return boolean whether the action should continue to be executed.
  */
 public function beforeAction($action)
 {
     return parent::beforeAction($action);
 }
开发者ID:babagay,项目名称:razzd,代码行数:10,代码来源:AccessControl.php


注:本文中的yii\filters\AccessControl::beforeAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。