Ejemplo n.º 1
0
 public function beforeAction($action)
 {
     Yii::$app->getSession()->setFlash('section', 'Users');
     if (!in_array($action->id, $this->ignoreAction)) {
         if (is_object(Yii::$app->user->identity)) {
             if (adminUser::isUserAdmin(Yii::$app->user->identity->username) == 1) {
                 return $action;
             }
         } else {
             return $this->goHome();
         }
     }
     return $action;
 }
Ejemplo n.º 2
0
 public function beforeAction($action)
 {
     if (!in_array($action->id, $this->ignoreAction)) {
         if (is_object(Yii::$app->user->identity)) {
             if (adminUser::isUserAdmin(Yii::$app->user->identity->username) == 1) {
                 return $action;
             }
         } else {
             return $this->goHome();
         }
     }
     // $this->enableCsrfValidation = false;
     return parent::beforeAction($action);
 }
Ejemplo n.º 3
0
 public function loginAdmin()
 {
     if ($this->validate() && adminUser::isUserAdmin($this->username)) {
         return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
     } else {
         return false;
     }
 }