From 58358ddd7cd0152bf16a7326e1d595524fb51246 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 8 Dec 2015 13:38:43 -0500 Subject: Some refactoring --- model/config.go | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'model/config.go') diff --git a/model/config.go b/model/config.go index 06cb9829e..38ef81a85 100644 --- a/model/config.go +++ b/model/config.go @@ -20,6 +20,7 @@ const ( DATABASE_DRIVER_POSTGRES = "postgres" SERVICE_GITLAB = "gitlab" + SERVICE_GOOGLE = "google" ) type ServiceSettings struct { @@ -133,6 +134,26 @@ type TeamSettings struct { EnableTeamListing *bool } +type LdapSettings struct { + // Basic + Enable *bool + LdapServer *string + LdapPort *int + BaseDN *string + BindUsername *string + BindPassword *string + + // User Mapping + FirstNameAttribute *string + LastNameAttribute *string + EmailAttribute *string + UsernameAttribute *string + IdAttribute *string + + // Advansed + QueryTimeout *int +} + type Config struct { ServiceSettings ServiceSettings TeamSettings TeamSettings @@ -144,6 +165,8 @@ type Config struct { PrivacySettings PrivacySettings SupportSettings SupportSettings GitLabSettings SSOSettings + GoogleSettings SSOSettings + LdapSettings LdapSettings } func (o *Config) ToJson() string { @@ -156,8 +179,11 @@ func (o *Config) ToJson() string { } func (o *Config) GetSSOService(service string) *SSOSettings { - if service == SERVICE_GITLAB { + switch service { + case SERVICE_GITLAB: return &o.GitLabSettings + case SERVICE_GOOGLE: + return &o.GoogleSettings } return nil @@ -251,6 +277,21 @@ func (o *Config) SetDefaults() { o.SupportSettings.SupportEmail = new(string) *o.SupportSettings.SupportEmail = "feedback@mattermost.com" } + + 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.Enable == nil { + o.LdapSettings.Enable = new(bool) + *o.LdapSettings.Enable = false + } } func (o *Config) IsValid() *AppError { -- cgit v1.2.3-1-g7c22