diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-05-10 09:46:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-10 09:46:09 -0700 |
commit | d8dd271e43550ab043c2db36c274092d7819fcab (patch) | |
tree | e297c0534a9684d57fc254281cf5cbc3d7c08e0f /model | |
parent | db6b8f6238853c6e7e48dc8015a0b25f97ee232a (diff) | |
download | chat-d8dd271e43550ab043c2db36c274092d7819fcab.tar.gz chat-d8dd271e43550ab043c2db36c274092d7819fcab.tar.bz2 chat-d8dd271e43550ab043c2db36c274092d7819fcab.zip |
MM-4998 Adding LoginIdAttribute to allow LDAP users to change their login ID without losing their account (#8756)
* Adding LoginIdAttribute
* Modifying LDAP to use loginIDAttribute.
* Adding IDAttribute migration and AD objectGUID support.
* Removing unused idea.
* Fix typo.
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 11 | ||||
-rw-r--r-- | model/switch_request.go | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/model/config.go b/model/config.go index 5074b7637..07cd9d977 100644 --- a/model/config.go +++ b/model/config.go @@ -1144,6 +1144,7 @@ type LdapSettings struct { NicknameAttribute *string IdAttribute *string PositionAttribute *string + LoginIdAttribute *string // Synchronization SyncIntervalMinutes *int @@ -1227,6 +1228,12 @@ func (s *LdapSettings) SetDefaults() { s.PositionAttribute = NewString(LDAP_SETTINGS_DEFAULT_POSITION_ATTRIBUTE) } + // For those upgrading to the version when LoginIdAttribute was added + // they need IdAttribute == LoginIdAttribute not to break + if s.LoginIdAttribute == nil { + s.LoginIdAttribute = s.IdAttribute + } + if s.SyncIntervalMinutes == nil { s.SyncIntervalMinutes = NewInt(60) } @@ -2074,6 +2081,10 @@ func (ls *LdapSettings) isValid() *AppError { if *ls.IdAttribute == "" { return NewAppError("Config.IsValid", "model.config.is_valid.ldap_id", nil, "", http.StatusBadRequest) } + + if *ls.LoginIdAttribute == "" { + return NewAppError("Config.IsValid", "model.config.is_valid.ldap_login_id", nil, "", http.StatusBadRequest) + } } return nil diff --git a/model/switch_request.go b/model/switch_request.go index e153c92f4..2a522f492 100644 --- a/model/switch_request.go +++ b/model/switch_request.go @@ -15,7 +15,7 @@ type SwitchRequest struct { Password string `json:"password"` NewPassword string `json:"new_password"` MfaCode string `json:"mfa_code"` - LdapId string `json:"ldap_id"` + LdapLoginId string `json:"ldap_id"` } func (o *SwitchRequest) ToJson() string { |