Sysadmin manage user settings (#27583)
* Opened modal from system console * WIP * WIP * WIP * Handled saving user * Successfully updated user based settings * WIP * WIP * All settings are updating well * Fixed modal style * Added admin mode indicators in modal * Added confirmation dialog * Lint fixes * Added license check * Added permission check * Fixed i18n file order * type fix * Updated snapshots * Handled performance debugging setting * Some styling tweaks * Fixed text alighnment * Updated license required from professional to enterprise * Handled long user names * review fixes * Added manage setting option in user list page context menu * Added loader * Minor reordering * Removed confirm modal * Updated snapshots for removed modal * Added some tests * Lint fix * Used new selector in user detail page * Used new selector in user list page * Updated tests * Fixed an incorrect default test
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0df1a62f61
Коммит
87d983cc7f
@@ -144,7 +144,7 @@ func (u *UserReportOptions) IsValid() *AppError {
|
||||
}
|
||||
|
||||
func (u *UserReportQuery) ToReport() *UserReport {
|
||||
u.ClearNonProfileFields()
|
||||
u.ClearNonProfileFields(false)
|
||||
return &UserReport{
|
||||
User: u.User,
|
||||
UserPostStats: u.UserPostStats,
|
||||
|
||||
@@ -695,19 +695,22 @@ func (u *User) SanitizeInput(isAdmin bool) {
|
||||
u.Email = strings.TrimSpace(u.Email)
|
||||
}
|
||||
|
||||
func (u *User) ClearNonProfileFields() {
|
||||
func (u *User) ClearNonProfileFields(asAdmin bool) {
|
||||
u.Password = ""
|
||||
u.AuthData = NewString("")
|
||||
u.MfaSecret = ""
|
||||
u.EmailVerified = false
|
||||
u.AllowMarketing = false
|
||||
u.NotifyProps = StringMap{}
|
||||
u.LastPasswordUpdate = 0
|
||||
u.FailedAttempts = 0
|
||||
|
||||
if !asAdmin {
|
||||
u.NotifyProps = StringMap{}
|
||||
}
|
||||
}
|
||||
|
||||
func (u *User) SanitizeProfile(options map[string]bool) {
|
||||
u.ClearNonProfileFields()
|
||||
func (u *User) SanitizeProfile(options map[string]bool, asAdmin bool) {
|
||||
u.ClearNonProfileFields(asAdmin)
|
||||
|
||||
u.Sanitize(options)
|
||||
}
|
||||
|
||||
@@ -551,12 +551,12 @@ func TestSanitizeProfile(t *testing.T) {
|
||||
Props: StringMap{UserPropsKeyRemoteEmail: "remote@doe.com"},
|
||||
}
|
||||
|
||||
user.SanitizeProfile(nil)
|
||||
user.SanitizeProfile(nil, false)
|
||||
|
||||
require.Equal(t, "john@doe.com", user.Email)
|
||||
require.Equal(t, "remote@doe.com", user.Props[UserPropsKeyRemoteEmail])
|
||||
|
||||
user.SanitizeProfile(map[string]bool{"email": false})
|
||||
user.SanitizeProfile(map[string]bool{"email": false}, false)
|
||||
|
||||
require.Empty(t, user.Email)
|
||||
require.Empty(t, user.Props[UserPropsKeyRemoteEmail])
|
||||
|
||||
Ссылка в новой задаче
Block a user