mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Fix using of user scenarios
This commit is contained in:
parent
5d651e38e6
commit
d0c2de9f46
@ -111,7 +111,7 @@ class UserController extends Controller
|
||||
$canEditAdminFields = Yii::$app->user->isAdmin() || !$user->isSystemAdmin();
|
||||
$canEditPassword = $canEditAdminFields && $authClientUserService->canChangePassword();
|
||||
|
||||
$user->scenario = 'editAdmin';
|
||||
$user->scenario = User::SCENARIO_EDIT_ADMIN;
|
||||
$user->profile->scenario = Profile::SCENARIO_EDIT_ADMIN;
|
||||
$profile = $user->profile;
|
||||
|
||||
|
@ -46,7 +46,7 @@ class UserEditForm extends User
|
||||
public function scenarios()
|
||||
{
|
||||
$scenarios = parent::scenarios();
|
||||
$scenarios['editAdmin'][] = 'groupSelection';
|
||||
$scenarios[static::SCENARIO_EDIT_ADMIN][] = 'groupSelection';
|
||||
|
||||
return $scenarios;
|
||||
}
|
||||
|
@ -160,18 +160,18 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
||||
}],
|
||||
[['created_by', 'updated_by'], 'integer'],
|
||||
[['status'], 'in', 'range' => array_keys(self::getStatusOptions())],
|
||||
[['visibility'], 'in', 'range' => array_keys(self::getVisibilityOptions()), 'on' => Profile::SCENARIO_EDIT_ADMIN],
|
||||
[['visibility'], 'in', 'range' => array_keys(self::getVisibilityOptions()), 'on' => static::SCENARIO_EDIT_ADMIN],
|
||||
[['tagsField', 'blockedUsersField'], 'safe'],
|
||||
[['guid'], 'string', 'max' => 45],
|
||||
[['time_zone'], 'validateTimeZone'],
|
||||
[['auth_mode'], 'string', 'max' => 10],
|
||||
[['language'], 'string', 'max' => 5],
|
||||
['language', 'in', 'range' => array_keys(Yii::$app->i18n->getAllowedLanguages()), 'except' => self::SCENARIO_APPROVE],
|
||||
['language', 'in', 'range' => array_keys(Yii::$app->i18n->getAllowedLanguages()), 'except' => static::SCENARIO_APPROVE],
|
||||
[['email'], 'unique'],
|
||||
[['email'], 'email'],
|
||||
[['email'], 'string', 'max' => 150],
|
||||
[['guid'], 'unique'],
|
||||
[['username'], 'validateForbiddenUsername', 'on' => [self::SCENARIO_REGISTRATION]],
|
||||
[['username'], 'validateForbiddenUsername', 'on' => [static::SCENARIO_REGISTRATION]],
|
||||
];
|
||||
|
||||
if ($this->isEmailRequired()) { // HForm does not support 'required' in combination with 'when'.
|
||||
|
Loading…
x
Reference in New Issue
Block a user