summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model
diff options
context:
space:
mode:
authorWim <wim@42.be>2016-04-16 20:39:43 +0200
committerWim <wim@42.be>2016-04-16 20:39:43 +0200
commit51265d546409de12483531773fc1fbc73453ae6e (patch)
tree924b5be51b320a6fe05784f2495a2bfcfc7a3242 /vendor/github.com/mattermost/platform/model
parentde4c7804101a47a01d0c9b88ea34d2b153e2b6b9 (diff)
downloadmatterbridge-msglm-51265d546409de12483531773fc1fbc73453ae6e.tar.gz
matterbridge-msglm-51265d546409de12483531773fc1fbc73453ae6e.tar.bz2
matterbridge-msglm-51265d546409de12483531773fc1fbc73453ae6e.zip
Sync with mattermost 2.2.0 release
Diffstat (limited to 'vendor/github.com/mattermost/platform/model')
-rw-r--r--vendor/github.com/mattermost/platform/model/client.go169
-rw-r--r--vendor/github.com/mattermost/platform/model/command.go11
-rw-r--r--vendor/github.com/mattermost/platform/model/compliance.go132
-rw-r--r--vendor/github.com/mattermost/platform/model/compliance_post.go104
-rw-r--r--vendor/github.com/mattermost/platform/model/config.go109
-rw-r--r--vendor/github.com/mattermost/platform/model/incoming_webhook.go24
-rw-r--r--vendor/github.com/mattermost/platform/model/ldap.go8
-rw-r--r--vendor/github.com/mattermost/platform/model/license.go30
-rw-r--r--vendor/github.com/mattermost/platform/model/outgoing_webhook.go10
-rw-r--r--vendor/github.com/mattermost/platform/model/push_notification.go5
-rw-r--r--vendor/github.com/mattermost/platform/model/session.go2
-rw-r--r--vendor/github.com/mattermost/platform/model/system.go9
-rw-r--r--vendor/github.com/mattermost/platform/model/team.go9
-rw-r--r--vendor/github.com/mattermost/platform/model/user.go37
-rw-r--r--vendor/github.com/mattermost/platform/model/utils.go12
-rw-r--r--vendor/github.com/mattermost/platform/model/version.go14
16 files changed, 108 insertions, 577 deletions
diff --git a/vendor/github.com/mattermost/platform/model/client.go b/vendor/github.com/mattermost/platform/model/client.go
index fba4246e..f397a9c2 100644
--- a/vendor/github.com/mattermost/platform/model/client.go
+++ b/vendor/github.com/mattermost/platform/model/client.go
@@ -16,19 +16,21 @@ import (
)
const (
- HEADER_REQUEST_ID = "X-Request-ID"
- HEADER_VERSION_ID = "X-Version-ID"
- 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"
- HEADER_AUTH = "Authorization"
- HEADER_REQUESTED_WITH = "X-Requested-With"
- HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
- API_URL_SUFFIX = "/api/v1"
+ HEADER_REQUEST_ID = "X-Request-ID"
+ HEADER_VERSION_ID = "X-Version-ID"
+ 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"
+ HEADER_AUTH = "Authorization"
+ HEADER_MM_SESSION_TOKEN_INDEX = "X-MM-TokenIndex"
+ SESSION_TOKEN_INDEX = "session_token_index"
+ HEADER_REQUESTED_WITH = "X-Requested-With"
+ HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
+ API_URL_SUFFIX = "/api/v1"
)
type Result struct {
@@ -179,6 +181,29 @@ func (c *Client) FindTeamByName(name string, allServers bool) (*Result, *AppErro
}
}
+func (c *Client) FindTeams(email string) (*Result, *AppError) {
+ m := make(map[string]string)
+ m["email"] = email
+ if r, err := c.DoApiPost("/teams/find_teams", MapToJson(m)); err != nil {
+ return nil, err
+ } else {
+
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), TeamMapFromJson(r.Body)}, nil
+ }
+}
+
+func (c *Client) FindTeamsSendEmail(email string) (*Result, *AppError) {
+ m := make(map[string]string)
+ m["email"] = email
+ if r, err := c.DoApiPost("/teams/email_teams", MapToJson(m)); err != nil {
+ return nil, err
+ } else {
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), ArrayFromJson(r.Body)}, nil
+ }
+}
+
func (c *Client) InviteMembers(invites *Invites) (*Result, *AppError) {
if r, err := c.DoApiPost("/teams/invite_members", invites.ToJson()); err != nil {
return nil, err
@@ -303,42 +328,6 @@ func (c *Client) Logout() (*Result, *AppError) {
}
}
-func (c *Client) CheckMfa(method, teamName, loginId string) (*Result, *AppError) {
- m := make(map[string]string)
- m["method"] = method
- m["team_name"] = teamName
- m["login_id"] = loginId
-
- if r, err := c.DoApiPost("/users/mfa", MapToJson(m)); 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) GenerateMfaQrCode() (*Result, *AppError) {
- if r, err := c.DoApiGet("/users/generate_mfa_qr", "", ""); err != nil {
- return nil, err
- } else {
- return &Result{r.Header.Get(HEADER_REQUEST_ID),
- r.Header.Get(HEADER_ETAG_SERVER), r.Body}, nil
- }
-}
-
-func (c *Client) UpdateMfa(activate bool, token string) (*Result, *AppError) {
- m := make(map[string]interface{})
- m["activate"] = activate
- m["token"] = token
-
- if r, err := c.DoApiPost("/users/update_mfa", StringInterfaceToJson(m)); 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) SetOAuthToken(token string) {
c.AuthToken = token
c.AuthType = HEADER_TOKEN
@@ -370,17 +359,8 @@ func (c *Client) GetSessions(id string) (*Result, *AppError) {
}
}
-func (c *Client) EmailToOAuth(m map[string]string) (*Result, *AppError) {
- if r, err := c.DoApiPost("/users/claim/email_to_sso", MapToJson(m)); 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) OAuthToEmail(m map[string]string) (*Result, *AppError) {
- if r, err := c.DoApiPost("/users/claim/oauth_to_email", MapToJson(m)); err != nil {
+func (c *Client) SwitchToSSO(m map[string]string) (*Result, *AppError) {
+ if r, err := c.DoApiPost("/users/switch_to_sso", MapToJson(m)); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),
@@ -388,17 +368,8 @@ func (c *Client) OAuthToEmail(m map[string]string) (*Result, *AppError) {
}
}
-func (c *Client) LDAPToEmail(m map[string]string) (*Result, *AppError) {
- if r, err := c.DoApiPost("/users/claim/ldap_to_email", MapToJson(m)); 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) EmailToLDAP(m map[string]string) (*Result, *AppError) {
- if r, err := c.DoApiPost("/users/claim/ldap_to_email", MapToJson(m)); err != nil {
+func (c *Client) SwitchToEmail(m map[string]string) (*Result, *AppError) {
+ if r, err := c.DoApiPost("/users/switch_to_email", MapToJson(m)); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),
@@ -527,42 +498,6 @@ func (c *Client) TestEmail(config *Config) (*Result, *AppError) {
}
}
-func (c *Client) GetComplianceReports() (*Result, *AppError) {
- if r, err := c.DoApiGet("/admin/compliance_reports", "", ""); err != nil {
- return nil, err
- } else {
- return &Result{r.Header.Get(HEADER_REQUEST_ID),
- r.Header.Get(HEADER_ETAG_SERVER), CompliancesFromJson(r.Body)}, nil
- }
-}
-
-func (c *Client) SaveComplianceReport(job *Compliance) (*Result, *AppError) {
- if r, err := c.DoApiPost("/admin/save_compliance_report", job.ToJson()); err != nil {
- return nil, err
- } else {
- return &Result{r.Header.Get(HEADER_REQUEST_ID),
- r.Header.Get(HEADER_ETAG_SERVER), ComplianceFromJson(r.Body)}, nil
- }
-}
-
-func (c *Client) DownloadComplianceReport(id string) (*Result, *AppError) {
- var rq *http.Request
- rq, _ = http.NewRequest("GET", c.ApiUrl+"/admin/download_compliance_report/"+id, nil)
-
- if len(c.AuthToken) > 0 {
- rq.Header.Set(HEADER_AUTH, "BEARER "+c.AuthToken)
- }
-
- if rp, err := c.HttpClient.Do(rq); err != nil {
- return nil, NewLocAppError("/admin/download_compliance_report", "model.client.connecting.app_error", nil, err.Error())
- } else if rp.StatusCode >= 300 {
- return nil, AppErrorFromJson(rp.Body)
- } else {
- return &Result{rp.Header.Get(HEADER_REQUEST_ID),
- rp.Header.Get(HEADER_ETAG_SERVER), rp.Body}, nil
- }
-}
-
func (c *Client) GetTeamAnalytics(teamId, name string) (*Result, *AppError) {
if r, err := c.DoApiGet("/admin/analytics/"+teamId+"/"+name, "", ""); err != nil {
return nil, err
@@ -1005,7 +940,7 @@ func (c *Client) AllowOAuth(rspType, clientId, redirect, scope, state string) (*
}
func (c *Client) GetAccessToken(data url.Values) (*Result, *AppError) {
- if r, err := c.DoApiPost("/oauth/access_token", data.Encode()); err != nil {
+ if r, err := c.DoPost("/oauth/access_token", data.Encode(), "application/x-www-form-urlencoded"); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),
@@ -1124,21 +1059,3 @@ func (c *Client) MockSession(sessionToken string) {
c.AuthToken = sessionToken
c.AuthType = HEADER_BEARER
}
-
-func (c *Client) GetClientLicenceConfig() (*Result, *AppError) {
- if r, err := c.DoApiGet("/license/client_config", "", ""); 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) GetMeLoggedIn() (*Result, *AppError) {
- if r, err := c.DoApiGet("/users/me_logged_in", "", ""); err != nil {
- return nil, err
- } else {
- return &Result{r.Header.Get(HEADER_REQUEST_ID),
- r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
- }
-}
diff --git a/vendor/github.com/mattermost/platform/model/command.go b/vendor/github.com/mattermost/platform/model/command.go
index b854ae76..56d88f13 100644
--- a/vendor/github.com/mattermost/platform/model/command.go
+++ b/vendor/github.com/mattermost/platform/model/command.go
@@ -29,7 +29,6 @@ type Command struct {
AutoCompleteDesc string `json:"auto_complete_desc"`
AutoCompleteHint string `json:"auto_complete_hint"`
DisplayName string `json:"display_name"`
- Description string `json:"description"`
URL string `json:"url"`
}
@@ -99,7 +98,7 @@ func (o *Command) IsValid() *AppError {
return NewLocAppError("Command.IsValid", "model.command.is_valid.team_id.app_error", nil, "")
}
- if len(o.Trigger) > 128 {
+ if len(o.Trigger) > 1024 {
return NewLocAppError("Command.IsValid", "model.command.is_valid.trigger.app_error", nil, "")
}
@@ -115,14 +114,6 @@ func (o *Command) IsValid() *AppError {
return NewLocAppError("Command.IsValid", "model.command.is_valid.method.app_error", nil, "")
}
- if len(o.DisplayName) > 64 {
- return NewLocAppError("Command.IsValid", "model.command.is_valid.display_name.app_error", nil, "")
- }
-
- if len(o.Description) > 128 {
- return NewLocAppError("Command.IsValid", "model.command.is_valid.description.app_error", nil, "")
- }
-
return nil
}
diff --git a/vendor/github.com/mattermost/platform/model/compliance.go b/vendor/github.com/mattermost/platform/model/compliance.go
deleted file mode 100644
index 4a96a597..00000000
--- a/vendor/github.com/mattermost/platform/model/compliance.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package model
-
-import (
- "encoding/json"
- "io"
- "strings"
-)
-
-const (
- COMPLIANCE_STATUS_CREATED = "created"
- COMPLIANCE_STATUS_RUNNING = "running"
- COMPLIANCE_STATUS_FINISHED = "finished"
- COMPLIANCE_STATUS_FAILED = "failed"
- COMPLIANCE_STATUS_REMOVED = "removed"
-
- COMPLIANCE_TYPE_DAILY = "daily"
- COMPLIANCE_TYPE_ADHOC = "adhoc"
-)
-
-type Compliance struct {
- Id string `json:"id"`
- CreateAt int64 `json:"create_at"`
- UserId string `json:"user_id"`
- Status string `json:"status"`
- Count int `json:"count"`
- Desc string `json:"desc"`
- Type string `json:"type"`
- StartAt int64 `json:"start_at"`
- EndAt int64 `json:"end_at"`
- Keywords string `json:"keywords"`
- Emails string `json:"emails"`
-}
-
-type Compliances []Compliance
-
-func (o *Compliance) ToJson() string {
- b, err := json.Marshal(o)
- if err != nil {
- return ""
- } else {
- return string(b)
- }
-}
-
-func (me *Compliance) PreSave() {
- if me.Id == "" {
- me.Id = NewId()
- }
-
- if me.Status == "" {
- me.Status = COMPLIANCE_STATUS_CREATED
- }
-
- me.Count = 0
- me.Emails = strings.ToLower(me.Emails)
- me.Keywords = strings.ToLower(me.Keywords)
-
- me.CreateAt = GetMillis()
-}
-
-func (me *Compliance) JobName() string {
- jobName := me.Type
- if me.Type == COMPLIANCE_TYPE_DAILY {
- jobName += "-" + me.Desc
- }
-
- jobName += "-" + me.Id
-
- return jobName
-}
-
-func (me *Compliance) IsValid() *AppError {
-
- if len(me.Id) != 26 {
- return NewLocAppError("Compliance.IsValid", "model.compliance.is_valid.id.app_error", nil, "")
- }
-
- if me.CreateAt == 0 {
- return NewLocAppError("Compliance.IsValid", "model.compliance.is_valid.create_at.app_error", nil, "")
- }
-
- if len(me.Desc) > 512 || len(me.Desc) == 0 {
- return NewLocAppError("Compliance.IsValid", "model.compliance.is_valid.desc.app_error", nil, "")
- }
-
- if me.StartAt == 0 {
- return NewLocAppError("Compliance.IsValid", "model.compliance.is_valid.start_at.app_error", nil, "")
- }
-
- if me.EndAt == 0 {
- return NewLocAppError("Compliance.IsValid", "model.compliance.is_valid.end_at.app_error", nil, "")
- }
-
- if me.EndAt <= me.StartAt {
- return NewLocAppError("Compliance.IsValid", "model.compliance.is_valid.start_end_at.app_error", nil, "")
- }
-
- return nil
-}
-
-func ComplianceFromJson(data io.Reader) *Compliance {
- decoder := json.NewDecoder(data)
- var o Compliance
- err := decoder.Decode(&o)
- if err == nil {
- return &o
- } else {
- return nil
- }
-}
-
-func (o Compliances) ToJson() string {
- if b, err := json.Marshal(o); err != nil {
- return "[]"
- } else {
- return string(b)
- }
-}
-
-func CompliancesFromJson(data io.Reader) Compliances {
- decoder := json.NewDecoder(data)
- var o Compliances
- err := decoder.Decode(&o)
- if err == nil {
- return o
- } else {
- return nil
- }
-}
diff --git a/vendor/github.com/mattermost/platform/model/compliance_post.go b/vendor/github.com/mattermost/platform/model/compliance_post.go
deleted file mode 100644
index ce26a366..00000000
--- a/vendor/github.com/mattermost/platform/model/compliance_post.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package model
-
-import (
- "time"
-)
-
-type CompliancePost struct {
-
- // From Team
- TeamName string
- TeamDisplayName string
-
- // From Channel
- ChannelName string
- ChannelDisplayName string
-
- // From User
- UserUsername string
- UserEmail string
- UserNickname string
-
- // From Post
- PostId string
- PostCreateAt int64
- PostUpdateAt int64
- PostDeleteAt int64
- PostRootId string
- PostParentId string
- PostOriginalId string
- PostMessage string
- PostType string
- PostProps string
- PostHashtags string
- PostFilenames string
-}
-
-func CompliancePostHeader() []string {
- return []string{
- "TeamName",
- "TeamDisplayName",
-
- "ChannelName",
- "ChannelDisplayName",
-
- "UserUsername",
- "UserEmail",
- "UserNickname",
-
- "PostId",
- "PostCreateAt",
- "PostUpdateAt",
- "PostDeleteAt",
- "PostRootId",
- "PostParentId",
- "PostOriginalId",
- "PostMessage",
- "PostType",
- "PostProps",
- "PostHashtags",
- "PostFilenames",
- }
-}
-
-func (me *CompliancePost) Row() []string {
-
- postDeleteAt := ""
- if me.PostDeleteAt > 0 {
- postDeleteAt = time.Unix(0, me.PostDeleteAt*int64(1000*1000)).Format(time.RFC3339)
- }
-
- postUpdateAt := ""
- if me.PostUpdateAt != me.PostCreateAt {
- postUpdateAt = time.Unix(0, me.PostUpdateAt*int64(1000*1000)).Format(time.RFC3339)
- }
-
- return []string{
- me.TeamName,
- me.TeamDisplayName,
-
- me.ChannelName,
- me.ChannelDisplayName,
-
- me.UserUsername,
- me.UserEmail,
- me.UserNickname,
-
- me.PostId,
- time.Unix(0, me.PostCreateAt*int64(1000*1000)).Format(time.RFC3339),
- postUpdateAt,
- postDeleteAt,
-
- me.PostRootId,
- me.PostParentId,
- me.PostOriginalId,
- me.PostMessage,
- me.PostType,
- me.PostProps,
- me.PostHashtags,
- me.PostFilenames,
- }
-}
diff --git a/vendor/github.com/mattermost/platform/model/config.go b/vendor/github.com/mattermost/platform/model/config.go
index a8974359..82c51224 100644
--- a/vendor/github.com/mattermost/platform/model/config.go
+++ b/vendor/github.com/mattermost/platform/model/config.go
@@ -21,13 +21,6 @@ const (
SERVICE_GITLAB = "gitlab"
SERVICE_GOOGLE = "google"
-
- WEBSERVER_MODE_REGULAR = "regular"
- WEBSERVER_MODE_GZIP = "gzip"
- WEBSERVER_MODE_DISABLED = "disabled"
-
- GENERIC_NOTIFICATION = "generic"
- FULL_NOTIFICATION = "full"
)
type ServiceSettings struct {
@@ -46,7 +39,6 @@ type ServiceSettings struct {
EnableDeveloper *bool
EnableSecurityFixAlert *bool
EnableInsecureOutgoingConnections *bool
- EnableMultifactorAuthentication *bool
AllowCorsFrom *string
SessionLengthWebInDays *int
SessionLengthMobileInDays *int
@@ -54,7 +46,6 @@ type ServiceSettings struct {
SessionCacheInMinutes *int
WebsocketSecurePort *int
WebsocketPort *int
- WebserverMode *string
}
type SSOSettings struct {
@@ -125,7 +116,6 @@ type EmailSettings struct {
PasswordResetSalt string
SendPushNotifications *bool
PushNotificationServer *string
- PushNotificationContents *string
}
type RateLimitSettings struct {
@@ -162,16 +152,12 @@ type TeamSettings struct {
type LdapSettings struct {
// Basic
- Enable *bool
- LdapServer *string
- LdapPort *int
- ConnectionSecurity *string
- BaseDN *string
- BindUsername *string
- BindPassword *string
-
- // Filtering
- UserFilter *string
+ Enable *bool
+ LdapServer *string
+ LdapPort *int
+ BaseDN *string
+ BindUsername *string
+ BindPassword *string
// User Mapping
FirstNameAttribute *string
@@ -181,30 +167,22 @@ type LdapSettings struct {
IdAttribute *string
// Advanced
- SkipCertificateVerification *bool
- QueryTimeout *int
-}
-
-type ComplianceSettings struct {
- Enable *bool
- Directory *string
- EnableDaily *bool
+ QueryTimeout *int
}
type Config struct {
- ServiceSettings ServiceSettings
- TeamSettings TeamSettings
- SqlSettings SqlSettings
- LogSettings LogSettings
- FileSettings FileSettings
- EmailSettings EmailSettings
- RateLimitSettings RateLimitSettings
- PrivacySettings PrivacySettings
- SupportSettings SupportSettings
- GitLabSettings SSOSettings
- GoogleSettings SSOSettings
- LdapSettings LdapSettings
- ComplianceSettings ComplianceSettings
+ ServiceSettings ServiceSettings
+ TeamSettings TeamSettings
+ SqlSettings SqlSettings
+ LogSettings LogSettings
+ FileSettings FileSettings
+ EmailSettings EmailSettings
+ RateLimitSettings RateLimitSettings
+ PrivacySettings PrivacySettings
+ SupportSettings SupportSettings
+ GitLabSettings SSOSettings
+ GoogleSettings SSOSettings
+ LdapSettings LdapSettings
}
func (o *Config) ToJson() string {
@@ -281,11 +259,6 @@ func (o *Config) SetDefaults() {
*o.ServiceSettings.EnableInsecureOutgoingConnections = false
}
- if o.ServiceSettings.EnableMultifactorAuthentication == nil {
- o.ServiceSettings.EnableMultifactorAuthentication = new(bool)
- *o.ServiceSettings.EnableMultifactorAuthentication = false
- }
-
if o.TeamSettings.RestrictTeamNames == nil {
o.TeamSettings.RestrictTeamNames = new(bool)
*o.TeamSettings.RestrictTeamNames = true
@@ -321,11 +294,6 @@ func (o *Config) SetDefaults() {
*o.EmailSettings.PushNotificationServer = ""
}
- if o.EmailSettings.PushNotificationContents == nil {
- o.EmailSettings.PushNotificationContents = new(string)
- *o.EmailSettings.PushNotificationContents = GENERIC_NOTIFICATION
- }
-
if o.SupportSettings.TermsOfServiceLink == nil {
o.SupportSettings.TermsOfServiceLink = new(string)
*o.SupportSettings.TermsOfServiceLink = "/static/help/terms.html"
@@ -371,11 +339,6 @@ func (o *Config) SetDefaults() {
*o.LdapSettings.Enable = false
}
- if o.LdapSettings.UserFilter == nil {
- o.LdapSettings.UserFilter = new(string)
- *o.LdapSettings.UserFilter = ""
- }
-
if o.ServiceSettings.SessionLengthWebInDays == nil {
o.ServiceSettings.SessionLengthWebInDays = new(int)
*o.ServiceSettings.SessionLengthWebInDays = 30
@@ -420,36 +383,6 @@ func (o *Config) SetDefaults() {
o.ServiceSettings.AllowCorsFrom = new(string)
*o.ServiceSettings.AllowCorsFrom = ""
}
-
- if o.ServiceSettings.WebserverMode == nil {
- o.ServiceSettings.WebserverMode = new(string)
- *o.ServiceSettings.WebserverMode = "regular"
- }
-
- if o.ComplianceSettings.Enable == nil {
- o.ComplianceSettings.Enable = new(bool)
- *o.ComplianceSettings.Enable = false
- }
-
- if o.ComplianceSettings.Directory == nil {
- o.ComplianceSettings.Directory = new(string)
- *o.ComplianceSettings.Directory = "./data/"
- }
-
- if o.ComplianceSettings.EnableDaily == nil {
- o.ComplianceSettings.EnableDaily = new(bool)
- *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
- }
}
func (o *Config) IsValid() *AppError {
@@ -538,10 +471,6 @@ func (o *Config) IsValid() *AppError {
return NewLocAppError("Config.IsValid", "model.config.is_valid.rate_sec.app_error", nil, "")
}
- if !(*o.LdapSettings.ConnectionSecurity == CONN_SECURITY_NONE || *o.LdapSettings.ConnectionSecurity == CONN_SECURITY_TLS || *o.LdapSettings.ConnectionSecurity == CONN_SECURITY_STARTTLS) {
- return NewLocAppError("Config.IsValid", "model.config.is_valid.ldap_security.app_error", nil, "")
- }
-
return nil
}
diff --git a/vendor/github.com/mattermost/platform/model/incoming_webhook.go b/vendor/github.com/mattermost/platform/model/incoming_webhook.go
index 0763b443..8432f5fe 100644
--- a/vendor/github.com/mattermost/platform/model/incoming_webhook.go
+++ b/vendor/github.com/mattermost/platform/model/incoming_webhook.go
@@ -14,15 +14,13 @@ const (
)
type IncomingWebhook struct {
- Id string `json:"id"`
- CreateAt int64 `json:"create_at"`
- UpdateAt int64 `json:"update_at"`
- DeleteAt int64 `json:"delete_at"`
- UserId string `json:"user_id"`
- ChannelId string `json:"channel_id"`
- TeamId string `json:"team_id"`
- DisplayName string `json:"display_name"`
- Description string `json:"description"`
+ Id string `json:"id"`
+ CreateAt int64 `json:"create_at"`
+ UpdateAt int64 `json:"update_at"`
+ DeleteAt int64 `json:"delete_at"`
+ UserId string `json:"user_id"`
+ ChannelId string `json:"channel_id"`
+ TeamId string `json:"team_id"`
}
type IncomingWebhookRequest struct {
@@ -101,14 +99,6 @@ func (o *IncomingWebhook) IsValid() *AppError {
return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.team_id.app_error", nil, "")
}
- if len(o.DisplayName) > 64 {
- return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.display_name.app_error", nil, "")
- }
-
- if len(o.Description) > 128 {
- return NewLocAppError("IncomingWebhook.IsValid", "model.incoming_hook.description.app_error", nil, "")
- }
-
return nil
}
diff --git a/vendor/github.com/mattermost/platform/model/ldap.go b/vendor/github.com/mattermost/platform/model/ldap.go
deleted file mode 100644
index 5fde06a6..00000000
--- a/vendor/github.com/mattermost/platform/model/ldap.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package model
-
-const (
- USER_AUTH_SERVICE_LDAP = "ldap"
-)
diff --git a/vendor/github.com/mattermost/platform/model/license.go b/vendor/github.com/mattermost/platform/model/license.go
index cab22a68..abb1be09 100644
--- a/vendor/github.com/mattermost/platform/model/license.go
+++ b/vendor/github.com/mattermost/platform/model/license.go
@@ -32,14 +32,19 @@ type Customer struct {
}
type Features struct {
- Users *int `json:"users"`
- LDAP *bool `json:"ldap"`
- MFA *bool `json:"mfa"`
- GoogleSSO *bool `json:"google_sso"`
- Compliance *bool `json:"compliance"`
+ Users *int `json:"users"`
+ LDAP *bool `json:"ldap"`
+ GoogleSSO *bool `json:"google_sso"`
+ MHPNS *bool `json:"mhpns"`
+ FutureFeatures *bool `json:"future_features"`
}
func (f *Features) SetDefaults() {
+ if f.FutureFeatures == nil {
+ f.FutureFeatures = new(bool)
+ *f.FutureFeatures = true
+ }
+
if f.Users == nil {
f.Users = new(int)
*f.Users = 0
@@ -47,22 +52,17 @@ func (f *Features) SetDefaults() {
if f.LDAP == nil {
f.LDAP = new(bool)
- *f.LDAP = true
- }
-
- if f.MFA == nil {
- f.MFA = new(bool)
- *f.MFA = true
+ *f.LDAP = *f.FutureFeatures
}
if f.GoogleSSO == nil {
f.GoogleSSO = new(bool)
- *f.GoogleSSO = true
+ *f.GoogleSSO = *f.FutureFeatures
}
- if f.Compliance == nil {
- f.Compliance = new(bool)
- *f.Compliance = true
+ if f.MHPNS == nil {
+ f.MHPNS = new(bool)
+ *f.MHPNS = *f.FutureFeatures
}
}
diff --git a/vendor/github.com/mattermost/platform/model/outgoing_webhook.go b/vendor/github.com/mattermost/platform/model/outgoing_webhook.go
index e13de908..70de4d26 100644
--- a/vendor/github.com/mattermost/platform/model/outgoing_webhook.go
+++ b/vendor/github.com/mattermost/platform/model/outgoing_webhook.go
@@ -20,8 +20,6 @@ type OutgoingWebhook struct {
TeamId string `json:"team_id"`
TriggerWords StringArray `json:"trigger_words"`
CallbackURLs StringArray `json:"callback_urls"`
- DisplayName string `json:"display_name"`
- Description string `json:"description"`
}
func (o *OutgoingWebhook) ToJson() string {
@@ -108,14 +106,6 @@ func (o *OutgoingWebhook) IsValid() *AppError {
}
}
- if len(o.DisplayName) > 64 {
- return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.display_name.app_error", nil, "")
- }
-
- if len(o.Description) > 128 {
- return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.description.app_error", nil, "")
- }
-
return nil
}
diff --git a/vendor/github.com/mattermost/platform/model/push_notification.go b/vendor/github.com/mattermost/platform/model/push_notification.go
index 9196a44d..42feca2e 100644
--- a/vendor/github.com/mattermost/platform/model/push_notification.go
+++ b/vendor/github.com/mattermost/platform/model/push_notification.go
@@ -11,8 +11,7 @@ import (
const (
PUSH_NOTIFY_APPLE = "apple"
PUSH_NOTIFY_ANDROID = "android"
-
- CATEGORY_DM = "DIRECT_MESSAGE"
+ MHPNS = "https://push.mattermost.com"
)
type PushNotification struct {
@@ -24,8 +23,6 @@ type PushNotification struct {
Message string `json:"message"`
Badge int `json:"badge"`
ContentAvailable int `json:"cont_ava"`
- ChannelId string `json:"channel_id"`
- ChannelName string `json:"channel_name"`
}
func (me *PushNotification) ToJson() string {
diff --git a/vendor/github.com/mattermost/platform/model/session.go b/vendor/github.com/mattermost/platform/model/session.go
index bf0d9531..5d9424d6 100644
--- a/vendor/github.com/mattermost/platform/model/session.go
+++ b/vendor/github.com/mattermost/platform/model/session.go
@@ -9,7 +9,7 @@ import (
)
const (
- SESSION_COOKIE_TOKEN = "MMAUTHTOKEN"
+ SESSION_COOKIE_TOKEN = "MMTOKEN"
SESSION_CACHE_SIZE = 10000
SESSION_PROP_PLATFORM = "platform"
SESSION_PROP_OS = "os"
diff --git a/vendor/github.com/mattermost/platform/model/system.go b/vendor/github.com/mattermost/platform/model/system.go
index 68d542c1..b387749f 100644
--- a/vendor/github.com/mattermost/platform/model/system.go
+++ b/vendor/github.com/mattermost/platform/model/system.go
@@ -9,11 +9,10 @@ import (
)
const (
- SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
- SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
- SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
- SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
- SYSTEM_LAST_COMPLIANCE_TIME = "LastComplianceTime"
+ SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
+ SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
+ SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
+ SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
)
type System struct {
diff --git a/vendor/github.com/mattermost/platform/model/team.go b/vendor/github.com/mattermost/platform/model/team.go
index d95dea11..9e9eaa25 100644
--- a/vendor/github.com/mattermost/platform/model/team.go
+++ b/vendor/github.com/mattermost/platform/model/team.go
@@ -232,12 +232,3 @@ func (o *Team) Sanitize() {
o.Email = ""
o.AllowedDomains = ""
}
-
-func (o *Team) SanitizeForNotLoggedIn() {
- o.Email = ""
- o.AllowedDomains = ""
- o.CompanyName = ""
- if !o.AllowOpenInvite {
- o.InviteId = ""
- }
-}
diff --git a/vendor/github.com/mattermost/platform/model/user.go b/vendor/github.com/mattermost/platform/model/user.go
index 173fe2b4..675a1ded 100644
--- a/vendor/github.com/mattermost/platform/model/user.go
+++ b/vendor/github.com/mattermost/platform/model/user.go
@@ -15,19 +15,17 @@ import (
)
const (
- ROLE_TEAM_ADMIN = "admin"
- ROLE_SYSTEM_ADMIN = "system_admin"
- USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
- USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
- USER_OFFLINE = "offline"
- USER_AWAY = "away"
- USER_ONLINE = "online"
- USER_NOTIFY_ALL = "all"
- USER_NOTIFY_MENTION = "mention"
- USER_NOTIFY_NONE = "none"
- DEFAULT_LOCALE = "en"
- USER_AUTH_SERVICE_EMAIL = "email"
- USER_AUTH_SERVICE_USERNAME = "username"
+ ROLE_TEAM_ADMIN = "admin"
+ ROLE_SYSTEM_ADMIN = "system_admin"
+ USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
+ USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
+ USER_OFFLINE = "offline"
+ USER_AWAY = "away"
+ USER_ONLINE = "online"
+ USER_NOTIFY_ALL = "all"
+ USER_NOTIFY_MENTION = "mention"
+ USER_NOTIFY_NONE = "none"
+ DEFAULT_LOCALE = "en"
)
type User struct {
@@ -56,8 +54,6 @@ type User struct {
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
FailedAttempts int `json:"failed_attempts,omitempty"`
Locale string `json:"locale"`
- MfaActive bool `json:"mfa_active,omitempty"`
- MfaSecret string `json:"mfa_secret,omitempty"`
}
// IsValid validates the user and returns an error if it isn't configured
@@ -144,8 +140,6 @@ func (u *User) PreSave() {
u.LastPasswordUpdate = u.CreateAt
- u.MfaActive = false
-
if u.Locale == "" {
u.Locale = DEFAULT_LOCALE
}
@@ -352,14 +346,7 @@ func IsInRole(userRoles string, inRole string) bool {
}
func (u *User) IsSSOUser() bool {
- if len(u.AuthData) != 0 && len(u.AuthService) != 0 && u.AuthService != USER_AUTH_SERVICE_LDAP {
- return true
- }
- return false
-}
-
-func (u *User) IsLDAPUser() bool {
- if u.AuthService == USER_AUTH_SERVICE_LDAP {
+ if len(u.AuthData) != 0 && len(u.AuthService) != 0 {
return true
}
return false
diff --git a/vendor/github.com/mattermost/platform/model/utils.go b/vendor/github.com/mattermost/platform/model/utils.go
index 1ce41bb3..808c89e3 100644
--- a/vendor/github.com/mattermost/platform/model/utils.go
+++ b/vendor/github.com/mattermost/platform/model/utils.go
@@ -367,15 +367,3 @@ func IsValidHttpUrl(rawUrl string) bool {
return true
}
-
-func IsValidHttpsUrl(rawUrl string) bool {
- if strings.Index(rawUrl, "https://") != 0 {
- return false
- }
-
- if _, err := url.ParseRequestURI(rawUrl); err != nil {
- return false
- }
-
- return true
-}
diff --git a/vendor/github.com/mattermost/platform/model/version.go b/vendor/github.com/mattermost/platform/model/version.go
index b3950dcc..fe90644b 100644
--- a/vendor/github.com/mattermost/platform/model/version.go
+++ b/vendor/github.com/mattermost/platform/model/version.go
@@ -13,6 +13,7 @@ import (
// It should be maitained in chronological order with most current
// release at the front of the list.
var versions = []string{
+ "2.2.0",
"2.1.0",
"2.0.0",
"1.4.0",
@@ -28,10 +29,10 @@ var versions = []string{
}
var CurrentVersion string = versions[0]
-var BuildNumber string
-var BuildDate string
-var BuildHash string
-var BuildEnterpriseReady string
+var BuildNumber = "_BUILD_NUMBER_"
+var BuildDate = "_BUILD_DATE_"
+var BuildHash = "_BUILD_HASH_"
+var BuildEnterpriseReady = "_BUILD_ENTERPRISE_READY_"
var versionsWithoutHotFixes []string
func init() {
@@ -118,10 +119,5 @@ func IsPreviousVersionsSupported(versionToCheck string) bool {
return true
}
- // Current - 3 Supported
- if versionsWithoutHotFixes[3] == versionToCheckStr {
- return true
- }
-
return false
}