diff --git a/backend/models/UserCreate.php b/backend/models/UserCreate.php index 710765c..671cc14 100644 --- a/backend/models/UserCreate.php +++ b/backend/models/UserCreate.php @@ -33,6 +33,8 @@ class UserCreate extends User{ [['role'], 'required'], [['role'], 'string', 'max' => 20], + ['status', 'default', 'value' => self::STATUS_ACTIVE], + ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], ]; } @@ -47,7 +49,7 @@ class UserCreate extends User{ public function attributeLabels(){ return [ - + 'status' => 'Státusz', 'email' =>'E-mail', 'username' =>'Felhasználónév', 'created_at' =>'Létrehozás dátuma', diff --git a/backend/models/UserSearch.php b/backend/models/UserSearch.php index bbf528d..2600490 100644 --- a/backend/models/UserSearch.php +++ b/backend/models/UserSearch.php @@ -47,7 +47,7 @@ class UserSearch extends User 'query' => $query, ]); - $query->andWhere(['status' => User::STATUS_ACTIVE]); + //$query->andWhere(['status' => User::STATUS_ACTIVE]); $this->load($params); diff --git a/backend/models/UserUpdate.php b/backend/models/UserUpdate.php index 03a47f8..1ef004a 100644 --- a/backend/models/UserUpdate.php +++ b/backend/models/UserUpdate.php @@ -33,6 +33,10 @@ class UserUpdate extends User { ], [['role'], 'required'], [['role'], 'string', 'max' => 20], + + ['status', 'default', 'value' => self::STATUS_ACTIVE], + ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], + ]; } @@ -51,6 +55,7 @@ class UserUpdate extends User { public function attributeLabels() { return [ + 'status' => 'Státusz', 'email' => 'E-mail', 'username' => 'Felhasználónév', 'created_at' => 'Létrehozás dátuma', diff --git a/backend/views/user/_form.php b/backend/views/user/_form.php index 7a8afe7..70a6870 100644 --- a/backend/views/user/_form.php +++ b/backend/views/user/_form.php @@ -5,6 +5,7 @@ use yii\widgets\ActiveForm; use yii\grid\GridView; use yii\data\ArrayDataProvider; use common\components\RoleDefinition; +use common\models\User; /* @var $this yii\web\View */ /* @var $model common\models\User */ @@ -25,6 +26,8 @@ asort($roleOptions); field($model, 'username')->textInput() ?> field($model, 'email')->textInput() ?> + field($model, 'status') + ->dropDownList(User::statuses())->hint("Csak aktív felhasználó tud bejelentkezni") ?> field($model, 'password_plain')->passwordInput() ?> field($model, 'password_repeat')->passwordInput() ?> field($model, 'role')->dropDownList($roleOptions) ?> diff --git a/backend/views/user/index.php b/backend/views/user/index.php index 6ecfb7f..deb5200 100644 --- a/backend/views/user/index.php +++ b/backend/views/user/index.php @@ -31,7 +31,7 @@ $this->params['breadcrumbs'][] = $this->title; 'username', 'email:email', 'created_at:datetime', - + ['attribute' => 'status' , 'value' => 'statusHuman'], [ 'attribute' => 'role', 'value' => function ($model){ diff --git a/common/models/User.php b/common/models/User.php index d61b17f..ce1414d 100644 --- a/common/models/User.php +++ b/common/models/User.php @@ -212,6 +212,7 @@ class User extends ActiveRecord implements IdentityInterface public function attributeLabels(){ return [ + 'status' => 'Státusz', 'username' => Yii::t('backend/user', 'Username'), 'email' => Yii::t('backend/user', 'E-Mail'), 'created_at' => Yii::t('backend/user', 'Created at'),