Exemple #1
0
 /**
  * [loginAdmin description]
  * @return [type] [description]
  */
 public function loginAdmin()
 {
     if ($this->validate() && UserDetails::isUserAdmin($this->username)) {
         return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
     } else {
         return false;
     }
 }
 /**
  * [behaviors description]
  * @return [type] [description]
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
         return UserDetails::isUserAdmin(Yii::$app->user->identity->id);
     }], ['actions' => ['login'], 'allow' => true, 'roles' => ['?']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
 }