[MM-63355] Add AuthData to mmctl user search output (#30478)

Этот коммит содержится в:
Ben Schumacher
2025-06-19 11:52:16 +02:00
коммит произвёл GitHub
родитель 04a60b6609
Коммит cfc1503d62
7 изменённых файлов: 138 добавлений и 72 удалений

Просмотреть файл

@@ -659,24 +659,28 @@ func (u *User) Etag(showFullName, showEmail bool) string {
// Remove any private data from the user object
func (u *User) Sanitize(options map[string]bool) {
u.Password = ""
u.AuthData = NewPointer("")
u.MfaSecret = ""
u.MfaUsedTimestamps = nil
u.LastLogin = 0
if len(options) != 0 && !options["email"] {
u.Email = ""
delete(u.Props, UserPropsKeyRemoteEmail)
}
if len(options) != 0 && !options["fullname"] {
u.FirstName = ""
u.LastName = ""
}
if len(options) != 0 && !options["passwordupdate"] {
u.LastPasswordUpdate = 0
}
if len(options) != 0 && !options["authservice"] {
u.AuthService = ""
if len(options) != 0 {
if !options["email"] {
u.Email = ""
delete(u.Props, UserPropsKeyRemoteEmail)
}
if !options["fullname"] {
u.FirstName = ""
u.LastName = ""
}
if !options["passwordupdate"] {
u.LastPasswordUpdate = 0
}
if !options["authservice"] {
u.AuthService = ""
}
if !options["authdata"] {
u.AuthData = NewPointer("")
}
}
}
@@ -703,7 +707,6 @@ func (u *User) SanitizeInput(isAdmin bool) {
func (u *User) ClearNonProfileFields(asAdmin bool) {
u.Password = ""
u.AuthData = NewPointer("")
u.MfaSecret = ""
u.MfaUsedTimestamps = nil
u.EmailVerified = false
@@ -711,6 +714,7 @@ func (u *User) ClearNonProfileFields(asAdmin bool) {
u.LastPasswordUpdate = 0
if !asAdmin {
u.AuthData = NewPointer("")
u.NotifyProps = StringMap{}
u.FailedAttempts = 0
}