diff options
author | Wim <wim@42.be> | 2018-02-09 00:11:04 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-02-09 00:11:04 +0100 |
commit | 5aab158c0b0db64b6136fe2fdaca8b8e9e3bd811 (patch) | |
tree | 09bcb3f02f968867c2ca84db1f28594dd0afb967 /vendor/github.com/mattermost/platform/model/license.go | |
parent | 1d33e60e36fa7b0e361990ac347ee8d620d67dcc (diff) | |
download | matterbridge-msglm-5aab158c0b0db64b6136fe2fdaca8b8e9e3bd811.tar.gz matterbridge-msglm-5aab158c0b0db64b6136fe2fdaca8b8e9e3bd811.tar.bz2 matterbridge-msglm-5aab158c0b0db64b6136fe2fdaca8b8e9e3bd811.zip |
Update vendor (github.com/mattermost)
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/license.go')
-rw-r--r-- | vendor/github.com/mattermost/platform/model/license.go | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/vendor/github.com/mattermost/platform/model/license.go b/vendor/github.com/mattermost/platform/model/license.go index ea108972..a81f882c 100644 --- a/vendor/github.com/mattermost/platform/model/license.go +++ b/vendor/github.com/mattermost/platform/model/license.go @@ -6,6 +6,7 @@ package model import ( "encoding/json" "io" + "net/http" ) const ( @@ -51,7 +52,10 @@ type Features struct { PasswordRequirements *bool `json:"password_requirements"` Elasticsearch *bool `json:"elastic_search"` Announcement *bool `json:"announcement"` + ThemeManagement *bool `json:"theme_management"` EmailNotificationContents *bool `json:"email_notification_contents"` + DataRetention *bool `json:"data_retention"` + MessageExport *bool `json:"message_export"` // after we enabled more features for webrtc we'll need to control them with this FutureFeatures *bool `json:"future_features"` @@ -72,106 +76,96 @@ func (f *Features) ToMap() map[string]interface{} { "password": *f.PasswordRequirements, "elastic_search": *f.Elasticsearch, "email_notification_contents": *f.EmailNotificationContents, + "data_retention": *f.DataRetention, + "message_export": *f.MessageExport, "future": *f.FutureFeatures, } } func (f *Features) SetDefaults() { if f.FutureFeatures == nil { - f.FutureFeatures = new(bool) - *f.FutureFeatures = true + f.FutureFeatures = NewBool(true) } if f.Users == nil { - f.Users = new(int) - *f.Users = 0 + f.Users = NewInt(0) } if f.LDAP == nil { - f.LDAP = new(bool) - *f.LDAP = *f.FutureFeatures + f.LDAP = NewBool(*f.FutureFeatures) } if f.MFA == nil { - f.MFA = new(bool) - *f.MFA = *f.FutureFeatures + f.MFA = NewBool(*f.FutureFeatures) } if f.GoogleOAuth == nil { - f.GoogleOAuth = new(bool) - *f.GoogleOAuth = *f.FutureFeatures + f.GoogleOAuth = NewBool(*f.FutureFeatures) } if f.Office365OAuth == nil { - f.Office365OAuth = new(bool) - *f.Office365OAuth = *f.FutureFeatures + f.Office365OAuth = NewBool(*f.FutureFeatures) } if f.Compliance == nil { - f.Compliance = new(bool) - *f.Compliance = *f.FutureFeatures + f.Compliance = NewBool(*f.FutureFeatures) } if f.Cluster == nil { - f.Cluster = new(bool) - *f.Cluster = *f.FutureFeatures + f.Cluster = NewBool(*f.FutureFeatures) } if f.Metrics == nil { - f.Metrics = new(bool) - *f.Metrics = *f.FutureFeatures + f.Metrics = NewBool(*f.FutureFeatures) } if f.CustomBrand == nil { - f.CustomBrand = new(bool) - *f.CustomBrand = *f.FutureFeatures + f.CustomBrand = NewBool(*f.FutureFeatures) } if f.MHPNS == nil { - f.MHPNS = new(bool) - *f.MHPNS = *f.FutureFeatures + f.MHPNS = NewBool(*f.FutureFeatures) } if f.SAML == nil { - f.SAML = new(bool) - *f.SAML = *f.FutureFeatures + f.SAML = NewBool(*f.FutureFeatures) } if f.PasswordRequirements == nil { - f.PasswordRequirements = new(bool) - *f.PasswordRequirements = *f.FutureFeatures + f.PasswordRequirements = NewBool(*f.FutureFeatures) } if f.Elasticsearch == nil { - f.Elasticsearch = new(bool) - *f.Elasticsearch = *f.FutureFeatures + f.Elasticsearch = NewBool(*f.FutureFeatures) } if f.Announcement == nil { - f.Announcement = new(bool) - *f.Announcement = true + f.Announcement = NewBool(true) + } + + if f.ThemeManagement == nil { + f.ThemeManagement = NewBool(true) } if f.EmailNotificationContents == nil { - f.EmailNotificationContents = new(bool) - *f.EmailNotificationContents = *f.FutureFeatures + f.EmailNotificationContents = NewBool(*f.FutureFeatures) + } + + if f.DataRetention == nil { + f.DataRetention = NewBool(*f.FutureFeatures) + } + + if f.MessageExport == nil { + f.MessageExport = NewBool(*f.FutureFeatures) } } func (l *License) IsExpired() bool { - now := GetMillis() - if l.ExpiresAt < now { - return true - } - return false + return l.ExpiresAt < GetMillis() } func (l *License) IsStarted() bool { - now := GetMillis() - if l.StartsAt < now { - return true - } - return false + return l.StartsAt < GetMillis() } func (l *License) ToJson() string { @@ -196,15 +190,15 @@ func LicenseFromJson(data io.Reader) *License { func (lr *LicenseRecord) IsValid() *AppError { if len(lr.Id) != 26 { - return NewLocAppError("LicenseRecord.IsValid", "model.license_record.is_valid.id.app_error", nil, "") + return NewAppError("LicenseRecord.IsValid", "model.license_record.is_valid.id.app_error", nil, "", http.StatusBadRequest) } if lr.CreateAt == 0 { - return NewLocAppError("LicenseRecord.IsValid", "model.license_record.is_valid.create_at.app_error", nil, "") + return NewAppError("LicenseRecord.IsValid", "model.license_record.is_valid.create_at.app_error", nil, "", http.StatusBadRequest) } if len(lr.Bytes) == 0 || len(lr.Bytes) > 10000 { - return NewLocAppError("LicenseRecord.IsValid", "model.license_record.is_valid.create_at.app_error", nil, "") + return NewAppError("LicenseRecord.IsValid", "model.license_record.is_valid.create_at.app_error", nil, "", http.StatusBadRequest) } return nil |