Esempio n. 1
0
 /** @inheritdoc */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->user = User::findIdentityByUsernameOrEmail(trim($this->login));
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 /**
  * Назначение пользователю прав администратора
  *
  * @param $search
  */
 public function actionAdmin($search)
 {
     $user = User::findIdentityByUsernameOrEmail($search);
     if ($user) {
         $rbac = new Rbac();
         $rbac->setAdminRole($user);
         $this->stdout(Yii::t('users', 'Admin rights granted') . "\n", Console::FG_GREEN);
     } else {
         $this->stdout(Yii::t('users', 'User is not found') . "\n", Console::FG_RED);
     }
 }