From c6cbce610043bb050f2c542412eb439dc22c4a88 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 18 May 2018 09:13:23 -0400 Subject: Add config setting for API team deletion (#8800) --- model/config.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'model') diff --git a/model/config.go b/model/config.go index a5a588a82..64107c42d 100644 --- a/model/config.go +++ b/model/config.go @@ -224,6 +224,7 @@ type ServiceSettings struct { ImageProxyType *string ImageProxyURL *string ImageProxyOptions *string + EnableAPITeamDeletion *bool } func (s *ServiceSettings) SetDefaults() { @@ -452,6 +453,10 @@ func (s *ServiceSettings) SetDefaults() { if s.ImageProxyOptions == nil { s.ImageProxyOptions = NewString("") } + + if s.EnableAPITeamDeletion == nil { + s.EnableAPITeamDeletion = NewBool(false) + } } type ClusterSettings struct { -- cgit v1.2.3-1-g7c22 From d3ead7dc8535f8fa5b175686cc1f7669c8b1648b Mon Sep 17 00:00:00 2001 From: Balasankar C Date: Fri, 18 May 2018 19:27:30 +0530 Subject: MM-10640 Set EnableUserCreation to true by default (#8815) * Set EnableUserCreation to true by default * Fix argument type to FormatBool * Convert EnableUserCreation instances to pointer * Convert to boolean in tests also * Set value of pointer to be false * Convert remaining EnableUserCreation instances to pointer --- model/config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'model') diff --git a/model/config.go b/model/config.go index 64107c42d..a54d44110 100644 --- a/model/config.go +++ b/model/config.go @@ -980,7 +980,7 @@ type TeamSettings struct { SiteName string MaxUsersPerTeam *int EnableTeamCreation *bool - EnableUserCreation bool + EnableUserCreation *bool EnableOpenServer *bool RestrictCreationToDomains string EnableCustomBrand *bool @@ -1111,6 +1111,11 @@ func (s *TeamSettings) SetDefaults() { if s.EnableTeamCreation == nil { s.EnableTeamCreation = NewBool(true) } + + if s.EnableUserCreation == nil { + s.EnableUserCreation = NewBool(true) + } + } type ClientRequirements struct { -- cgit v1.2.3-1-g7c22 From 0432f995ec27de9ee6cc2f5847d4a17fcc095a26 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Fri, 18 May 2018 08:37:43 -0700 Subject: MM-9983 Requiring SiteURL to be set. (#8769) * Requiring SiteURL to be set. * Modifying to make tests pass. * Fixing test. --- model/config.go | 14 -------------- model/config_test.go | 7 +++++++ 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'model') diff --git a/model/config.go b/model/config.go index a54d44110..4710658ec 100644 --- a/model/config.go +++ b/model/config.go @@ -1870,18 +1870,10 @@ func (o *Config) SetDefaults() { } func (o *Config) IsValid() *AppError { - if len(*o.ServiceSettings.SiteURL) == 0 && *o.EmailSettings.EnableEmailBatching { - return NewAppError("Config.IsValid", "model.config.is_valid.site_url_email_batching.app_error", nil, "", http.StatusBadRequest) - } - if *o.ClusterSettings.Enable && *o.EmailSettings.EnableEmailBatching { return NewAppError("Config.IsValid", "model.config.is_valid.cluster_email_batching.app_error", nil, "", http.StatusBadRequest) } - if len(*o.ServiceSettings.SiteURL) == 0 && *o.ServiceSettings.AllowCookiesForSubdomains { - return NewAppError("Config.IsValid", "Allowing cookies for subdomains requires SiteURL to be set.", nil, "", http.StatusBadRequest) - } - if err := o.TeamSettings.isValid(); err != nil { return err } @@ -2187,12 +2179,6 @@ func (ss *ServiceSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.login_attempts.app_error", nil, "", http.StatusBadRequest) } - if len(*ss.SiteURL) != 0 { - if _, err := url.ParseRequestURI(*ss.SiteURL); err != nil { - return NewAppError("Config.IsValid", "model.config.is_valid.site_url.app_error", nil, "", http.StatusBadRequest) - } - } - if len(*ss.WebsocketURL) != 0 { if _, err := url.ParseRequestURI(*ss.WebsocketURL); err != nil { return NewAppError("Config.IsValid", "model.config.is_valid.websocket_url.app_error", nil, "", http.StatusBadRequest) diff --git a/model/config_test.go b/model/config_test.go index b7533145b..e39ecef3b 100644 --- a/model/config_test.go +++ b/model/config_test.go @@ -82,6 +82,13 @@ func TestConfigDefaultFileSettingsS3SSE(t *testing.T) { } } +func TestConfigDefaultSiteURL(t *testing.T) { + c1 := Config{} + c1.SetDefaults() + + assert.Equal(t, "", *c1.ServiceSettings.SiteURL, "SiteURL should be empty by default.") +} + func TestConfigDefaultServiceSettingsExperimentalGroupUnreadChannels(t *testing.T) { c1 := Config{} c1.SetDefaults() -- cgit v1.2.3-1-g7c22