diff options
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model')
23 files changed, 986 insertions, 216 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/channel_member.go b/vendor/github.com/mattermost/mattermost-server/v5/model/channel_member.go index e38bfffe..d7a76e2d 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/channel_member.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/channel_member.go @@ -164,6 +164,18 @@ func (o *ChannelMember) GetRoles() []string { return strings.Fields(o.Roles) } +func (o *ChannelMember) SetChannelMuted(muted bool) { + if o.IsChannelMuted() { + o.NotifyProps[MARK_UNREAD_NOTIFY_PROP] = CHANNEL_MARK_UNREAD_ALL + } else { + o.NotifyProps[MARK_UNREAD_NOTIFY_PROP] = CHANNEL_MARK_UNREAD_MENTION + } +} + +func (o *ChannelMember) IsChannelMuted() bool { + return o.NotifyProps[MARK_UNREAD_NOTIFY_PROP] == CHANNEL_MARK_UNREAD_MENTION +} + func IsChannelNotifyLevelValid(notifyLevel string) bool { return notifyLevel == CHANNEL_NOTIFY_DEFAULT || notifyLevel == CHANNEL_NOTIFY_ALL || diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go b/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go index d05c6c9d..033432c9 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go @@ -46,6 +46,7 @@ type SidebarCategory struct { Sorting SidebarCategorySorting `json:"sorting"` Type SidebarCategoryType `json:"type"` DisplayName string `json:"display_name"` + Muted bool `json:"muted"` } // SidebarCategoryWithChannels combines data from SidebarCategory table with the Channel IDs that belong to that category diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/client4.go b/vendor/github.com/mattermost/mattermost-server/v5/model/client4.go index b3c34c39..8ebf0da1 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/client4.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/client4.go @@ -189,6 +189,14 @@ func (c *Client4) GetUserRoute(userId string) string { return fmt.Sprintf(c.GetUsersRoute()+"/%v", userId) } +func (c *Client4) GetUserThreadsRoute(userId string) string { + return fmt.Sprintf(c.GetUsersRoute()+"/%v/threads", userId) +} + +func (c *Client4) GetUserThreadRoute(userId, threadId string) string { + return fmt.Sprintf(c.GetUserThreadsRoute(userId)+"/%v", threadId) +} + func (c *Client4) GetUserCategoryRoute(userID, teamID string) string { return c.GetUserRoute(userID) + c.GetTeamRoute(teamID) + "/channels/categories" } @@ -334,6 +342,10 @@ func (c *Client4) GetSystemRoute() string { return "/system" } +func (c *Client4) GetCloudRoute() string { + return "/cloud" +} + func (c *Client4) GetTestEmailRoute() string { return "/email/test" } @@ -3268,6 +3280,21 @@ func (c *Client4) GetPingWithServerStatus() (string, *Response) { return MapFromJson(r.Body)["status"], BuildResponse(r) } +// GetPingWithFullServerStatus will return the full status if several basic server +// health checks all pass successfully. +func (c *Client4) GetPingWithFullServerStatus() (map[string]string, *Response) { + r, err := c.DoApiGet(c.GetSystemRoute()+"/ping?get_server_status="+c.boolString(true), "") + if r != nil && r.StatusCode == 500 { + defer r.Body.Close() + return map[string]string{"status": STATUS_UNHEALTHY}, BuildErrorResponse(r, err) + } + if err != nil { + return nil, BuildErrorResponse(r, err) + } + defer closeBody(r) + return MapFromJson(r.Body), BuildResponse(r) +} + // TestEmail will attempt to connect to the configured SMTP server. func (c *Client4) TestEmail(config *Config) (bool, *Response) { r, err := c.DoApiPost(c.GetTestEmailRoute(), config.ToJson()) @@ -4090,7 +4117,7 @@ func (c *Client4) MigrateAuthToSaml(fromAuthService string, usersMap map[string] // UploadLdapPublicCertificate will upload a public certificate for LDAP and set the config to use it. func (c *Client4) UploadLdapPublicCertificate(data []byte) (bool, *Response) { - body, writer, err := fileToMultipart(data, LDAP_PUBIC_CERTIFICATE_NAME) + body, writer, err := fileToMultipart(data, LDAP_PUBLIC_CERTIFICATE_NAME) if err != nil { return false, &Response{Error: NewAppError("UploadLdapPublicCertificate", "model.client.upload_ldap_cert.app_error", nil, err.Error(), http.StatusBadRequest)} } @@ -5616,3 +5643,183 @@ func (c *Client4) UpdatePassword(userId, currentPassword, newPassword string) *R defer closeBody(r) return BuildResponse(r) } + +// Cloud Section + +func (c *Client4) GetCloudProducts() ([]*Product, *Response) { + r, appErr := c.DoApiGet(c.GetCloudRoute()+"/products", "") + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var cloudProducts []*Product + json.NewDecoder(r.Body).Decode(&cloudProducts) + + return cloudProducts, BuildResponse(r) +} + +func (c *Client4) CreateCustomerPayment() (*StripeSetupIntent, *Response) { + r, appErr := c.DoApiPost(c.GetCloudRoute()+"/payment", "") + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var setupIntent *StripeSetupIntent + json.NewDecoder(r.Body).Decode(&setupIntent) + + return setupIntent, BuildResponse(r) +} + +func (c *Client4) ConfirmCustomerPayment(confirmRequest *ConfirmPaymentMethodRequest) *Response { + json, _ := json.Marshal(confirmRequest) + + r, appErr := c.doApiPostBytes(c.GetCloudRoute()+"/payment/confirm", json) + if appErr != nil { + return BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + return BuildResponse(r) +} + +func (c *Client4) GetCloudCustomer() (*CloudCustomer, *Response) { + r, appErr := c.DoApiGet(c.GetCloudRoute()+"/customer", "") + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var cloudCustomer *CloudCustomer + json.NewDecoder(r.Body).Decode(&cloudCustomer) + + return cloudCustomer, BuildResponse(r) +} + +func (c *Client4) GetSubscription() (*Subscription, *Response) { + r, appErr := c.DoApiGet(c.GetCloudRoute()+"/subscription", "") + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var subscription *Subscription + json.NewDecoder(r.Body).Decode(&subscription) + + return subscription, BuildResponse(r) +} + +func (c *Client4) GetInvoicesForSubscription() ([]*Invoice, *Response) { + r, appErr := c.DoApiGet(c.GetCloudRoute()+"/subscription/invoices", "") + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var invoices []*Invoice + json.NewDecoder(r.Body).Decode(&invoices) + + return invoices, BuildResponse(r) +} + +func (c *Client4) UpdateCloudCustomer(customerInfo *CloudCustomerInfo) (*CloudCustomer, *Response) { + customerBytes, _ := json.Marshal(customerInfo) + + r, appErr := c.doApiPutBytes(c.GetCloudRoute()+"/customer", customerBytes) + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var customer *CloudCustomer + json.NewDecoder(r.Body).Decode(&customer) + + return customer, BuildResponse(r) +} + +func (c *Client4) UpdateCloudCustomerAddress(address *Address) (*CloudCustomer, *Response) { + addressBytes, _ := json.Marshal(address) + + r, appErr := c.doApiPutBytes(c.GetCloudRoute()+"/customer/address", addressBytes) + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var customer *CloudCustomer + json.NewDecoder(r.Body).Decode(&customer) + + return customer, BuildResponse(r) +} + +func (c *Client4) GetUserThreads(userId string, options GetUserThreadsOpts) (*Threads, *Response) { + v := url.Values{} + if options.Since != 0 { + v.Set("since", fmt.Sprintf("%d", options.Since)) + } + if options.Page != 0 { + v.Set("page", fmt.Sprintf("%d", options.Page)) + } + if options.PageSize != 0 { + v.Set("pageSize", fmt.Sprintf("%d", options.PageSize)) + } + if options.Extended { + v.Set("extended", "true") + } + if options.Deleted { + v.Set("deleted", "true") + } + + url := c.GetUserThreadsRoute(userId) + if len(v) > 0 { + url += "?" + v.Encode() + } + + r, appErr := c.DoApiGet(url, "") + if appErr != nil { + return nil, BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + var threads Threads + json.NewDecoder(r.Body).Decode(&threads) + + return &threads, BuildResponse(r) +} + +func (c *Client4) UpdateThreadsReadForUser(userId string, timestamp int64) *Response { + r, appErr := c.DoApiPut(fmt.Sprintf("%s/read/%d", c.GetUserThreadsRoute(userId), timestamp), "") + if appErr != nil { + return BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + return BuildResponse(r) +} + +func (c *Client4) UpdateThreadReadForUser(userId, threadId string, timestamp int64) *Response { + r, appErr := c.DoApiPut(fmt.Sprintf("%s/read/%d", c.GetUserThreadRoute(userId, threadId), timestamp), "") + if appErr != nil { + return BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + return BuildResponse(r) +} + +func (c *Client4) UpdateThreadFollowForUser(userId, threadId string, state bool) *Response { + var appErr *AppError + var r *http.Response + if state { + r, appErr = c.DoApiPut(c.GetUserThreadRoute(userId, threadId)+"/following", "") + } else { + r, appErr = c.DoApiDelete(c.GetUserThreadRoute(userId, threadId) + "/following") + } + if appErr != nil { + return BuildErrorResponse(r, appErr) + } + defer closeBody(r) + + return BuildResponse(r) +} diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/cloud.go b/vendor/github.com/mattermost/mattermost-server/v5/model/cloud.go new file mode 100644 index 00000000..e4fddbcd --- /dev/null +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/cloud.go @@ -0,0 +1,114 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package model + +// Product model represents a product on the cloud system. +type Product struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + PricePerSeat float64 `json:"price_per_seat"` + AddOns []*AddOn `json:"add_ons"` +} + +// AddOn represents an addon to a product. +type AddOn struct { + ID string `json:"id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + PricePerSeat float64 `json:"price_per_seat"` +} + +// StripeSetupIntent represents the SetupIntent model from Stripe for updating payment methods. +type StripeSetupIntent struct { + ID string `json:"id"` + ClientSecret string `json:"client_secret"` +} + +// ConfirmPaymentMethodRequest contains the fields for the customer payment update API. +type ConfirmPaymentMethodRequest struct { + StripeSetupIntentID string `json:"stripe_setup_intent_id"` +} + +// Customer model represents a customer on the system. +type CloudCustomer struct { + CloudCustomerInfo + ID string `json:"id"` + CreatorID string `json:"creator_id"` + CreateAt int64 `json:"create_at"` + BillingAddress *Address `json:"billing_address"` + CompanyAddress *Address `json:"company_address"` + PaymentMethod *PaymentMethod `json:"payment_method"` +} + +// CloudCustomerInfo represents editable info of a customer. +type CloudCustomerInfo struct { + Name string `json:"name"` + Email string `json:"email,omitempty"` + ContactFirstName string `json:"contact_first_name,omitempty"` + ContactLastName string `json:"contact_last_name,omitempty"` + NumEmployees int `json:"num_employees"` +} + +// Address model represents a customer's address. +type Address struct { + City string `json:"city"` + Country string `json:"country"` + Line1 string `json:"line1"` + Line2 string `json:"line2"` + PostalCode string `json:"postal_code"` + State string `json:"state"` +} + +// PaymentMethod represents methods of payment for a customer. +type PaymentMethod struct { + Type string `json:"type"` + LastFour int `json:"last_four"` + ExpMonth int `json:"exp_month"` + ExpYear int `json:"exp_year"` + CardBrand string `json:"card_brand"` + Name string `json:"name"` +} + +// Subscription model represents a subscription on the system. +type Subscription struct { + ID string `json:"id"` + CustomerID string `json:"customer_id"` + ProductID string `json:"product_id"` + AddOns []string `json:"add_ons"` + StartAt int64 `json:"start_at"` + EndAt int64 `json:"end_at"` + CreateAt int64 `json:"create_at"` + Seats int `json:"seats"` + Status string `json:"status"` + DNS string `json:"dns"` + IsPaidTier string `json:"is_paid_tier"` + LastInvoice *Invoice `json:"last_invoice"` +} + +// Invoice model represents a cloud invoice +type Invoice struct { + ID string `json:"id"` + Number string `json:"number"` + CreateAt int64 `json:"create_at"` + Total int64 `json:"total"` + Tax int64 `json:"tax"` + Status string `json:"status"` + Description string `json:"description"` + PeriodStart int64 `json:"period_start"` + PeriodEnd int64 `json:"period_end"` + SubscriptionID string `json:"subscription_id"` + Items []*InvoiceLineItem `json:"line_items"` +} + +// InvoiceLineItem model represents a cloud invoice lineitem tied to an invoice. +type InvoiceLineItem struct { + PriceID string `json:"price_id"` + Total int64 `json:"total"` + Quantity int64 `json:"quantity"` + PricePerUnit int64 `json:"price_per_unit"` + Description string `json:"description"` + Type string `json:"type"` + Metadata map[string]interface{} `json:"metadata"` +} diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/config.go b/vendor/github.com/mattermost/mattermost-server/v5/model/config.go index 42863ead..cbdf0f55 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/config.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/config.go @@ -12,12 +12,14 @@ import ( "net/http" "net/url" "os" + "reflect" "regexp" "strconv" "strings" "time" "github.com/mattermost/ldap" + "github.com/mattermost/mattermost-server/v5/mlog" ) const ( @@ -107,7 +109,7 @@ const ( TEAM_SETTINGS_DEFAULT_CUSTOM_DESCRIPTION_TEXT = "" TEAM_SETTINGS_DEFAULT_USER_STATUS_AWAY_TIMEOUT = 300 - SQL_SETTINGS_DEFAULT_DATA_SOURCE = "mmuser:mostest@tcp(localhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" + SQL_SETTINGS_DEFAULT_DATA_SOURCE = "postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable&connect_timeout=10" FILE_SETTINGS_DEFAULT_DIRECTORY = "./data/" @@ -220,6 +222,8 @@ const ( OFFICE365_SETTINGS_DEFAULT_TOKEN_ENDPOINT = "https://login.microsoftonline.com/common/oauth2/v2.0/token" OFFICE365_SETTINGS_DEFAULT_USER_API_ENDPOINT = "https://graph.microsoft.com/v1.0/me" + CLOUD_SETTINGS_DEFAULT_CWS_URL = "https://customers.mattermost.com" + LOCAL_MODE_SOCKET_PATH = "/var/tmp/mattermost_local.socket" ) @@ -250,26 +254,26 @@ var ServerTLSSupportedCiphers = map[string]uint16{ type ServiceSettings struct { SiteURL *string `access:"environment,authentication,write_restrictable"` - WebsocketURL *string `access:"write_restrictable"` - LicenseFileLocation *string `access:"write_restrictable"` - ListenAddress *string `access:"environment,write_restrictable"` - ConnectionSecurity *string `access:"environment,write_restrictable"` - TLSCertFile *string `access:"environment,write_restrictable"` - TLSKeyFile *string `access:"environment,write_restrictable"` - TLSMinVer *string `access:"write_restrictable"` - TLSStrictTransport *bool `access:"write_restrictable"` - TLSStrictTransportMaxAge *int64 `access:"write_restrictable"` - TLSOverwriteCiphers []string `access:"write_restrictable"` - UseLetsEncrypt *bool `access:"environment,write_restrictable"` - LetsEncryptCertificateCacheFile *string `access:"environment,write_restrictable"` - Forward80To443 *bool `access:"environment,write_restrictable"` - TrustedProxyIPHeader []string `access:"write_restrictable"` - ReadTimeout *int `access:"environment,write_restrictable"` - WriteTimeout *int `access:"environment,write_restrictable"` - IdleTimeout *int `access:"write_restrictable"` - MaximumLoginAttempts *int `access:"authentication,write_restrictable"` - GoroutineHealthThreshold *int `access:"write_restrictable"` - GoogleDeveloperKey *string `access:"site,write_restrictable"` + WebsocketURL *string `access:"write_restrictable,cloud_restrictable"` + LicenseFileLocation *string `access:"write_restrictable,cloud_restrictable"` + ListenAddress *string `access:"environment,write_restrictable,cloud_restrictable"` + ConnectionSecurity *string `access:"environment,write_restrictable,cloud_restrictable"` + TLSCertFile *string `access:"environment,write_restrictable,cloud_restrictable"` + TLSKeyFile *string `access:"environment,write_restrictable,cloud_restrictable"` + TLSMinVer *string `access:"write_restrictable,cloud_restrictable"` + TLSStrictTransport *bool `access:"write_restrictable,cloud_restrictable"` + TLSStrictTransportMaxAge *int64 `access:"write_restrictable,cloud_restrictable"` + TLSOverwriteCiphers []string `access:"write_restrictable,cloud_restrictable"` + UseLetsEncrypt *bool `access:"environment,write_restrictable,cloud_restrictable"` + LetsEncryptCertificateCacheFile *string `access:"environment,write_restrictable,cloud_restrictable"` + Forward80To443 *bool `access:"environment,write_restrictable,cloud_restrictable"` + TrustedProxyIPHeader []string `access:"write_restrictable,cloud_restrictable"` + ReadTimeout *int `access:"environment,write_restrictable,cloud_restrictable"` + WriteTimeout *int `access:"environment,write_restrictable,cloud_restrictable"` + IdleTimeout *int `access:"write_restrictable,cloud_restrictable"` + MaximumLoginAttempts *int `access:"authentication,write_restrictable,cloud_restrictable"` + GoroutineHealthThreshold *int `access:"write_restrictable,cloud_restrictable"` + GoogleDeveloperKey *string `access:"site,write_restrictable,cloud_restrictable"` EnableOAuthServiceProvider *bool `access:"integrations"` EnableIncomingWebhooks *bool `access:"integrations"` EnableOutgoingWebhooks *bool `access:"integrations"` @@ -278,29 +282,29 @@ type ServiceSettings struct { EnablePostUsernameOverride *bool `access:"integrations"` EnablePostIconOverride *bool `access:"integrations"` EnableLinkPreviews *bool `access:"site"` - EnableTesting *bool `access:"environment,write_restrictable"` - EnableDeveloper *bool `access:"environment,write_restrictable"` - EnableOpenTracing *bool `access:"write_restrictable"` - EnableSecurityFixAlert *bool `access:"environment,write_restrictable"` - EnableInsecureOutgoingConnections *bool `access:"environment,write_restrictable"` - AllowedUntrustedInternalConnections *string `access:"environment,write_restrictable"` + EnableTesting *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableDeveloper *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableOpenTracing *bool `access:"write_restrictable,cloud_restrictable"` + EnableSecurityFixAlert *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableInsecureOutgoingConnections *bool `access:"environment,write_restrictable,cloud_restrictable"` + AllowedUntrustedInternalConnections *string `access:"environment,write_restrictable,cloud_restrictable"` EnableMultifactorAuthentication *bool `access:"authentication"` EnforceMultifactorAuthentication *bool `access:"authentication"` EnableUserAccessTokens *bool `access:"integrations"` - AllowCorsFrom *string `access:"integrations,write_restrictable"` - CorsExposedHeaders *string `access:"integrations,write_restrictable"` - CorsAllowCredentials *bool `access:"integrations,write_restrictable"` - CorsDebug *bool `access:"integrations,write_restrictable"` - AllowCookiesForSubdomains *bool `access:"write_restrictable"` - ExtendSessionLengthWithActivity *bool `access:"environment,write_restrictable"` - SessionLengthWebInDays *int `access:"environment,write_restrictable"` - SessionLengthMobileInDays *int `access:"environment,write_restrictable"` - SessionLengthSSOInDays *int `access:"environment,write_restrictable"` - SessionCacheInMinutes *int `access:"environment,write_restrictable"` - SessionIdleTimeoutInMinutes *int `access:"environment,write_restrictable"` - WebsocketSecurePort *int `access:"write_restrictable"` - WebsocketPort *int `access:"write_restrictable"` - WebserverMode *string `access:"environment,write_restrictable"` + AllowCorsFrom *string `access:"integrations,write_restrictable,cloud_restrictable"` + CorsExposedHeaders *string `access:"integrations,write_restrictable,cloud_restrictable"` + CorsAllowCredentials *bool `access:"integrations,write_restrictable,cloud_restrictable"` + CorsDebug *bool `access:"integrations,write_restrictable,cloud_restrictable"` + AllowCookiesForSubdomains *bool `access:"write_restrictable,cloud_restrictable"` + ExtendSessionLengthWithActivity *bool `access:"environment,write_restrictable,cloud_restrictable"` + SessionLengthWebInDays *int `access:"environment,write_restrictable,cloud_restrictable"` + SessionLengthMobileInDays *int `access:"environment,write_restrictable,cloud_restrictable"` + SessionLengthSSOInDays *int `access:"environment,write_restrictable,cloud_restrictable"` + SessionCacheInMinutes *int `access:"environment,write_restrictable,cloud_restrictable"` + SessionIdleTimeoutInMinutes *int `access:"environment,write_restrictable,cloud_restrictable"` + WebsocketSecurePort *int `access:"write_restrictable,cloud_restrictable"` + WebsocketPort *int `access:"write_restrictable,cloud_restrictable"` + WebserverMode *string `access:"environment,write_restrictable,cloud_restrictable"` EnableCustomEmoji *bool `access:"site"` EnableEmojiPicker *bool `access:"site"` EnableGifPicker *bool `access:"integrations"` @@ -310,14 +314,14 @@ type ServiceSettings struct { DEPRECATED_DO_NOT_USE_RestrictPostDelete *string `json:"RestrictPostDelete" mapstructure:"RestrictPostDelete"` // This field is deprecated and must not be used. DEPRECATED_DO_NOT_USE_AllowEditPost *string `json:"AllowEditPost" mapstructure:"AllowEditPost"` // This field is deprecated and must not be used. PostEditTimeLimit *int `access:"user_management_permissions"` - TimeBetweenUserTypingUpdatesMilliseconds *int64 `access:"experimental,write_restrictable"` - EnablePostSearch *bool `access:"write_restrictable"` - MinimumHashtagLength *int `access:"environment,write_restrictable"` - EnableUserTypingMessages *bool `access:"experimental,write_restrictable"` - EnableChannelViewedMessages *bool `access:"experimental,write_restrictable"` - EnableUserStatuses *bool `access:"write_restrictable"` - ExperimentalEnableAuthenticationTransfer *bool `access:"experimental,write_restrictable"` - ClusterLogTimeoutMilliseconds *int `access:"write_restrictable"` + TimeBetweenUserTypingUpdatesMilliseconds *int64 `access:"experimental,write_restrictable,cloud_restrictable"` + EnablePostSearch *bool `access:"write_restrictable,cloud_restrictable"` + MinimumHashtagLength *int `access:"environment,write_restrictable,cloud_restrictable"` + EnableUserTypingMessages *bool `access:"experimental,write_restrictable,cloud_restrictable"` + EnableChannelViewedMessages *bool `access:"experimental,write_restrictable,cloud_restrictable"` + EnableUserStatuses *bool `access:"write_restrictable,cloud_restrictable"` + ExperimentalEnableAuthenticationTransfer *bool `access:"experimental,write_restrictable,cloud_restrictable"` + ClusterLogTimeoutMilliseconds *int `access:"write_restrictable,cloud_restrictable"` CloseUnusedDirectMessages *bool `access:"experimental"` EnablePreviewFeatures *bool `access:"experimental"` EnableTutorial *bool `access:"experimental"` @@ -332,10 +336,10 @@ type ServiceSettings struct { EnableAPITeamDeletion *bool EnableAPIUserDeletion *bool ExperimentalEnableHardenedMode *bool `access:"experimental"` - DisableLegacyMFA *bool `access:"write_restrictable"` - ExperimentalStrictCSRFEnforcement *bool `access:"experimental,write_restrictable"` + DisableLegacyMFA *bool `access:"write_restrictable,cloud_restrictable"` + ExperimentalStrictCSRFEnforcement *bool `access:"experimental,write_restrictable,cloud_restrictable"` EnableEmailInvitations *bool `access:"authentication"` - DisableBotsWhenOwnerIsDeactivated *bool `access:"integrations,write_restrictable"` + DisableBotsWhenOwnerIsDeactivated *bool `access:"integrations,write_restrictable,cloud_restrictable"` EnableBotAccountCreation *bool `access:"integrations"` EnableSVGs *bool `access:"site"` EnableLatex *bool `access:"site"` @@ -343,6 +347,9 @@ type ServiceSettings struct { EnableLocalMode *bool LocalModeSocketLocation *string EnableAWSMetering *bool + SplitKey *string `access:"environment,write_restrictable"` + FeatureFlagSyncIntervalSeconds *int `access:"environment,write_restrictable"` + DebugSplit *bool `access:"environment,write_restrictable"` ThreadAutoFollow *bool `access:"experimental"` ManagedResourcePaths *string `access:"environment,write_restrictable,cloud_restrictable"` } @@ -763,6 +770,18 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.EnableAWSMetering = NewBool(false) } + if s.SplitKey == nil { + s.SplitKey = NewString("") + } + + if s.FeatureFlagSyncIntervalSeconds == nil { + s.FeatureFlagSyncIntervalSeconds = NewInt(30) + } + + if s.DebugSplit == nil { + s.DebugSplit = NewBool(false) + } + if s.ThreadAutoFollow == nil { s.ThreadAutoFollow = NewBool(true) } @@ -774,20 +793,20 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { type ClusterSettings struct { Enable *bool `access:"environment,write_restrictable"` - ClusterName *string `access:"environment,write_restrictable"` - OverrideHostname *string `access:"environment,write_restrictable"` - NetworkInterface *string `access:"environment,write_restrictable"` - BindAddress *string `access:"environment,write_restrictable"` - AdvertiseAddress *string `access:"environment,write_restrictable"` - UseIpAddress *bool `access:"environment,write_restrictable"` - UseExperimentalGossip *bool `access:"environment,write_restrictable"` - EnableExperimentalGossipEncryption *bool `access:"environment,write_restrictable"` - ReadOnlyConfig *bool `access:"environment,write_restrictable"` - GossipPort *int `access:"environment,write_restrictable"` - StreamingPort *int `access:"environment,write_restrictable"` - MaxIdleConns *int `access:"environment,write_restrictable"` - MaxIdleConnsPerHost *int `access:"environment,write_restrictable"` - IdleConnTimeoutMilliseconds *int `access:"environment,write_restrictable"` + ClusterName *string `access:"environment,write_restrictable,cloud_restrictable"` + OverrideHostname *string `access:"environment,write_restrictable,cloud_restrictable"` + NetworkInterface *string `access:"environment,write_restrictable,cloud_restrictable"` + BindAddress *string `access:"environment,write_restrictable,cloud_restrictable"` + AdvertiseAddress *string `access:"environment,write_restrictable,cloud_restrictable"` + UseIpAddress *bool `access:"environment,write_restrictable,cloud_restrictable"` + UseExperimentalGossip *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableExperimentalGossipEncryption *bool `access:"environment,write_restrictable,cloud_restrictable"` + ReadOnlyConfig *bool `access:"environment,write_restrictable,cloud_restrictable"` + GossipPort *int `access:"environment,write_restrictable,cloud_restrictable"` + StreamingPort *int `access:"environment,write_restrictable,cloud_restrictable"` + MaxIdleConns *int `access:"environment,write_restrictable,cloud_restrictable"` + MaxIdleConnsPerHost *int `access:"environment,write_restrictable,cloud_restrictable"` + IdleConnTimeoutMilliseconds *int `access:"environment,write_restrictable,cloud_restrictable"` } func (s *ClusterSettings) SetDefaults() { @@ -853,9 +872,9 @@ func (s *ClusterSettings) SetDefaults() { } type MetricsSettings struct { - Enable *bool `access:"environment,write_restrictable"` - BlockProfileRate *int `access:"environment,write_restrictable"` - ListenAddress *string `access:"environment,write_restrictable"` + Enable *bool `access:"environment,write_restrictable,cloud_restrictable"` + BlockProfileRate *int `access:"environment,write_restrictable,cloud_restrictable"` + ListenAddress *string `access:"environment,write_restrictable,cloud_restrictable"` } func (s *MetricsSettings) SetDefaults() { @@ -873,14 +892,15 @@ func (s *MetricsSettings) SetDefaults() { } type ExperimentalSettings struct { - ClientSideCertEnable *bool `access:"experimental"` - ClientSideCertCheck *string `access:"experimental"` - EnableClickToReply *bool `access:"experimental,write_restrictable"` - LinkMetadataTimeoutMilliseconds *int64 `access:"experimental,write_restrictable"` + ClientSideCertEnable *bool `access:"experimental,cloud_restrictable"` + ClientSideCertCheck *string `access:"experimental,cloud_restrictable"` + EnableClickToReply *bool `access:"experimental,write_restrictable,cloud_restrictable"` + LinkMetadataTimeoutMilliseconds *int64 `access:"experimental,write_restrictable,cloud_restrictable"` RestrictSystemAdmin *bool `access:"experimental,write_restrictable"` - UseNewSAMLLibrary *bool `access:"experimental"` + UseNewSAMLLibrary *bool `access:"experimental,cloud_restrictable"` CloudUserLimit *int64 `access:"experimental,write_restrictable"` CloudBilling *bool `access:"experimental,write_restrictable"` + EnableSharedChannels *bool `access:"experimental"` } func (s *ExperimentalSettings) SetDefaults() { @@ -916,10 +936,14 @@ func (s *ExperimentalSettings) SetDefaults() { if s.UseNewSAMLLibrary == nil { s.UseNewSAMLLibrary = NewBool(false) } + + if s.EnableSharedChannels == nil { + s.EnableSharedChannels = NewBool(false) + } } type AnalyticsSettings struct { - MaxUsersForStatistics *int `access:"write_restrictable"` + MaxUsersForStatistics *int `access:"write_restrictable,cloud_restrictable"` } func (s *AnalyticsSettings) SetDefaults() { @@ -1026,22 +1050,22 @@ func (s *Office365Settings) SSOSettings() *SSOSettings { } type SqlSettings struct { - DriverName *string `access:"environment,write_restrictable"` - DataSource *string `access:"environment,write_restrictable"` - DataSourceReplicas []string `access:"environment,write_restrictable"` - DataSourceSearchReplicas []string `access:"environment,write_restrictable"` - MaxIdleConns *int `access:"environment,write_restrictable"` - ConnMaxLifetimeMilliseconds *int `access:"environment,write_restrictable"` - MaxOpenConns *int `access:"environment,write_restrictable"` - Trace *bool `access:"environment,write_restrictable"` - AtRestEncryptKey *string `access:"environment,write_restrictable"` - QueryTimeout *int `access:"environment,write_restrictable"` - DisableDatabaseSearch *bool `access:"environment,write_restrictable"` + DriverName *string `access:"environment,write_restrictable,cloud_restrictable"` + DataSource *string `access:"environment,write_restrictable,cloud_restrictable"` + DataSourceReplicas []string `access:"environment,write_restrictable,cloud_restrictable"` + DataSourceSearchReplicas []string `access:"environment,write_restrictable,cloud_restrictable"` + MaxIdleConns *int `access:"environment,write_restrictable,cloud_restrictable"` + ConnMaxLifetimeMilliseconds *int `access:"environment,write_restrictable,cloud_restrictable"` + MaxOpenConns *int `access:"environment,write_restrictable,cloud_restrictable"` + Trace *bool `access:"environment,write_restrictable,cloud_restrictable"` + AtRestEncryptKey *string `access:"environment,write_restrictable,cloud_restrictable"` + QueryTimeout *int `access:"environment,write_restrictable,cloud_restrictable"` + DisableDatabaseSearch *bool `access:"environment,write_restrictable,cloud_restrictable"` } func (s *SqlSettings) SetDefaults(isUpdate bool) { if s.DriverName == nil { - s.DriverName = NewString(DATABASE_DRIVER_MYSQL) + s.DriverName = NewString(DATABASE_DRIVER_POSTGRES) } if s.DataSource == nil { @@ -1092,17 +1116,17 @@ func (s *SqlSettings) SetDefaults(isUpdate bool) { } type LogSettings struct { - EnableConsole *bool `access:"environment,write_restrictable"` - ConsoleLevel *string `access:"environment,write_restrictable"` - ConsoleJson *bool `access:"environment,write_restrictable"` - EnableFile *bool `access:"environment,write_restrictable"` - FileLevel *string `access:"environment,write_restrictable"` - FileJson *bool `access:"environment,write_restrictable"` - FileLocation *string `access:"environment,write_restrictable"` - EnableWebhookDebugging *bool `access:"environment,write_restrictable"` - EnableDiagnostics *bool `access:"environment,write_restrictable"` - EnableSentry *bool `access:"environment,write_restrictable"` - AdvancedLoggingConfig *string `access:"environment,write_restrictable"` + EnableConsole *bool `access:"environment,write_restrictable,cloud_restrictable"` + ConsoleLevel *string `access:"environment,write_restrictable,cloud_restrictable"` + ConsoleJson *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableFile *bool `access:"environment,write_restrictable,cloud_restrictable"` + FileLevel *string `access:"environment,write_restrictable,cloud_restrictable"` + FileJson *bool `access:"environment,write_restrictable,cloud_restrictable"` + FileLocation *string `access:"environment,write_restrictable,cloud_restrictable"` + EnableWebhookDebugging *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableDiagnostics *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableSentry *bool `access:"environment,write_restrictable,cloud_restrictable"` + AdvancedLoggingConfig *string `access:"environment,write_restrictable,cloud_restrictable"` } func (s *LogSettings) SetDefaults() { @@ -1152,14 +1176,14 @@ func (s *LogSettings) SetDefaults() { } type ExperimentalAuditSettings struct { - FileEnabled *bool `access:"experimental,write_restrictable"` - FileName *string `access:"experimental,write_restrictable"` - FileMaxSizeMB *int `access:"experimental,write_restrictable"` - FileMaxAgeDays *int `access:"experimental,write_restrictable"` - FileMaxBackups *int `access:"experimental,write_restrictable"` - FileCompress *bool `access:"experimental,write_restrictable"` - FileMaxQueueSize *int `access:"experimental,write_restrictable"` - AdvancedLoggingConfig *string `access:"experimental,write_restrictable"` + FileEnabled *bool `access:"experimental,write_restrictable,cloud_restrictable"` + FileName *string `access:"experimental,write_restrictable,cloud_restrictable"` + FileMaxSizeMB *int `access:"experimental,write_restrictable,cloud_restrictable"` + FileMaxAgeDays *int `access:"experimental,write_restrictable,cloud_restrictable"` + FileMaxBackups *int `access:"experimental,write_restrictable,cloud_restrictable"` + FileCompress *bool `access:"experimental,write_restrictable,cloud_restrictable"` + FileMaxQueueSize *int `access:"experimental,write_restrictable,cloud_restrictable"` + AdvancedLoggingConfig *string `access:"experimental,write_restrictable,cloud_restrictable"` } func (s *ExperimentalAuditSettings) SetDefaults() { @@ -1197,14 +1221,14 @@ func (s *ExperimentalAuditSettings) SetDefaults() { } type NotificationLogSettings struct { - EnableConsole *bool `access:"write_restrictable"` - ConsoleLevel *string `access:"write_restrictable"` - ConsoleJson *bool `access:"write_restrictable"` - EnableFile *bool `access:"write_restrictable"` - FileLevel *string `access:"write_restrictable"` - FileJson *bool `access:"write_restrictable"` - FileLocation *string `access:"write_restrictable"` - AdvancedLoggingConfig *string `access:"write_restrictable"` + EnableConsole *bool `access:"write_restrictable,cloud_restrictable"` + ConsoleLevel *string `access:"write_restrictable,cloud_restrictable"` + ConsoleJson *bool `access:"write_restrictable,cloud_restrictable"` + EnableFile *bool `access:"write_restrictable,cloud_restrictable"` + FileLevel *string `access:"write_restrictable,cloud_restrictable"` + FileJson *bool `access:"write_restrictable,cloud_restrictable"` + FileLocation *string `access:"write_restrictable,cloud_restrictable"` + AdvancedLoggingConfig *string `access:"write_restrictable,cloud_restrictable"` } func (s *NotificationLogSettings) SetDefaults() { @@ -1272,25 +1296,25 @@ func (s *PasswordSettings) SetDefaults() { } type FileSettings struct { - EnableFileAttachments *bool `access:"site"` - EnableMobileUpload *bool `access:"site"` - EnableMobileDownload *bool `access:"site"` - MaxFileSize *int64 `access:"environment"` - DriverName *string `access:"environment,write_restrictable"` - Directory *string `access:"environment,write_restrictable"` - EnablePublicLink *bool `access:"site"` - PublicLinkSalt *string `access:"site"` - InitialFont *string `access:"environment"` - AmazonS3AccessKeyId *string `access:"environment,write_restrictable"` - AmazonS3SecretAccessKey *string `access:"environment,write_restrictable"` - AmazonS3Bucket *string `access:"environment,write_restrictable"` - AmazonS3PathPrefix *string `access:"environment,write_restrictable"` - AmazonS3Region *string `access:"environment,write_restrictable"` - AmazonS3Endpoint *string `access:"environment,write_restrictable"` - AmazonS3SSL *bool `access:"environment,write_restrictable"` - AmazonS3SignV2 *bool `access:"environment,write_restrictable"` - AmazonS3SSE *bool `access:"environment,write_restrictable"` - AmazonS3Trace *bool `access:"environment,write_restrictable"` + EnableFileAttachments *bool `access:"site,cloud_restrictable"` + EnableMobileUpload *bool `access:"site,cloud_restrictable"` + EnableMobileDownload *bool `access:"site,cloud_restrictable"` + MaxFileSize *int64 `access:"environment,cloud_restrictable"` + DriverName *string `access:"environment,write_restrictable,cloud_restrictable"` + Directory *string `access:"environment,write_restrictable,cloud_restrictable"` + EnablePublicLink *bool `access:"site,cloud_restrictable"` + PublicLinkSalt *string `access:"site,cloud_restrictable"` + InitialFont *string `access:"environment,cloud_restrictable"` + AmazonS3AccessKeyId *string `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3SecretAccessKey *string `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3Bucket *string `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3PathPrefix *string `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3Region *string `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3Endpoint *string `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3SSL *bool `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3SignV2 *bool `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3SSE *bool `access:"environment,write_restrictable,cloud_restrictable"` + AmazonS3Trace *bool `access:"environment,write_restrictable,cloud_restrictable"` } func (s *FileSettings) SetDefaults(isUpdate bool) { @@ -1388,16 +1412,16 @@ type EmailSettings struct { UseChannelInEmailNotifications *bool `access:"experimental"` RequireEmailVerification *bool `access:"authentication"` FeedbackName *string `access:"site"` - FeedbackEmail *string `access:"site"` - ReplyToAddress *string `access:"site"` + FeedbackEmail *string `access:"site,cloud_restrictable"` + ReplyToAddress *string `access:"site,cloud_restrictable"` FeedbackOrganization *string `access:"site"` - EnableSMTPAuth *bool `access:"environment,write_restrictable"` - SMTPUsername *string `access:"environment,write_restrictable"` - SMTPPassword *string `access:"environment,write_restrictable"` - SMTPServer *string `access:"environment,write_restrictable"` - SMTPPort *string `access:"environment,write_restrictable"` - SMTPServerTimeout *int - ConnectionSecurity *string `access:"environment,write_restrictable"` + EnableSMTPAuth *bool `access:"environment,write_restrictable,cloud_restrictable"` + SMTPUsername *string `access:"environment,write_restrictable,cloud_restrictable"` + SMTPPassword *string `access:"environment,write_restrictable,cloud_restrictable"` + SMTPServer *string `access:"environment,write_restrictable,cloud_restrictable"` + SMTPPort *string `access:"environment,write_restrictable,cloud_restrictable"` + SMTPServerTimeout *int `access:"cloud_restrictable"` + ConnectionSecurity *string `access:"environment,write_restrictable,cloud_restrictable"` SendPushNotifications *bool `access:"environment"` PushNotificationServer *string `access:"environment"` PushNotificationContents *string `access:"site"` @@ -1406,7 +1430,7 @@ type EmailSettings struct { EmailBatchingBufferSize *int `access:"experimental"` EmailBatchingInterval *int `access:"experimental"` EnablePreviewModeBanner *bool `access:"site"` - SkipServerCertificateVerification *bool `access:"environment,write_restrictable"` + SkipServerCertificateVerification *bool `access:"environment,write_restrictable,cloud_restrictable"` EmailNotificationContentsType *string `access:"site"` LoginButtonColor *string `access:"experimental"` LoginButtonBorderColor *string `access:"experimental"` @@ -1556,13 +1580,13 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) { } type RateLimitSettings struct { - Enable *bool `access:"environment,write_restrictable"` - PerSec *int `access:"environment,write_restrictable"` - MaxBurst *int `access:"environment,write_restrictable"` - MemoryStoreSize *int `access:"environment,write_restrictable"` - VaryByRemoteAddr *bool `access:"environment,write_restrictable"` - VaryByUser *bool `access:"environment,write_restrictable"` - VaryByHeader string `access:"environment,write_restrictable"` + Enable *bool `access:"environment,write_restrictable,cloud_restrictable"` + PerSec *int `access:"environment,write_restrictable,cloud_restrictable"` + MaxBurst *int `access:"environment,write_restrictable,cloud_restrictable"` + MemoryStoreSize *int `access:"environment,write_restrictable,cloud_restrictable"` + VaryByRemoteAddr *bool `access:"environment,write_restrictable,cloud_restrictable"` + VaryByUser *bool `access:"environment,write_restrictable,cloud_restrictable"` + VaryByHeader string `access:"environment,write_restrictable,cloud_restrictable"` } func (s *RateLimitSettings) SetDefaults() { @@ -1607,11 +1631,11 @@ func (s *PrivacySettings) setDefaults() { } type SupportSettings struct { - TermsOfServiceLink *string `access:"site,write_restrictable"` - PrivacyPolicyLink *string `access:"site,write_restrictable"` - AboutLink *string `access:"site,write_restrictable"` - HelpLink *string `access:"site,write_restrictable"` - ReportAProblemLink *string `access:"site,write_restrictable"` + TermsOfServiceLink *string `access:"site,write_restrictable,cloud_restrictable"` + PrivacyPolicyLink *string `access:"site,write_restrictable,cloud_restrictable"` + AboutLink *string `access:"site,write_restrictable,cloud_restrictable"` + HelpLink *string `access:"site,write_restrictable,cloud_restrictable"` + ReportAProblemLink *string `access:"site,write_restrictable,cloud_restrictable"` SupportEmail *string `access:"site"` CustomTermsOfServiceEnabled *bool `access:"compliance"` CustomTermsOfServiceReAcceptancePeriod *int `access:"compliance"` @@ -1938,12 +1962,12 @@ func (s *TeamSettings) SetDefaults() { } type ClientRequirements struct { - AndroidLatestVersion string `access:"write_restrictable"` - AndroidMinVersion string `access:"write_restrictable"` - DesktopLatestVersion string `access:"write_restrictable"` - DesktopMinVersion string `access:"write_restrictable"` - IosLatestVersion string `access:"write_restrictable"` - IosMinVersion string `access:"write_restrictable"` + AndroidLatestVersion string `access:"write_restrictable,cloud_restrictable"` + AndroidMinVersion string `access:"write_restrictable,cloud_restrictable"` + DesktopLatestVersion string `access:"write_restrictable,cloud_restrictable"` + DesktopMinVersion string `access:"write_restrictable,cloud_restrictable"` + IosLatestVersion string `access:"write_restrictable,cloud_restrictable"` + IosMinVersion string `access:"write_restrictable,cloud_restrictable"` } type LdapSettings struct { @@ -2189,6 +2213,7 @@ type SamlSettings struct { Enable *bool `access:"authentication"` EnableSyncWithLdap *bool `access:"authentication"` EnableSyncWithLdapIncludeAuth *bool `access:"authentication"` + IgnoreGuestsLdapSync *bool `access:"authentication"` Verify *bool `access:"authentication"` Encrypt *bool `access:"authentication"` @@ -2243,6 +2268,10 @@ func (s *SamlSettings) SetDefaults() { s.EnableSyncWithLdapIncludeAuth = NewBool(false) } + if s.IgnoreGuestsLdapSync == nil { + s.IgnoreGuestsLdapSync = NewBool(false) + } + if s.EnableAdminAttribute == nil { s.EnableAdminAttribute = NewBool(false) } @@ -2367,9 +2396,9 @@ func (s *SamlSettings) SetDefaults() { } type NativeAppSettings struct { - AppDownloadLink *string `access:"site,write_restrictable"` - AndroidAppDownloadLink *string `access:"site,write_restrictable"` - IosAppDownloadLink *string `access:"site,write_restrictable"` + AppDownloadLink *string `access:"site,write_restrictable,cloud_restrictable"` + AndroidAppDownloadLink *string `access:"site,write_restrictable,cloud_restrictable"` + IosAppDownloadLink *string `access:"site,write_restrictable,cloud_restrictable"` } func (s *NativeAppSettings) SetDefaults() { @@ -2387,27 +2416,27 @@ func (s *NativeAppSettings) SetDefaults() { } type ElasticsearchSettings struct { - ConnectionUrl *string `access:"environment,write_restrictable"` - Username *string `access:"environment,write_restrictable"` - Password *string `access:"environment,write_restrictable"` - EnableIndexing *bool `access:"environment,write_restrictable"` - EnableSearching *bool `access:"environment,write_restrictable"` - EnableAutocomplete *bool `access:"environment,write_restrictable"` - Sniff *bool `access:"environment,write_restrictable"` - PostIndexReplicas *int `access:"environment,write_restrictable"` - PostIndexShards *int `access:"environment,write_restrictable"` - ChannelIndexReplicas *int `access:"environment,write_restrictable"` - ChannelIndexShards *int `access:"environment,write_restrictable"` - UserIndexReplicas *int `access:"environment,write_restrictable"` - UserIndexShards *int `access:"environment,write_restrictable"` - AggregatePostsAfterDays *int `access:"environment,write_restrictable"` - PostsAggregatorJobStartTime *string `access:"environment,write_restrictable"` - IndexPrefix *string `access:"environment,write_restrictable"` - LiveIndexingBatchSize *int `access:"environment,write_restrictable"` - BulkIndexingTimeWindowSeconds *int `access:"environment,write_restrictable"` - RequestTimeoutSeconds *int `access:"environment,write_restrictable"` - SkipTLSVerification *bool `access:"environment,write_restrictable"` - Trace *string `access:"environment,write_restrictable"` + ConnectionUrl *string `access:"environment,write_restrictable,cloud_restrictable"` + Username *string `access:"environment,write_restrictable,cloud_restrictable"` + Password *string `access:"environment,write_restrictable,cloud_restrictable"` + EnableIndexing *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableSearching *bool `access:"environment,write_restrictable,cloud_restrictable"` + EnableAutocomplete *bool `access:"environment,write_restrictable,cloud_restrictable"` + Sniff *bool `access:"environment,write_restrictable,cloud_restrictable"` + PostIndexReplicas *int `access:"environment,write_restrictable,cloud_restrictable"` + PostIndexShards *int `access:"environment,write_restrictable,cloud_restrictable"` + ChannelIndexReplicas *int `access:"environment,write_restrictable,cloud_restrictable"` + ChannelIndexShards *int `access:"environment,write_restrictable,cloud_restrictable"` + UserIndexReplicas *int `access:"environment,write_restrictable,cloud_restrictable"` + UserIndexShards *int `access:"environment,write_restrictable,cloud_restrictable"` + AggregatePostsAfterDays *int `access:"environment,write_restrictable,cloud_restrictable"` + PostsAggregatorJobStartTime *string `access:"environment,write_restrictable,cloud_restrictable"` + IndexPrefix *string `access:"environment,write_restrictable,cloud_restrictable"` + LiveIndexingBatchSize *int `access:"environment,write_restrictable,cloud_restrictable"` + BulkIndexingTimeWindowSeconds *int `access:"environment,write_restrictable,cloud_restrictable"` + RequestTimeoutSeconds *int `access:"environment,write_restrictable,cloud_restrictable"` + SkipTLSVerification *bool `access:"environment,write_restrictable,cloud_restrictable"` + Trace *string `access:"environment,write_restrictable,cloud_restrictable"` } func (s *ElasticsearchSettings) SetDefaults() { @@ -2557,8 +2586,8 @@ func (s *DataRetentionSettings) SetDefaults() { } type JobSettings struct { - RunJobs *bool `access:"write_restrictable"` - RunScheduler *bool `access:"write_restrictable"` + RunJobs *bool `access:"write_restrictable,cloud_restrictable"` + RunScheduler *bool `access:"write_restrictable,cloud_restrictable"` } func (s *JobSettings) SetDefaults() { @@ -2571,25 +2600,35 @@ func (s *JobSettings) SetDefaults() { } } +type CloudSettings struct { + CWSUrl *string `access:"environment,write_restrictable"` +} + +func (s *CloudSettings) SetDefaults() { + if s.CWSUrl == nil { + s.CWSUrl = NewString(CLOUD_SETTINGS_DEFAULT_CWS_URL) + } +} + type PluginState struct { Enable bool } type PluginSettings struct { - Enable *bool `access:"plugins"` - EnableUploads *bool `access:"plugins,write_restrictable"` - AllowInsecureDownloadUrl *bool `access:"plugins,write_restrictable"` - EnableHealthCheck *bool `access:"plugins,write_restrictable"` - Directory *string `access:"plugins,write_restrictable"` - ClientDirectory *string `access:"plugins,write_restrictable"` + Enable *bool `access:"plugins,write_restrictable"` + EnableUploads *bool `access:"plugins,write_restrictable,cloud_restrictable"` + AllowInsecureDownloadUrl *bool `access:"plugins,write_restrictable,cloud_restrictable"` + EnableHealthCheck *bool `access:"plugins,write_restrictable,cloud_restrictable"` + Directory *string `access:"plugins,write_restrictable,cloud_restrictable"` + ClientDirectory *string `access:"plugins,write_restrictable,cloud_restrictable"` Plugins map[string]map[string]interface{} `access:"plugins"` PluginStates map[string]*PluginState `access:"plugins"` - EnableMarketplace *bool `access:"plugins"` - EnableRemoteMarketplace *bool `access:"plugins"` - AutomaticPrepackagedPlugins *bool `access:"plugins"` - RequirePluginSignature *bool `access:"plugins"` - MarketplaceUrl *string `access:"plugins"` - SignaturePublicKeyFiles []string `access:"plugins"` + EnableMarketplace *bool `access:"plugins,write_restrictable,cloud_restrictable"` + EnableRemoteMarketplace *bool `access:"plugins,write_restrictable,cloud_restrictable"` + AutomaticPrepackagedPlugins *bool `access:"plugins,write_restrictable,cloud_restrictable"` + RequirePluginSignature *bool `access:"plugins,write_restrictable,cloud_restrictable"` + MarketplaceUrl *string `access:"plugins,write_restrictable,cloud_restrictable"` + SignaturePublicKeyFiles []string `access:"plugins,write_restrictable,cloud_restrictable"` } func (s *PluginSettings) SetDefaults(ls LogSettings) { @@ -2630,6 +2669,16 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) { s.PluginStates["com.mattermost.nps"] = &PluginState{Enable: ls.EnableDiagnostics == nil || *ls.EnableDiagnostics} } + if s.PluginStates["com.mattermost.plugin-incident-management"] == nil && BuildEnterpriseReady == "true" { + // Enable the incident management plugin by default + s.PluginStates["com.mattermost.plugin-incident-management"] = &PluginState{Enable: true} + } + + if s.PluginStates["com.mattermost.plugin-channel-export"] == nil && BuildEnterpriseReady == "true" { + // Enable the channel export plugin by default + s.PluginStates["com.mattermost.plugin-channel-export"] = &PluginState{Enable: true} + } + if s.EnableMarketplace == nil { s.EnableMarketplace = NewBool(PLUGIN_SETTINGS_DEFAULT_ENABLE_MARKETPLACE) } @@ -2808,7 +2857,9 @@ func (s *ImageProxySettings) SetDefaults(ss ServiceSettings) { type ConfigFunc func() *Config +const ConfigAccessTagType = "access" const ConfigAccessTagWriteRestrictable = "write_restrictable" +const ConfigAccessTagCloudRestrictable = "cloud_restrictable" // Config fields support the 'access' tag with the following values corresponding to the suffix of the associated // PERMISSION_SYSCONSOLE_*_* permission Id: 'about', 'reporting', 'user_management_users', @@ -2822,6 +2873,9 @@ const ConfigAccessTagWriteRestrictable = "write_restrictable" // // PERMISSION_MANAGE_SYSTEM always grants read access. // +// Config values with the access tag 'cloud_restrictable' mean that are marked to be filtered when it's used in a cloud licensed +// environment with ExperimentalSettings.RestrictedSystemAdmin set to true. +// // Example: // type HairSettings struct { // // Colour is writeable with either PERMISSION_SYSCONSOLE_WRITE_REPORTING or PERMISSION_SYSCONSOLE_WRITE_USER_MANAGEMENT_GROUPS. @@ -2874,6 +2928,8 @@ type Config struct { DisplaySettings DisplaySettings GuestAccountsSettings GuestAccountsSettings ImageProxySettings ImageProxySettings + CloudSettings CloudSettings + FeatureFlags *FeatureFlags `json:",omitempty"` } func (o *Config) Clone() *Config { @@ -2889,6 +2945,18 @@ func (o *Config) ToJson() string { return string(b) } +func (o *Config) ToJsonFiltered(tagType, tagValue string) string { + filteredConfigMap := structToMapFilteredByTag(*o, tagType, tagValue) + for key, value := range filteredConfigMap { + v, ok := value.(map[string]interface{}) + if ok && len(v) == 0 { + delete(filteredConfigMap, key) + } + } + b, _ := json.Marshal(filteredConfigMap) + return string(b) +} + func (o *Config) GetSSOService(service string) *SSOSettings { switch service { case SERVICE_GITLAB: @@ -2960,6 +3028,11 @@ func (o *Config) SetDefaults() { o.DisplaySettings.SetDefaults() o.GuestAccountsSettings.SetDefaults() o.ImageProxySettings.SetDefaults(o.ServiceSettings) + o.CloudSettings.SetDefaults() + if o.FeatureFlags == nil { + o.FeatureFlags = &FeatureFlags{} + o.FeatureFlags.SetDefaults() + } } func (o *Config) IsValid() *AppError { @@ -3588,4 +3661,66 @@ func (o *Config) Sanitize() { if o.ServiceSettings.GfycatApiSecret != nil && len(*o.ServiceSettings.GfycatApiSecret) > 0 { *o.ServiceSettings.GfycatApiSecret = FAKE_SETTING } + + *o.ServiceSettings.SplitKey = FAKE_SETTING +} + +// structToMapFilteredByTag converts a struct into a map removing those fields that has the tag passed +// as argument +func structToMapFilteredByTag(t interface{}, typeOfTag, filterTag string) map[string]interface{} { + defer func() { + if r := recover(); r != nil { + mlog.Error("Panicked in structToMapFilteredByTag. This should never happen.", mlog.Any("recover", r)) + } + }() + + val := reflect.ValueOf(t) + elemField := reflect.TypeOf(t) + + if val.Kind() != reflect.Struct { + return nil + } + + out := map[string]interface{}{} + + for i := 0; i < val.NumField(); i++ { + field := val.Field(i) + + structField := elemField.Field(i) + tagPermissions := strings.Split(structField.Tag.Get(typeOfTag), ",") + if isTagPresent(filterTag, tagPermissions) { + continue + } + + var value interface{} + + switch field.Kind() { + case reflect.Struct: + value = structToMapFilteredByTag(field.Interface(), typeOfTag, filterTag) + case reflect.Ptr: + indirectType := field.Elem() + if indirectType.Kind() == reflect.Struct { + value = structToMapFilteredByTag(indirectType.Interface(), typeOfTag, filterTag) + } else if indirectType.Kind() != reflect.Invalid { + value = indirectType.Interface() + } + default: + value = field.Interface() + } + + out[val.Type().Field(i).Name] = value + } + + return out +} + +func isTagPresent(tag string, tags []string) bool { + for _, val := range tags { + tagValue := strings.TrimSpace(val) + if tagValue != "" && tagValue == tag { + return true + } + } + + return false } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/feature_flags.go b/vendor/github.com/mattermost/mattermost-server/v5/model/feature_flags.go new file mode 100644 index 00000000..316c7ffb --- /dev/null +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/feature_flags.go @@ -0,0 +1,18 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package model + +type FeatureFlags struct { + // Exists only for unit and manual testing. + // When set to a value, will be returned by the ping endpoint. + TestFeature string + + // Toggle on and off scheduled jobs for cloud user limit emails see MM-29999 + CloudDelinquentEmailJobsEnabled bool +} + +func (f *FeatureFlags) SetDefaults() { + f.TestFeature = "off" + f.CloudDelinquentEmailJobsEnabled = false +} diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/file_info.go b/vendor/github.com/mattermost/mattermost-server/v5/model/file_info.go index aded5be9..c622b8f2 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/file_info.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/file_info.go @@ -4,14 +4,19 @@ package model import ( + "bytes" "encoding/json" "image" "image/gif" + "image/jpeg" "io" "mime" "net/http" "path/filepath" "strings" + + "github.com/disintegration/imaging" + "github.com/mattermost/mattermost-server/v5/mlog" ) const ( @@ -53,6 +58,7 @@ type FileInfo struct { Height int `json:"height,omitempty"` HasPreviewImage bool `json:"has_preview_image,omitempty"` MiniPreview *[]byte `json:"mini_preview"` // declared as *[]byte to avoid postgres/mysql differences in deserialization + Content string `json:"-"` } func (fi *FileInfo) ToJson() string { @@ -151,6 +157,19 @@ func NewInfo(name string) *FileInfo { return info } +func GenerateMiniPreviewImage(img image.Image) *[]byte { + preview := imaging.Resize(img, 16, 16, imaging.Lanczos) + + buf := new(bytes.Buffer) + + if err := jpeg.Encode(buf, preview, &jpeg.Options{Quality: 90}); err != nil { + mlog.Error("Unable to encode image as mini preview jpg", mlog.Err(err)) + return nil + } + data := buf.Bytes() + return &data +} + func GetInfoForBytes(name string, data io.ReadSeeker, size int) (*FileInfo, *AppError) { info := &FileInfo{ Name: name, diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/group.go b/vendor/github.com/mattermost/mattermost-server/v5/model/group.go index 2eda1184..49783c83 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/group.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/group.go @@ -157,7 +157,7 @@ func (group *Group) requiresRemoteId() bool { func (group *Group) IsValidForUpdate() *AppError { if !IsValidId(group.Id) { - return NewAppError("Group.IsValidForUpdate", "model.group.id.app_error", nil, "", http.StatusBadRequest) + return NewAppError("Group.IsValidForUpdate", "app.group.id.app_error", nil, "", http.StatusBadRequest) } if group.CreateAt == 0 { return NewAppError("Group.IsValidForUpdate", "model.group.create_at.app_error", nil, "", http.StatusBadRequest) diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/integration_action.go b/vendor/github.com/mattermost/mattermost-server/v5/model/integration_action.go index 3f362d64..a572c9de 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/integration_action.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/integration_action.go @@ -16,6 +16,7 @@ import ( "io" "math/big" "net/http" + "reflect" "strconv" "strings" ) @@ -124,13 +125,19 @@ func (p *PostAction) Equals(input *PostAction) bool { for key, value := range p.Integration.Context { inputValue, ok := input.Integration.Context[key] - if !ok { return false } - if value != inputValue { - return false + switch inputValue.(type) { + case string, bool, int, float64: + if value != inputValue { + return false + } + default: + if !reflect.DeepEqual(value, inputValue) { + return false + } } } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/job.go b/vendor/github.com/mattermost/mattermost-server/v5/model/job.go index a4bb30a1..072bfb2b 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/job.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/job.go @@ -22,6 +22,7 @@ const ( JOB_TYPE_EXPIRY_NOTIFY = "expiry_notify" JOB_TYPE_PRODUCT_NOTICES = "product_notices" JOB_TYPE_ACTIVE_USERS = "active_users" + JOB_TYPE_CLOUD = "cloud" JOB_STATUS_PENDING = "pending" JOB_STATUS_IN_PROGRESS = "in_progress" @@ -65,6 +66,7 @@ func (j *Job) IsValid() *AppError { case JOB_TYPE_PRODUCT_NOTICES: case JOB_TYPE_EXPIRY_NOTIFY: case JOB_TYPE_ACTIVE_USERS: + case JOB_TYPE_CLOUD: default: return NewAppError("Job.IsValid", "model.job.is_valid.type.app_error", nil, "id="+j.Id, http.StatusBadRequest) } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/ldap.go b/vendor/github.com/mattermost/mattermost-server/v5/model/ldap.go index 4e19c5b1..1262dfb8 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/ldap.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/ldap.go @@ -4,7 +4,7 @@ package model const ( - USER_AUTH_SERVICE_LDAP = "ldap" - LDAP_PUBIC_CERTIFICATE_NAME = "ldap-public.crt" - LDAP_PRIVATE_KEY_NAME = "ldap-private.key" + USER_AUTH_SERVICE_LDAP = "ldap" + LDAP_PUBLIC_CERTIFICATE_NAME = "ldap-public.crt" + LDAP_PRIVATE_KEY_NAME = "ldap-private.key" ) diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/marketplace_plugin.go b/vendor/github.com/mattermost/mattermost-server/v5/model/marketplace_plugin.go index 47644513..cccfb7f6 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/marketplace_plugin.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/marketplace_plugin.go @@ -80,7 +80,9 @@ type MarketplacePluginFilter struct { ServerVersion string BuildEnterpriseReady bool EnterprisePlugins bool + Cloud bool LocalOnly bool + Platform string } // ApplyToURL modifies the given url to include query string parameters for the request. @@ -94,7 +96,9 @@ func (filter *MarketplacePluginFilter) ApplyToURL(u *url.URL) { q.Add("server_version", filter.ServerVersion) q.Add("build_enterprise_ready", strconv.FormatBool(filter.BuildEnterpriseReady)) q.Add("enterprise_plugins", strconv.FormatBool(filter.EnterprisePlugins)) + q.Add("cloud", strconv.FormatBool(filter.Cloud)) q.Add("local_only", strconv.FormatBool(filter.LocalOnly)) + q.Add("platform", filter.Platform) u.RawQuery = q.Encode() } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/migration.go b/vendor/github.com/mattermost/mattermost-server/v5/model/migration.go index 2e7a0f71..f552d168 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/migration.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/migration.go @@ -21,4 +21,6 @@ const ( MIGRATION_KEY_ADD_SYSTEM_CONSOLE_PERMISSIONS = "add_system_console_permissions" MIGRATION_KEY_SIDEBAR_CATEGORIES_PHASE_2 = "migration_sidebar_categories_phase_2" MIGRATION_KEY_ADD_CONVERT_CHANNEL_PERMISSIONS = "add_convert_channel_permissions" + MIGRATION_KEY_ADD_SYSTEM_ROLES_PERMISSIONS = "add_system_roles_permissions" + MIGRATION_KEY_ADD_MANAGE_SHARED_CHANNEL_PERMISSIONS = "manage_shared_channel_permissions" ) diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/permission.go b/vendor/github.com/mattermost/mattermost-server/v5/model/permission.go index cf05c281..d982962f 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/permission.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/permission.go @@ -99,6 +99,7 @@ var PERMISSION_USE_CHANNEL_MENTIONS *Permission var PERMISSION_USE_GROUP_MENTIONS *Permission var PERMISSION_READ_OTHER_USERS_TEAMS *Permission var PERMISSION_EDIT_BRAND *Permission +var PERMISSION_MANAGE_SHARED_CHANNELS *Permission var PERMISSION_SYSCONSOLE_READ_ABOUT *Permission var PERMISSION_SYSCONSOLE_WRITE_ABOUT *Permission @@ -121,6 +122,9 @@ var PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_CHANNELS *Permission var PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_PERMISSIONS *Permission var PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_PERMISSIONS *Permission +var PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_SYSTEM_ROLES *Permission +var PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_SYSTEM_ROLES *Permission + var PERMISSION_SYSCONSOLE_READ_ENVIRONMENT *Permission var PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT *Permission @@ -516,6 +520,12 @@ func initializePermissions() { "authentication.permissions.delete_others_posts.description", PermissionScopeChannel, } + PERMISSION_MANAGE_SHARED_CHANNELS = &Permission{ + "manage_shared_channels", + "authentication.permissions.manage_shared_channels.name", + "authentication.permissions.manage_shared_channels.description", + PermissionScopeSystem, + } PERMISSION_REMOVE_USER_FROM_TEAM = &Permission{ "remove_user_from_team", "authentication.permissions.remove_user_from_team.name", @@ -750,6 +760,18 @@ func initializePermissions() { "authentication.permissions.use_group_mentions.description", PermissionScopeSystem, } + PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_SYSTEM_ROLES = &Permission{ + "sysconsole_read_user_management_system_roles", + "authentication.permissions.use_group_mentions.name", + "authentication.permissions.use_group_mentions.description", + PermissionScopeSystem, + } + PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_SYSTEM_ROLES = &Permission{ + "sysconsole_write_user_management_system_roles", + "authentication.permissions.use_group_mentions.name", + "authentication.permissions.use_group_mentions.description", + PermissionScopeSystem, + } PERMISSION_SYSCONSOLE_READ_ENVIRONMENT = &Permission{ "sysconsole_read_environment", "authentication.permissions.use_group_mentions.name", @@ -855,6 +877,7 @@ func initializePermissions() { PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_TEAMS, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_CHANNELS, PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_PERMISSIONS, + PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_SYSTEM_ROLES, PERMISSION_SYSCONSOLE_READ_ENVIRONMENT, PERMISSION_SYSCONSOLE_READ_SITE, PERMISSION_SYSCONSOLE_READ_AUTHENTICATION, @@ -872,6 +895,7 @@ func initializePermissions() { PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_TEAMS, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_CHANNELS, PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_PERMISSIONS, + PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_SYSTEM_ROLES, PERMISSION_SYSCONSOLE_WRITE_ENVIRONMENT, PERMISSION_SYSCONSOLE_WRITE_SITE, PERMISSION_SYSCONSOLE_WRITE_AUTHENTICATION, @@ -912,6 +936,7 @@ func initializePermissions() { PERMISSION_PROMOTE_GUEST, PERMISSION_DEMOTE_TO_GUEST, PERMISSION_EDIT_BRAND, + PERMISSION_MANAGE_SHARED_CHANNELS, } TeamScopedPermissions := []*Permission{ diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/role.go b/vendor/github.com/mattermost/mattermost-server/v5/model/role.go index e880a1d8..271e295b 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/role.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/role.go @@ -133,6 +133,7 @@ func init() { PERMISSION_SYSCONSOLE_READ_SITE.Id, PERMISSION_SYSCONSOLE_READ_AUTHENTICATION.Id, PERMISSION_SYSCONSOLE_READ_PLUGINS.Id, + PERMISSION_SYSCONSOLE_READ_COMPLIANCE.Id, PERMISSION_SYSCONSOLE_READ_INTEGRATIONS.Id, PERMISSION_SYSCONSOLE_READ_EXPERIMENTAL.Id, } @@ -482,15 +483,16 @@ func (r *Role) IsValidWithoutId() bool { return false } - for _, permission := range r.Permissions { - permissionValidated := false - for _, p := range append(AllPermissions, DeprecatedPermissions...) { + check := func(perms []*Permission, permission string) bool { + for _, p := range perms { if permission == p.Id { - permissionValidated = true - break + return true } } - + return false + } + for _, permission := range r.Permissions { + permissionValidated := check(AllPermissions, permission) || check(DeprecatedPermissions, permission) if !permissionValidated { return false } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/serialized_gen.go b/vendor/github.com/mattermost/mattermost-server/v5/model/serialized_gen.go index c64d88de..1f16f1cb 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/serialized_gen.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/serialized_gen.go @@ -1620,3 +1620,160 @@ func (z *User) Msgsize() (s int) { s += msgp.BoolSize + msgp.StringPrefixSize + len(z.MfaSecret) + msgp.Int64Size + msgp.BoolSize + msgp.StringPrefixSize + len(z.BotDescription) + msgp.Int64Size + msgp.StringPrefixSize + len(z.TermsOfServiceId) + msgp.Int64Size return } + +// DecodeMsg implements msgp.Decodable +func (z *UserMap) DecodeMsg(dc *msgp.Reader) (err error) { + var zb0003 uint32 + zb0003, err = dc.ReadMapHeader() + if err != nil { + err = msgp.WrapError(err) + return + } + if (*z) == nil { + (*z) = make(UserMap, zb0003) + } else if len((*z)) > 0 { + for key := range *z { + delete((*z), key) + } + } + for zb0003 > 0 { + zb0003-- + var zb0001 string + var zb0002 *User + zb0001, err = dc.ReadString() + if err != nil { + err = msgp.WrapError(err) + return + } + if dc.IsNil() { + err = dc.ReadNil() + if err != nil { + err = msgp.WrapError(err, zb0001) + return + } + zb0002 = nil + } else { + if zb0002 == nil { + zb0002 = new(User) + } + err = zb0002.DecodeMsg(dc) + if err != nil { + err = msgp.WrapError(err, zb0001) + return + } + } + (*z)[zb0001] = zb0002 + } + return +} + +// EncodeMsg implements msgp.Encodable +func (z UserMap) EncodeMsg(en *msgp.Writer) (err error) { + err = en.WriteMapHeader(uint32(len(z))) + if err != nil { + err = msgp.WrapError(err) + return + } + for zb0004, zb0005 := range z { + err = en.WriteString(zb0004) + if err != nil { + err = msgp.WrapError(err) + return + } + if zb0005 == nil { + err = en.WriteNil() + if err != nil { + return + } + } else { + err = zb0005.EncodeMsg(en) + if err != nil { + err = msgp.WrapError(err, zb0004) + return + } + } + } + return +} + +// MarshalMsg implements msgp.Marshaler +func (z UserMap) MarshalMsg(b []byte) (o []byte, err error) { + o = msgp.Require(b, z.Msgsize()) + o = msgp.AppendMapHeader(o, uint32(len(z))) + for zb0004, zb0005 := range z { + o = msgp.AppendString(o, zb0004) + if zb0005 == nil { + o = msgp.AppendNil(o) + } else { + o, err = zb0005.MarshalMsg(o) + if err != nil { + err = msgp.WrapError(err, zb0004) + return + } + } + } + return +} + +// UnmarshalMsg implements msgp.Unmarshaler +func (z *UserMap) UnmarshalMsg(bts []byte) (o []byte, err error) { + var zb0003 uint32 + zb0003, bts, err = msgp.ReadMapHeaderBytes(bts) + if err != nil { + err = msgp.WrapError(err) + return + } + if (*z) == nil { + (*z) = make(UserMap, zb0003) + } else if len((*z)) > 0 { + for key := range *z { + delete((*z), key) + } + } + for zb0003 > 0 { + var zb0001 string + var zb0002 *User + zb0003-- + zb0001, bts, err = msgp.ReadStringBytes(bts) + if err != nil { + err = msgp.WrapError(err) + return + } + if msgp.IsNil(bts) { + bts, err = msgp.ReadNilBytes(bts) + if err != nil { + return + } + zb0002 = nil + } else { + if zb0002 == nil { + zb0002 = new(User) + } + bts, err = zb0002.UnmarshalMsg(bts) + if err != nil { + err = msgp.WrapError(err, zb0001) + return + } + } + (*z)[zb0001] = zb0002 + } + o = bts + return +} + +// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message +func (z UserMap) Msgsize() (s int) { + s = msgp.MapHeaderSize + if z != nil { + for zb0004, zb0005 := range z { + _ = zb0005 + s += msgp.StringPrefixSize + len(zb0004) + if zb0005 == nil { + s += msgp.NilSize + } else { + s += zb0005.Msgsize() + } + } + } + return +} diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/system.go b/vendor/github.com/mattermost/mattermost-server/v5/model/system.go index f826276f..4e76c959 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/system.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/system.go @@ -31,6 +31,10 @@ const ( SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_500 = "warn_metric_number_of_active_users_500" SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_2M = "warn_metric_number_of_posts_2M" SYSTEM_WARN_METRIC_LAST_RUN_TIMESTAMP_KEY = "LastWarnMetricRunTimestamp" + AWS_METERING_REPORT_INTERVAL = 1 + AWS_METERING_DIMENSION_USAGE_HRS = "UsageHrs" + USER_LIMIT_OVERAGE_CYCLE_END_DATE = "UserLimitOverageCycleEndDate" + OVER_USER_LIMIT_FORGIVEN_COUNT = "OverUserLimitForgivenCount" ) const ( diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/thread.go b/vendor/github.com/mattermost/mattermost-server/v5/model/thread.go index 71bf74f4..ec091c00 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/thread.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/thread.go @@ -15,6 +15,42 @@ type Thread struct { Participants StringArray `json:"participants"` } +type ThreadResponse struct { + PostId string `json:"id"` + ReplyCount int64 `json:"reply_count"` + LastReplyAt int64 `json:"last_reply_at"` + LastViewedAt int64 `json:"last_viewed_at"` + Participants []*User `json:"participants"` + Post *Post `json:"post"` +} + +type Threads struct { + Total int64 `json:"total"` + Threads []*ThreadResponse `json:"threads"` +} + +type GetUserThreadsOpts struct { + // Page specifies which part of the results to return, by PageSize. Default = 0 + Page uint64 + + // PageSize specifies the size of the returned chunk of results. Default = 30 + PageSize uint64 + + // Extended will enrich the response with participant details. Default = false + Extended bool + + // Deleted will specify that even deleted threads should be returned (For mobile sync). Default = false + Deleted bool + + // Since filters the threads based on their LastUpdateAt timestamp. + Since uint64 +} + +func (o *Threads) ToJson() string { + b, _ := json.Marshal(o) + return string(b) +} + func (o *Thread) ToJson() string { b, _ := json.Marshal(o) return string(b) diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/user.go b/vendor/github.com/mattermost/mattermost-server/v5/model/user.go index 4e4d067c..dd4e2ba8 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/user.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/user.go @@ -98,6 +98,12 @@ type User struct { TermsOfServiceCreateAt int64 `db:"-" json:"terms_of_service_create_at,omitempty"` } +//msgp UserMap + +// UserMap is a map from a userId to a user object. +// It is used to generate methods which can be used for fast serialization/de-serialization. +type UserMap map[string]*User + type UserUpdate struct { Old *User New *User @@ -540,11 +546,11 @@ func (u *User) SanitizeInput(isAdmin bool) { if !isAdmin { u.AuthData = NewString("") u.AuthService = "" + u.EmailVerified = false } u.LastPasswordUpdate = 0 u.LastPictureUpdate = 0 u.FailedAttempts = 0 - u.EmailVerified = false u.MfaActive = false u.MfaSecret = "" } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/utils.go b/vendor/github.com/mattermost/mattermost-server/v5/model/utils.go index 9a7ab229..3aed19da 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/utils.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/utils.go @@ -516,7 +516,7 @@ func IsValidHttpUrl(rawUrl string) bool { return false } - if _, err := url.ParseRequestURI(rawUrl); err != nil { + if u, err := url.ParseRequestURI(rawUrl); err != nil || u.Scheme == "" || u.Host == "" { return false } diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/version.go b/vendor/github.com/mattermost/mattermost-server/v5/model/version.go index aba587f7..63145660 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/version.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/version.go @@ -13,6 +13,7 @@ import ( // It should be maintained in chronological order with most current // release at the front of the list. var versions = []string{ + "5.30.0", "5.29.0", "5.28.0", "5.27.0", diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_client.go b/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_client.go index 72ca4a8f..cd89e2d8 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_client.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_client.go @@ -35,7 +35,7 @@ const avgReadMsgSizeBytes = 1024 // WebSocketClient stores the necessary information required to // communicate with a WebSocket endpoint. // A client must read from PingTimeoutChannel, EventChannel and ResponseChannel to prevent -// deadlocks from occuring in the program. +// deadlocks from occurring in the program. type WebSocketClient struct { Url string // The location of the server like "ws://localhost:8065" ApiUrl string // The API location of the server like "ws://localhost:8065/api/v3" diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_message.go b/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_message.go index 281b50cf..a4f92f80 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_message.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/websocket_message.go @@ -57,6 +57,7 @@ const ( WEBSOCKET_EVENT_CONFIG_CHANGED = "config_changed" WEBSOCKET_EVENT_OPEN_DIALOG = "open_dialog" WEBSOCKET_EVENT_GUESTS_DEACTIVATED = "guests_deactivated" + WEBSOCKET_EVENT_USER_ACTIVATION_STATUS_CHANGE = "user_activation_status_change" WEBSOCKET_EVENT_RECEIVED_GROUP = "received_group" WEBSOCKET_EVENT_RECEIVED_GROUP_ASSOCIATED_TO_TEAM = "received_group_associated_to_team" WEBSOCKET_EVENT_RECEIVED_GROUP_NOT_ASSOCIATED_TO_TEAM = "received_group_not_associated_to_team" @@ -68,6 +69,7 @@ const ( WEBSOCKET_EVENT_SIDEBAR_CATEGORY_ORDER_UPDATED = "sidebar_category_order_updated" WEBSOCKET_WARN_METRIC_STATUS_RECEIVED = "warn_metric_status_received" WEBSOCKET_WARN_METRIC_STATUS_REMOVED = "warn_metric_status_removed" + WEBSOCKET_EVENT_CLOUD_PAYMENT_STATUS_UPDATED = "cloud_payment_status_updated" ) type WebSocketMessage interface { @@ -201,6 +203,22 @@ func (ev *WebSocketEvent) ToJson() string { return string(b) } +// Encode encodes the event to the given encoder. +func (ev *WebSocketEvent) Encode(enc *json.Encoder) error { + if ev.precomputedJSON != nil { + return enc.Encode(json.RawMessage( + fmt.Sprintf(`{"event": %s, "data": %s, "broadcast": %s, "seq": %d}`, ev.precomputedJSON.Event, ev.precomputedJSON.Data, ev.precomputedJSON.Broadcast, ev.Sequence), + )) + } + + return enc.Encode(webSocketEventJSON{ + ev.Event, + ev.Data, + ev.Broadcast, + ev.Sequence, + }) +} + func WebSocketEventFromJson(data io.Reader) *WebSocketEvent { var ev WebSocketEvent var o webSocketEventJSON |