Adding validation for LDAP settings to configuration (#3425)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8c2282f89e
Коммит
96bddf9016
@@ -486,6 +486,11 @@ func (o *Config) SetDefaults() {
|
||||
*o.LdapSettings.EmailAttribute = ""
|
||||
}
|
||||
|
||||
if o.LdapSettings.UsernameAttribute == nil {
|
||||
o.LdapSettings.UsernameAttribute = new(string)
|
||||
*o.LdapSettings.UsernameAttribute = ""
|
||||
}
|
||||
|
||||
if o.LdapSettings.NicknameAttribute == nil {
|
||||
o.LdapSettings.NicknameAttribute = new(string)
|
||||
*o.LdapSettings.NicknameAttribute = ""
|
||||
@@ -709,6 +714,20 @@ func (o *Config) IsValid() *AppError {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_sync_interval.app_error", nil, "")
|
||||
}
|
||||
|
||||
if *o.LdapSettings.Enable {
|
||||
if *o.LdapSettings.LdapServer == "" ||
|
||||
*o.LdapSettings.BaseDN == "" ||
|
||||
*o.LdapSettings.BindUsername == "" ||
|
||||
*o.LdapSettings.BindPassword == "" ||
|
||||
*o.LdapSettings.FirstNameAttribute == "" ||
|
||||
*o.LdapSettings.LastNameAttribute == "" ||
|
||||
*o.LdapSettings.EmailAttribute == "" ||
|
||||
*o.LdapSettings.UsernameAttribute == "" ||
|
||||
*o.LdapSettings.IdAttribute == "" {
|
||||
return NewLocAppError("Config.IsValid", "Required LDAP field missing", nil, "")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user