summaryrefslogtreecommitdiffstats
path: root/model/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/user.go')
-rw-r--r--model/user.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/model/user.go b/model/user.go
index 3da862b6b..f857d5ef4 100644
--- a/model/user.go
+++ b/model/user.go
@@ -251,6 +251,22 @@ func (u *User) ClearNonProfileFields() {
u.FailedAttempts = 0
}
+func (u *User) SanitizeProfile(isSystemAdmin, pwdupdate, fullname, email bool) {
+ options := map[string]bool{}
+ options["passwordupdate"] = pwdupdate
+
+ if isSystemAdmin {
+ options["fullname"] = true
+ options["email"] = true
+ } else {
+ options["fullname"] = fullname
+ options["email"] = email
+ u.ClearNonProfileFields()
+ }
+
+ u.Sanitize(options)
+}
+
func (u *User) MakeNonNil() {
if u.Props == nil {
u.Props = make(map[string]string)