diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-06-09 12:08:02 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-06-09 12:08:02 -0400 |
commit | f34a820a223c9ec7bfac5996b6245d364d25fe1a (patch) | |
tree | 3cb2414a078b879e1e86b24cb6c26328a602bd40 /model | |
parent | de907280a7932a387909fc9310e6bd50269bbd98 (diff) | |
download | chat-f34a820a223c9ec7bfac5996b6245d364d25fe1a.tar.gz chat-f34a820a223c9ec7bfac5996b6245d364d25fe1a.tar.bz2 chat-f34a820a223c9ec7bfac5996b6245d364d25fe1a.zip |
Correctly set defaults for all LDAPSettings in the config (#3301)
Diffstat (limited to 'model')
-rw-r--r-- | model/config.go | 88 |
1 files changed, 64 insertions, 24 deletions
diff --git a/model/config.go b/model/config.go index e63dca073..55606ee8d 100644 --- a/model/config.go +++ b/model/config.go @@ -429,19 +429,39 @@ func (o *Config) SetDefaults() { *o.SupportSettings.SupportEmail = "feedback@mattermost.com" } + if o.LdapSettings.Enable == nil { + o.LdapSettings.Enable = new(bool) + *o.LdapSettings.Enable = false + } + + if o.LdapSettings.LdapServer == nil { + o.LdapSettings.LdapServer = new(string) + *o.LdapSettings.LdapServer = "" + } + if o.LdapSettings.LdapPort == nil { o.LdapSettings.LdapPort = new(int) *o.LdapSettings.LdapPort = 389 } - if o.LdapSettings.QueryTimeout == nil { - o.LdapSettings.QueryTimeout = new(int) - *o.LdapSettings.QueryTimeout = 60 + if o.LdapSettings.ConnectionSecurity == nil { + o.LdapSettings.ConnectionSecurity = new(string) + *o.LdapSettings.ConnectionSecurity = "" } - if o.LdapSettings.Enable == nil { - o.LdapSettings.Enable = new(bool) - *o.LdapSettings.Enable = false + if o.LdapSettings.BaseDN == nil { + o.LdapSettings.BaseDN = new(string) + *o.LdapSettings.BaseDN = "" + } + + if o.LdapSettings.BindUsername == nil { + o.LdapSettings.BindUsername = new(string) + *o.LdapSettings.BindUsername = "" + } + + if o.LdapSettings.BindPassword == nil { + o.LdapSettings.BindPassword = new(string) + *o.LdapSettings.BindPassword = "" } if o.LdapSettings.UserFilter == nil { @@ -449,9 +469,29 @@ func (o *Config) SetDefaults() { *o.LdapSettings.UserFilter = "" } - if o.LdapSettings.LoginFieldName == nil { - o.LdapSettings.LoginFieldName = new(string) - *o.LdapSettings.LoginFieldName = "" + if o.LdapSettings.FirstNameAttribute == nil { + o.LdapSettings.FirstNameAttribute = new(string) + *o.LdapSettings.FirstNameAttribute = "" + } + + if o.LdapSettings.LastNameAttribute == nil { + o.LdapSettings.LastNameAttribute = new(string) + *o.LdapSettings.LastNameAttribute = "" + } + + if o.LdapSettings.EmailAttribute == nil { + o.LdapSettings.EmailAttribute = new(string) + *o.LdapSettings.EmailAttribute = "" + } + + if o.LdapSettings.NicknameAttribute == nil { + o.LdapSettings.NicknameAttribute = new(string) + *o.LdapSettings.NicknameAttribute = "" + } + + if o.LdapSettings.IdAttribute == nil { + o.LdapSettings.IdAttribute = new(string) + *o.LdapSettings.IdAttribute = "" } if o.LdapSettings.SyncIntervalMinutes == nil { @@ -459,6 +499,21 @@ func (o *Config) SetDefaults() { *o.LdapSettings.SyncIntervalMinutes = 60 } + if o.LdapSettings.SkipCertificateVerification == nil { + o.LdapSettings.SkipCertificateVerification = new(bool) + *o.LdapSettings.SkipCertificateVerification = false + } + + if o.LdapSettings.QueryTimeout == nil { + o.LdapSettings.QueryTimeout = new(int) + *o.LdapSettings.QueryTimeout = 60 + } + + if o.LdapSettings.LoginFieldName == nil { + o.LdapSettings.LoginFieldName = new(string) + *o.LdapSettings.LoginFieldName = "" + } + if o.ServiceSettings.SessionLengthWebInDays == nil { o.ServiceSettings.SessionLengthWebInDays = new(int) *o.ServiceSettings.SessionLengthWebInDays = 30 @@ -524,21 +579,6 @@ func (o *Config) SetDefaults() { *o.ComplianceSettings.EnableDaily = false } - if o.LdapSettings.ConnectionSecurity == nil { - o.LdapSettings.ConnectionSecurity = new(string) - *o.LdapSettings.ConnectionSecurity = "" - } - - if o.LdapSettings.SkipCertificateVerification == nil { - o.LdapSettings.SkipCertificateVerification = new(bool) - *o.LdapSettings.SkipCertificateVerification = false - } - - if o.LdapSettings.NicknameAttribute == nil { - o.LdapSettings.NicknameAttribute = new(string) - *o.LdapSettings.NicknameAttribute = "" - } - if o.LocalizationSettings.DefaultServerLocale == nil { o.LocalizationSettings.DefaultServerLocale = new(string) *o.LocalizationSettings.DefaultServerLocale = DEFAULT_LOCALE |