diff options
author | Corey Hulen <corey@hulen.com> | 2015-09-23 14:04:08 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-09-23 14:04:08 -0700 |
commit | d792745f54463772472bec23b0caaae703eaddb3 (patch) | |
tree | d98c966e0f273c5a6052e3c154bd7d75d091aa27 /model | |
parent | 0170cfe604e6cfb430be0b6181243ca85a9ab27b (diff) | |
parent | ccf2e6e4e74fc249a094c2c27de675644f1065cb (diff) | |
download | chat-d792745f54463772472bec23b0caaae703eaddb3.tar.gz chat-d792745f54463772472bec23b0caaae703eaddb3.tar.bz2 chat-d792745f54463772472bec23b0caaae703eaddb3.zip |
Merge pull request #752 from mattermost/PLT-11-email
PLT-11 Cleaned up config file and added ability to makes changes from the admin console.
Diffstat (limited to 'model')
-rw-r--r-- | model/client.go | 10 | ||||
-rw-r--r-- | model/config.go | 135 | ||||
-rw-r--r-- | model/team.go | 1 |
3 files changed, 81 insertions, 65 deletions
diff --git a/model/client.go b/model/client.go index 6817a80f6..cc75ce370 100644 --- a/model/client.go +++ b/model/client.go @@ -21,6 +21,7 @@ const ( HEADER_ETAG_SERVER = "ETag" HEADER_ETAG_CLIENT = "If-None-Match" HEADER_FORWARDED = "X-Forwarded-For" + HEADER_REAL_IP = "X-Real-IP" HEADER_FORWARDED_PROTO = "X-Forwarded-Proto" HEADER_TOKEN = "token" HEADER_BEARER = "BEARER" @@ -403,6 +404,15 @@ func (c *Client) SaveConfig(config *Config) (*Result, *AppError) { } } +func (c *Client) TestEmail(config *Config) (*Result, *AppError) { + if r, err := c.DoApiPost("/admin/test_email", config.ToJson()); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil + } +} + func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) { if r, err := c.DoApiPost("/channels/create", channel.ToJson()); err != nil { return nil, err diff --git a/model/config.go b/model/config.go index 436f063c8..69f2127b2 100644 --- a/model/config.go +++ b/model/config.go @@ -8,27 +8,29 @@ import ( "io" ) +const ( + CONN_SECURITY_NONE = "" + CONN_SECURITY_TLS = "TLS" + CONN_SECURITY_STARTTLS = "STARTTLS" + + IMAGE_DRIVER_LOCAL = "local" + IMAGE_DRIVER_S3 = "amazons3" + + SERVICE_GITLAB = "gitlab" +) + type ServiceSettings struct { - SiteName string - Mode string - AllowTesting bool - UseSSL bool - Port string - Version string - InviteSalt string - PublicLinkSalt string - ResetSalt string - AnalyticsUrl string - UseLocalStorage bool - StorageDirectory string - AllowedLoginAttempts int - DisableEmailSignUp bool + ListenAddress string + MaximumLoginAttempts int + SegmentDeveloperKey string + GoogleDeveloperKey string EnableOAuthServiceProvider bool - AllowIncomingWebhooks bool + EnableIncomingWebhooks bool + EnableTesting bool } -type SSOSetting struct { - Allow bool +type SSOSettings struct { + Enable bool Secret string Id string Scope string @@ -48,87 +50,84 @@ type SqlSettings struct { } type LogSettings struct { - ConsoleEnable bool + EnableConsole bool ConsoleLevel string - FileEnable bool + EnableFile bool FileLevel string FileFormat string FileLocation string } -type AWSSettings struct { - S3AccessKeyId string - S3SecretAccessKey string - S3Bucket string - S3Region string -} - -type ImageSettings struct { - ThumbnailWidth uint - ThumbnailHeight uint - PreviewWidth uint - PreviewHeight uint - ProfileWidth uint - ProfileHeight uint - InitialFont string +type FileSettings struct { + DriverName string + Directory string + EnablePublicLink bool + PublicLinkSalt string + ThumbnailWidth uint + ThumbnailHeight uint + PreviewWidth uint + PreviewHeight uint + ProfileWidth uint + ProfileHeight uint + InitialFont string + AmazonS3AccessKeyId string + AmazonS3SecretAccessKey string + AmazonS3Bucket string + AmazonS3Region string } type EmailSettings struct { - ByPassEmail bool - SMTPUsername string - SMTPPassword string - SMTPServer string - UseTLS bool - UseStartTLS bool - FeedbackEmail string - FeedbackName string + EnableSignUpWithEmail bool + SendEmailNotifications bool + RequireEmailVerification bool + FeedbackName string + FeedbackEmail string + SMTPUsername string + SMTPPassword string + SMTPServer string + SMTPPort string + ConnectionSecurity string + InviteSalt string + PasswordResetSalt string + + // For Future Use ApplePushServer string ApplePushCertPublic string ApplePushCertPrivate string } type RateLimitSettings struct { - UseRateLimiter bool - PerSec int - MemoryStoreSize int - VaryByRemoteAddr bool - VaryByHeader string + EnableRateLimiter bool + PerSec int + MemoryStoreSize int + VaryByRemoteAddr bool + VaryByHeader string } type PrivacySettings struct { ShowEmailAddress bool - ShowPhoneNumber bool - ShowSkypeId bool ShowFullName bool } -type ClientSettings struct { - SegmentDeveloperKey string - GoogleDeveloperKey string -} - type TeamSettings struct { + SiteName string MaxUsersPerTeam int - AllowPublicLink bool - AllowValetDefault bool - TourLink string DefaultThemeColor string - DisableTeamCreation bool + EnableTeamCreation bool + EnableUserCreation bool RestrictCreationToDomains string } type Config struct { - LogSettings LogSettings ServiceSettings ServiceSettings + TeamSettings TeamSettings SqlSettings SqlSettings - AWSSettings AWSSettings - ImageSettings ImageSettings + LogSettings LogSettings + FileSettings FileSettings EmailSettings EmailSettings RateLimitSettings RateLimitSettings PrivacySettings PrivacySettings - ClientSettings ClientSettings - TeamSettings TeamSettings - SSOSettings map[string]SSOSetting + GitLabSettings SSOSettings } func (o *Config) ToJson() string { @@ -140,6 +139,14 @@ func (o *Config) ToJson() string { } } +func (o *Config) GetSSOService(service string) *SSOSettings { + if service == SERVICE_GITLAB { + return &o.GitLabSettings + } + + return nil +} + func ConfigFromJson(data io.Reader) *Config { decoder := json.NewDecoder(data) var o Config diff --git a/model/team.go b/model/team.go index 8b4f82830..0d740dde2 100644 --- a/model/team.go +++ b/model/team.go @@ -27,7 +27,6 @@ type Team struct { Type string `json:"type"` CompanyName string `json:"company_name"` AllowedDomains string `json:"allowed_domains"` - AllowValet bool `json:"allow_valet"` } type Invites struct { |