mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-27 07:39:25 +00:00
Sync with mattermost 3.0
This commit is contained in:
212
vendor/github.com/mattermost/platform/model/config.go
generated
vendored
212
vendor/github.com/mattermost/platform/model/config.go
generated
vendored
@ -21,6 +21,18 @@ 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"
|
||||
|
||||
DIRECT_MESSAGE_ANY = "any"
|
||||
DIRECT_MESSAGE_TEAM = "team"
|
||||
|
||||
FAKE_SETTING = "********************************"
|
||||
)
|
||||
|
||||
type ServiceSettings struct {
|
||||
@ -39,6 +51,7 @@ type ServiceSettings struct {
|
||||
EnableDeveloper *bool
|
||||
EnableSecurityFixAlert *bool
|
||||
EnableInsecureOutgoingConnections *bool
|
||||
EnableMultifactorAuthentication *bool
|
||||
AllowCorsFrom *string
|
||||
SessionLengthWebInDays *int
|
||||
SessionLengthMobileInDays *int
|
||||
@ -46,6 +59,7 @@ type ServiceSettings struct {
|
||||
SessionCacheInMinutes *int
|
||||
WebsocketSecurePort *int
|
||||
WebsocketPort *int
|
||||
WebserverMode *string
|
||||
}
|
||||
|
||||
type SSOSettings struct {
|
||||
@ -116,6 +130,7 @@ type EmailSettings struct {
|
||||
PasswordResetSalt string
|
||||
SendPushNotifications *bool
|
||||
PushNotificationServer *string
|
||||
PushNotificationContents *string
|
||||
}
|
||||
|
||||
type RateLimitSettings struct {
|
||||
@ -145,44 +160,63 @@ type TeamSettings struct {
|
||||
MaxUsersPerTeam int
|
||||
EnableTeamCreation bool
|
||||
EnableUserCreation bool
|
||||
EnableOpenServer *bool
|
||||
RestrictCreationToDomains string
|
||||
RestrictTeamNames *bool
|
||||
EnableTeamListing *bool
|
||||
EnableCustomBrand *bool
|
||||
CustomBrandText *string
|
||||
RestrictDirectMessage *string
|
||||
}
|
||||
|
||||
type LdapSettings struct {
|
||||
// Basic
|
||||
Enable *bool
|
||||
LdapServer *string
|
||||
LdapPort *int
|
||||
BaseDN *string
|
||||
BindUsername *string
|
||||
BindPassword *string
|
||||
Enable *bool
|
||||
LdapServer *string
|
||||
LdapPort *int
|
||||
ConnectionSecurity *string
|
||||
BaseDN *string
|
||||
BindUsername *string
|
||||
BindPassword *string
|
||||
|
||||
// Filtering
|
||||
UserFilter *string
|
||||
|
||||
// User Mapping
|
||||
FirstNameAttribute *string
|
||||
LastNameAttribute *string
|
||||
EmailAttribute *string
|
||||
UsernameAttribute *string
|
||||
NicknameAttribute *string
|
||||
IdAttribute *string
|
||||
|
||||
// Advanced
|
||||
QueryTimeout *int
|
||||
SkipCertificateVerification *bool
|
||||
QueryTimeout *int
|
||||
|
||||
// Customization
|
||||
LoginFieldName *string
|
||||
}
|
||||
|
||||
type ComplianceSettings struct {
|
||||
Enable *bool
|
||||
Directory *string
|
||||
EnableDaily *bool
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
func (o *Config) ToJson() string {
|
||||
@ -259,14 +293,34 @@ 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
|
||||
}
|
||||
|
||||
if o.TeamSettings.EnableTeamListing == nil {
|
||||
o.TeamSettings.EnableTeamListing = new(bool)
|
||||
*o.TeamSettings.EnableTeamListing = false
|
||||
if o.TeamSettings.EnableCustomBrand == nil {
|
||||
o.TeamSettings.EnableCustomBrand = new(bool)
|
||||
*o.TeamSettings.EnableCustomBrand = false
|
||||
}
|
||||
|
||||
if o.TeamSettings.CustomBrandText == nil {
|
||||
o.TeamSettings.CustomBrandText = new(string)
|
||||
*o.TeamSettings.CustomBrandText = ""
|
||||
}
|
||||
|
||||
if o.TeamSettings.EnableOpenServer == nil {
|
||||
o.TeamSettings.EnableOpenServer = new(bool)
|
||||
*o.TeamSettings.EnableOpenServer = false
|
||||
}
|
||||
|
||||
if o.TeamSettings.RestrictDirectMessage == nil {
|
||||
o.TeamSettings.RestrictDirectMessage = new(string)
|
||||
*o.TeamSettings.RestrictDirectMessage = DIRECT_MESSAGE_ANY
|
||||
}
|
||||
|
||||
if o.EmailSettings.EnableSignInWithEmail == nil {
|
||||
@ -294,26 +348,51 @@ func (o *Config) SetDefaults() {
|
||||
*o.EmailSettings.PushNotificationServer = ""
|
||||
}
|
||||
|
||||
if o.EmailSettings.PushNotificationContents == nil {
|
||||
o.EmailSettings.PushNotificationContents = new(string)
|
||||
*o.EmailSettings.PushNotificationContents = GENERIC_NOTIFICATION
|
||||
}
|
||||
|
||||
if !IsSafeLink(o.SupportSettings.TermsOfServiceLink) {
|
||||
o.SupportSettings.TermsOfServiceLink = nil
|
||||
}
|
||||
|
||||
if o.SupportSettings.TermsOfServiceLink == nil {
|
||||
o.SupportSettings.TermsOfServiceLink = new(string)
|
||||
*o.SupportSettings.TermsOfServiceLink = "/static/help/terms.html"
|
||||
}
|
||||
|
||||
if !IsSafeLink(o.SupportSettings.PrivacyPolicyLink) {
|
||||
o.SupportSettings.PrivacyPolicyLink = nil
|
||||
}
|
||||
|
||||
if o.SupportSettings.PrivacyPolicyLink == nil {
|
||||
o.SupportSettings.PrivacyPolicyLink = new(string)
|
||||
*o.SupportSettings.PrivacyPolicyLink = "/static/help/privacy.html"
|
||||
}
|
||||
|
||||
if !IsSafeLink(o.SupportSettings.AboutLink) {
|
||||
o.SupportSettings.AboutLink = nil
|
||||
}
|
||||
|
||||
if o.SupportSettings.AboutLink == nil {
|
||||
o.SupportSettings.AboutLink = new(string)
|
||||
*o.SupportSettings.AboutLink = "/static/help/about.html"
|
||||
}
|
||||
|
||||
if !IsSafeLink(o.SupportSettings.HelpLink) {
|
||||
o.SupportSettings.HelpLink = nil
|
||||
}
|
||||
|
||||
if o.SupportSettings.HelpLink == nil {
|
||||
o.SupportSettings.HelpLink = new(string)
|
||||
*o.SupportSettings.HelpLink = "/static/help/help.html"
|
||||
}
|
||||
|
||||
if !IsSafeLink(o.SupportSettings.ReportAProblemLink) {
|
||||
o.SupportSettings.ReportAProblemLink = nil
|
||||
}
|
||||
|
||||
if o.SupportSettings.ReportAProblemLink == nil {
|
||||
o.SupportSettings.ReportAProblemLink = new(string)
|
||||
*o.SupportSettings.ReportAProblemLink = "/static/help/report_problem.html"
|
||||
@ -339,6 +418,16 @@ func (o *Config) SetDefaults() {
|
||||
*o.LdapSettings.Enable = false
|
||||
}
|
||||
|
||||
if o.LdapSettings.UserFilter == nil {
|
||||
o.LdapSettings.UserFilter = new(string)
|
||||
*o.LdapSettings.UserFilter = ""
|
||||
}
|
||||
|
||||
if o.LdapSettings.LoginFieldName == nil {
|
||||
o.LdapSettings.LoginFieldName = new(string)
|
||||
*o.LdapSettings.LoginFieldName = ""
|
||||
}
|
||||
|
||||
if o.ServiceSettings.SessionLengthWebInDays == nil {
|
||||
o.ServiceSettings.SessionLengthWebInDays = new(int)
|
||||
*o.ServiceSettings.SessionLengthWebInDays = 30
|
||||
@ -383,6 +472,41 @@ 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
|
||||
}
|
||||
|
||||
if o.LdapSettings.NicknameAttribute == nil {
|
||||
o.LdapSettings.NicknameAttribute = new(string)
|
||||
*o.LdapSettings.NicknameAttribute = ""
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Config) IsValid() *AppError {
|
||||
@ -399,6 +523,10 @@ func (o *Config) IsValid() *AppError {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.max_users.app_error", nil, "")
|
||||
}
|
||||
|
||||
if !(*o.TeamSettings.RestrictDirectMessage == DIRECT_MESSAGE_ANY || *o.TeamSettings.RestrictDirectMessage == DIRECT_MESSAGE_TEAM) {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.restrict_direct_message.app_error", nil, "")
|
||||
}
|
||||
|
||||
if len(o.SqlSettings.AtRestEncryptKey) < 32 {
|
||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.encrypt_sql.app_error", nil, "")
|
||||
}
|
||||
@ -471,13 +599,45 @@ 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
|
||||
}
|
||||
|
||||
func (me *Config) GetSanitizeOptions() map[string]bool {
|
||||
func (o *Config) GetSanitizeOptions() map[string]bool {
|
||||
options := map[string]bool{}
|
||||
options["fullname"] = me.PrivacySettings.ShowFullName
|
||||
options["email"] = me.PrivacySettings.ShowEmailAddress
|
||||
options["fullname"] = o.PrivacySettings.ShowFullName
|
||||
options["email"] = o.PrivacySettings.ShowEmailAddress
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
func (o *Config) Sanitize() {
|
||||
if &o.LdapSettings != nil && len(*o.LdapSettings.BindPassword) > 0 {
|
||||
*o.LdapSettings.BindPassword = FAKE_SETTING
|
||||
}
|
||||
|
||||
o.FileSettings.PublicLinkSalt = FAKE_SETTING
|
||||
if len(o.FileSettings.AmazonS3SecretAccessKey) > 0 {
|
||||
o.FileSettings.AmazonS3SecretAccessKey = FAKE_SETTING
|
||||
}
|
||||
|
||||
o.EmailSettings.InviteSalt = FAKE_SETTING
|
||||
o.EmailSettings.PasswordResetSalt = FAKE_SETTING
|
||||
if len(o.EmailSettings.SMTPPassword) > 0 {
|
||||
o.EmailSettings.SMTPPassword = FAKE_SETTING
|
||||
}
|
||||
|
||||
if len(o.GitLabSettings.Secret) > 0 {
|
||||
o.GitLabSettings.Secret = FAKE_SETTING
|
||||
}
|
||||
|
||||
o.SqlSettings.DataSource = FAKE_SETTING
|
||||
o.SqlSettings.AtRestEncryptKey = FAKE_SETTING
|
||||
|
||||
for i := range o.SqlSettings.DataSourceReplicas {
|
||||
o.SqlSettings.DataSourceReplicas[i] = FAKE_SETTING
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user