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


PHP AccessControl::init方法代碼示例

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


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

示例1: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->entity) {
         $this->rules = array_merge($this->entity);
     }
     parent::init();
 }
開發者ID:dawei101,項目名稱:yii2-admin-module,代碼行數:10,代碼來源:AccessControl.php

示例2: init

 public function init()
 {
     $rule = ['allow' => true, 'matchCallback' => function ($rule, $action) {
         return RoleManager::checkAccess($action);
     }];
     $this->rules[] = \Yii::createObject(array_merge($this->ruleConfig, $rule));
     parent::init();
 }
開發者ID:carono,項目名稱:yii2-components,代碼行數:8,代碼來源:RoleManagerFilter.php

示例3: init

 /**
  * @see \yii\filters\AccessControl::init()
  */
 public function init()
 {
     parent::init();
     //非正式環境下,每次請求都要對當前頁麵的權限進行檢查
     if (!YII_ENV_PROD) {
         $this->checkAuthItem();
     }
 }
開發者ID:jorry2008,項目名稱:turen,代碼行數:11,代碼來源:AccessControl.php

示例4: init

 /**
  * Initializes the [[rules]] array by instantiating rule objects from configurations.
  */
 public function init()
 {
     parent::init();
     $this->user = Instance::ensure($this->user, User::className());
     foreach ($this->rules as $i => $rule) {
         if (is_array($rule)) {
             $this->rules[$i] = Yii::createObject(array_merge($this->ruleConfig, $rule));
         }
     }
 }
開發者ID:pavlinter,項目名稱:yii2-adm-app,代碼行數:13,代碼來源:AccessControl.php

示例5: init

 public function init()
 {
     parent::init();
     if ($this->user->isGuest) {
         return true;
     }
     if (!$this->Privilege()) {
         die('您沒有權限訪問這個頁麵!');
     }
 }
開發者ID:BlackCodes,項目名稱:Mymine,代碼行數:10,代碼來源:MaccessControl.php

示例6: init

 public function init()
 {
     $this->user = Instance::ensure($this->user, User::className());
     $rolesObject = Yii::$app->authManager->getRolesByUser($this->user->id);
     if (!empty($rolesObject)) {
         foreach ($rolesObject as $roles => $object) {
             foreach ($object->data as $route) {
                 $this->_actions[] = $route;
             }
         }
     }
     $this->rules = [['actions' => $this->_actions, 'allow' => true]];
     parent::init();
 }
開發者ID:nicovicz,項目名稱:portalctv,代碼行數:14,代碼來源:AccessControl.php

示例7: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->denyMessage && !Yii::$app->user->isGuest) {
         $this->denyMessage = Yii::t('user', 'You have no rights to perform this action');
     } else {
         if (!$this->denyMessage && Yii::$app->user->isGuest) {
             $this->denyMessage = Yii::t('user', 'Need authorization to perform this action');
         }
     }
     $this->denyCallback = function ($rule, $action) {
         if ($this->denyMessage) {
             /* @var $systemAlert Alert */
             $systemAlert = Yii::$app->systemAlert;
             $systemAlert->setMessage(Alert::DANGER, $this->denyMessage);
         }
         if (Yii::$app->user->isGuest) {
             Yii::$app->user->loginRequired();
         } else {
             return false;
         }
     };
 }
開發者ID:kalyabin,項目名稱:comitka,代碼行數:26,代碼來源:AuthControl.php

示例8: init

 /**
  * Initializes the [[rules]] array by instantiating rule objects from configurations.
  */
 public function init()
 {
     parent::init();
 }
開發者ID:babagay,項目名稱:razzd,代碼行數:7,代碼來源:AccessControl.php

示例9: init

 /**
  * Set custom ruleConfig
  */
 public function init()
 {
     $this->ruleConfig = ['class' => 'frontend\\libraries\\filters\\AccessRule'];
     parent::init();
 }
開發者ID:weiyiyi,項目名稱:base,代碼行數:8,代碼來源:AccessControl.php


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