Exemplo n.º 1
0
 public function beforeAction($action)
 {
     if (!parent::beforeAction($action)) {
         return false;
     }
     //检查不需要登录的action uniqueID,如 site/login, site/captcha
     if (in_array($action->uniqueID, $this->ignoreLogin())) {
         return parent::beforeAction($action);
     }
     if (\Yii::$app->user->isGuest) {
         LuLu::go(['/site/login']);
     }
     if (!$this->rbacService->checkPermission('manager_admin')) {
         return $this->showMessage();
     }
     //return parent::beforeAction($action);
     if (in_array($action->uniqueID, $this->ingorePermission())) {
         return parent::beforeAction($action);
     }
     if (!$this->rbacService->checkPermission()) {
         return $this->showMessage();
     } else {
         return parent::beforeAction($action);
     }
 }