model

package
v6.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: AGPL-3.0, Apache-2.0 Imports: 66 Imported by: 341

Documentation

Index

Constants

View Source
const (
	AccessTokenGrantType  = "authorization_code"
	AccessTokenType       = "bearer"
	RefreshTokenGrantType = "refresh_token"
)
View Source
const (
	AuthCodeExpireTime   = 60 * 10 // 10 minutes
	AuthCodeResponseType = "code"
	ImplicitResponseType = "token"
	DefaultScope         = "user"
)
View Source
const (
	BotDisplayNameMaxRunes   = UserFirstNameMaxRunes
	BotDescriptionMaxRunes   = 1024
	BotCreatorIdMaxRunes     = KeyValuePluginIdMaxRunes // UserId or PluginId
	BotWarnMetricBotUsername = "mattermost-advisor"
	BotSystemBotUsername     = "system-bot"
)
View Source
const (
	ChannelTypeOpen    ChannelType = "O"
	ChannelTypePrivate ChannelType = "P"
	ChannelTypeDirect  ChannelType = "D"
	ChannelTypeGroup   ChannelType = "G"

	ChannelGroupMaxUsers       = 8
	ChannelGroupMinUsers       = 3
	DefaultChannelName         = "town-square"
	ChannelDisplayNameMaxRunes = 64
	ChannelNameMinLength       = 1
	ChannelNameMaxLength       = 64
	ChannelHeaderMaxRunes      = 1024
	ChannelPurposeMaxRunes     = 250
	ChannelCacheSize           = 25000

	ChannelSortByUsername = "username"
	ChannelSortByStatus   = "status"
)
View Source
const (
	ChannelNotifyDefault            = "default"
	ChannelNotifyAll                = "all"
	ChannelNotifyMention            = "mention"
	ChannelNotifyNone               = "none"
	ChannelMarkUnreadAll            = "all"
	ChannelMarkUnreadMention        = "mention"
	IgnoreChannelMentionsDefault    = "default"
	IgnoreChannelMentionsOff        = "off"
	IgnoreChannelMentionsOn         = "on"
	IgnoreChannelMentionsNotifyProp = "ignore_channel_mentions"
)
View Source
const (
	// Each sidebar category has a 'type'. System categories are Channels, Favorites and DMs
	// All user-created categories will have type Custom
	SidebarCategoryChannels       SidebarCategoryType = "channels"
	SidebarCategoryDirectMessages SidebarCategoryType = "direct_messages"
	SidebarCategoryFavorites      SidebarCategoryType = "favorites"
	SidebarCategoryCustom         SidebarCategoryType = "custom"
	// Increment to use when adding/reordering things in the sidebar
	MinimalSidebarSortDistance = 10
	// Default Sort Orders for categories
	DefaultSidebarSortOrderFavorites = 0
	DefaultSidebarSortOrderChannels  = DefaultSidebarSortOrderFavorites + MinimalSidebarSortDistance
	DefaultSidebarSortOrderDMs       = DefaultSidebarSortOrderChannels + MinimalSidebarSortDistance
	// Sorting modes
	// default for all categories except DMs (behaves like manual)
	SidebarCategorySortDefault SidebarCategorySorting = ""
	// sort manually
	SidebarCategorySortManual SidebarCategorySorting = "manual"
	// sort by recency (default for DMs)
	SidebarCategorySortRecent SidebarCategorySorting = "recent"
	// sort by display name alphabetically
	SidebarCategorySortAlphabetical SidebarCategorySorting = "alpha"
)
View Source
const (
	HeaderRequestId          = "X-Request-ID"
	HeaderVersionId          = "X-Version-ID"
	HeaderClusterId          = "X-Cluster-ID"
	HeaderEtagServer         = "ETag"
	HeaderEtagClient         = "If-None-Match"
	HeaderForwarded          = "X-Forwarded-For"
	HeaderRealIP             = "X-Real-IP"
	HeaderForwardedProto     = "X-Forwarded-Proto"
	HeaderToken              = "token"
	HeaderCsrfToken          = "X-CSRF-Token"
	HeaderBearer             = "BEARER"
	HeaderAuth               = "Authorization"
	HeaderCloudToken         = "X-Cloud-Token"
	HeaderRemoteclusterToken = "X-RemoteCluster-Token"
	HeaderRemoteclusterId    = "X-RemoteCluster-Id"
	HeaderRequestedWith      = "X-Requested-With"
	HeaderRequestedWithXML   = "XMLHttpRequest"
	HeaderRange              = "Range"
	STATUS                   = "status"
	StatusOk                 = "OK"
	StatusFail               = "FAIL"
	StatusUnhealthy          = "UNHEALTHY"
	StatusRemove             = "REMOVE"

	ClientDir = "client"

	APIURLSuffixV1 = "/api/v1"
	APIURLSuffixV4 = "/api/v4"
	APIURLSuffixV5 = "/api/v5"
	APIURLSuffix   = APIURLSuffixV4
)
View Source
const (
	EventTypeFailedPayment         = "failed-payment"
	EventTypeFailedPaymentNoCard   = "failed-payment-no-card"
	EventTypeSendAdminWelcomeEmail = "send-admin-welcome-email"
	EventTypeTrialWillEnd          = "trial-will-end"
	EventTypeTrialEnded            = "trial-ended"
)
View Source
const (
	BillingSchemePerSeat    = BillingScheme("per_seat")
	BillingSchemeFlatFee    = BillingScheme("flat_fee")
	BillingSchemeSalesServe = BillingScheme("sales_serve")
)
View Source
const (
	RecurringIntervalYearly  = RecurringInterval("year")
	RecurringIntervalMonthly = RecurringInterval("month")
)
View Source
const (
	SubscriptionFamilyCloud  = SubscriptionFamily("cloud")
	SubscriptionFamilyOnPrem = SubscriptionFamily("on-prem")
)
View Source
const (
	CDSOfflineAfterMillis = 1000 * 60 * 30 // 30 minutes
	CDSTypeApp            = "mattermost_app"
)
View Source
const (
	CommandMethodPost = "P"
	CommandMethodGet  = "G"
	MinTriggerLength  = 1
	MaxTriggerLength  = 128
)
View Source
const (
	CommandResponseTypeInChannel = "in_channel"
	CommandResponseTypeEphemeral = "ephemeral"
)
View Source
const (
	ComplianceStatusCreated  = "created"
	ComplianceStatusRunning  = "running"
	ComplianceStatusFinished = "finished"
	ComplianceStatusFailed   = "failed"
	ComplianceStatusRemoved  = "removed"

	ComplianceTypeDaily = "daily"
	ComplianceTypeAdhoc = "adhoc"
)
View Source
const (
	ConnSecurityNone     = ""
	ConnSecurityPlain    = "PLAIN"
	ConnSecurityTLS      = "TLS"
	ConnSecurityStarttls = "STARTTLS"

	ImageDriverLocal = "local"
	ImageDriverS3    = "amazons3"

	DatabaseDriverMysql    = "mysql"
	DatabaseDriverPostgres = "postgres"

	SearchengineElasticsearch = "elasticsearch"

	MinioAccessKey = "minioaccesskey"
	MinioSecretKey = "miniosecretkey"
	MinioBucket    = "mattermost-test"

	PasswordMaximumLength = 64
	PasswordMinimumLength = 5

	ServiceGitlab    = "gitlab"
	ServiceGoogle    = "google"
	ServiceOffice365 = "office365"
	ServiceOpenid    = "openid"

	GenericNoChannelNotification = "generic_no_channel"
	GenericNotification          = "generic"
	GenericNotificationServer    = "https://push-test.mattermost.com"
	MmSupportAdvisorAddress      = "support-advisor@mattermost.com"
	FullNotification             = "full"
	IdLoadedNotification         = "id_loaded"

	DirectMessageAny  = "any"
	DirectMessageTeam = "team"

	ShowUsername         = "username"
	ShowNicknameFullName = "nickname_full_name"
	ShowFullName         = "full_name"

	PermissionsAll          = "all"
	PermissionsChannelAdmin = "channel_admin"
	PermissionsTeamAdmin    = "team_admin"
	PermissionsSystemAdmin  = "system_admin"

	FakeSetting = "********************************"

	RestrictEmojiCreationAll         = "all"
	RestrictEmojiCreationAdmin       = "admin"
	RestrictEmojiCreationSystemAdmin = "system_admin"

	PermissionsDeletePostAll         = "all"
	PermissionsDeletePostTeamAdmin   = "team_admin"
	PermissionsDeletePostSystemAdmin = "system_admin"

	GroupUnreadChannelsDisabled   = "disabled"
	GroupUnreadChannelsDefaultOn  = "default_on"
	GroupUnreadChannelsDefaultOff = "default_off"

	CollapsedThreadsDisabled   = "disabled"
	CollapsedThreadsDefaultOn  = "default_on"
	CollapsedThreadsDefaultOff = "default_off"

	EmailBatchingBufferSize = 256
	EmailBatchingInterval   = 30

	EmailNotificationContentsFull    = "full"
	EmailNotificationContentsGeneric = "generic"

	EmailSMTPDefaultServer = "localhost"
	EmailSMTPDefaultPort   = "10025"

	SitenameMaxLength = 30

	ServiceSettingsDefaultSiteURL          = "http://localhost:8065"
	ServiceSettingsDefaultTLSCertFile      = ""
	ServiceSettingsDefaultTLSKeyFile       = ""
	ServiceSettingsDefaultReadTimeout      = 300
	ServiceSettingsDefaultWriteTimeout     = 300
	ServiceSettingsDefaultIdleTimeout      = 60
	ServiceSettingsDefaultMaxLoginAttempts = 10
	ServiceSettingsDefaultAllowCorsFrom    = ""
	ServiceSettingsDefaultListenAndAddress = ":8065"
	ServiceSettingsDefaultGfycatAPIKey     = "2_KtH_W5"
	ServiceSettingsDefaultGfycatAPISecret  = "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof"
	ServiceSettingsDefaultDeveloperFlags   = ""

	TeamSettingsDefaultSiteName              = "Mattermost"
	TeamSettingsDefaultMaxUsersPerTeam       = 50
	TeamSettingsDefaultCustomBrandText       = ""
	TeamSettingsDefaultCustomDescriptionText = ""
	TeamSettingsDefaultUserStatusAwayTimeout = 300

	SqlSettingsDefaultDataSource = "postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable&connect_timeout=10&binary_parameters=yes"

	FileSettingsDefaultDirectory = "./data/"

	ImportSettingsDefaultDirectory     = "./import"
	ImportSettingsDefaultRetentionDays = 30

	ExportSettingsDefaultDirectory     = "./export"
	ExportSettingsDefaultRetentionDays = 30

	EmailSettingsDefaultFeedbackOrganization = ""

	SupportSettingsDefaultTermsOfServiceLink = "https://mattermost.com/terms-of-use/"
	SupportSettingsDefaultPrivacyPolicyLink  = "https://mattermost.com/privacy-policy/"
	SupportSettingsDefaultAboutLink          = "https://docs.mattermost.com/about/product.html/"
	SupportSettingsDefaultHelpLink           = "https://mattermost.com/default-help/"
	SupportSettingsDefaultReportAProblemLink = "https://mattermost.com/default-report-a-problem/"
	SupportSettingsDefaultSupportEmail       = ""
	SupportSettingsDefaultReAcceptancePeriod = 365

	LdapSettingsDefaultFirstNameAttribute        = ""
	LdapSettingsDefaultLastNameAttribute         = ""
	LdapSettingsDefaultEmailAttribute            = ""
	LdapSettingsDefaultUsernameAttribute         = ""
	LdapSettingsDefaultNicknameAttribute         = ""
	LdapSettingsDefaultIdAttribute               = ""
	LdapSettingsDefaultPositionAttribute         = ""
	LdapSettingsDefaultLoginFieldName            = ""
	LdapSettingsDefaultGroupDisplayNameAttribute = ""
	LdapSettingsDefaultGroupIdAttribute          = ""
	LdapSettingsDefaultPictureAttribute          = ""

	SamlSettingsDefaultIdAttribute        = ""
	SamlSettingsDefaultGuestAttribute     = ""
	SamlSettingsDefaultAdminAttribute     = ""
	SamlSettingsDefaultFirstNameAttribute = ""
	SamlSettingsDefaultLastNameAttribute  = ""
	SamlSettingsDefaultEmailAttribute     = ""
	SamlSettingsDefaultUsernameAttribute  = ""
	SamlSettingsDefaultNicknameAttribute  = ""
	SamlSettingsDefaultLocaleAttribute    = ""
	SamlSettingsDefaultPositionAttribute  = ""

	SamlSettingsSignatureAlgorithmSha1    = "RSAwithSHA1"
	SamlSettingsSignatureAlgorithmSha256  = "RSAwithSHA256"
	SamlSettingsSignatureAlgorithmSha512  = "RSAwithSHA512"
	SamlSettingsDefaultSignatureAlgorithm = SamlSettingsSignatureAlgorithmSha1

	SamlSettingsCanonicalAlgorithmC14n    = "Canonical1.0"
	SamlSettingsCanonicalAlgorithmC14n11  = "Canonical1.1"
	SamlSettingsDefaultCanonicalAlgorithm = SamlSettingsCanonicalAlgorithmC14n

	NativeappSettingsDefaultAppDownloadLink        = "https://mattermost.com/download/#mattermostApps"
	NativeappSettingsDefaultAndroidAppDownloadLink = "https://mattermost.com/mattermost-android-app/"
	NativeappSettingsDefaultIosAppDownloadLink     = "https://mattermost.com/mattermost-ios-app/"

	ExperimentalSettingsDefaultLinkMetadataTimeoutMilliseconds = 5000

	AnalyticsSettingsDefaultMaxUsersForStatistics = 2500

	AnnouncementSettingsDefaultBannerColor                  = "#f2a93b"
	AnnouncementSettingsDefaultBannerTextColor              = "#333333"
	AnnouncementSettingsDefaultNoticesJsonURL               = "https://notices.mattermost.com/"
	AnnouncementSettingsDefaultNoticesFetchFrequencySeconds = 3600

	TeamSettingsDefaultTeamText = "default"

	ElasticsearchSettingsDefaultConnectionURL               = "http://localhost:9200"
	ElasticsearchSettingsDefaultUsername                    = "elastic"
	ElasticsearchSettingsDefaultPassword                    = "changeme"
	ElasticsearchSettingsDefaultPostIndexReplicas           = 1
	ElasticsearchSettingsDefaultPostIndexShards             = 1
	ElasticsearchSettingsDefaultChannelIndexReplicas        = 1
	ElasticsearchSettingsDefaultChannelIndexShards          = 1
	ElasticsearchSettingsDefaultUserIndexReplicas           = 1
	ElasticsearchSettingsDefaultUserIndexShards             = 1
	ElasticsearchSettingsDefaultAggregatePostsAfterDays     = 365
	ElasticsearchSettingsDefaultPostsAggregatorJobStartTime = "03:00"
	ElasticsearchSettingsDefaultIndexPrefix                 = ""
	ElasticsearchSettingsDefaultLiveIndexingBatchSize       = 1
	ElasticsearchSettingsDefaultRequestTimeoutSeconds       = 30
	ElasticsearchSettingsDefaultBatchSize                   = 10000

	BleveSettingsDefaultIndexDir  = ""
	BleveSettingsDefaultBatchSize = 10000

	DataRetentionSettingsDefaultMessageRetentionDays = 365
	DataRetentionSettingsDefaultFileRetentionDays    = 365
	DataRetentionSettingsDefaultBoardsRetentionDays  = 365
	DataRetentionSettingsDefaultDeletionJobStartTime = "02:00"
	DataRetentionSettingsDefaultBatchSize            = 3000

	PluginSettingsDefaultDirectory         = "./plugins"
	PluginSettingsDefaultClientDirectory   = "./client/plugins"
	PluginSettingsDefaultEnableMarketplace = true
	PluginSettingsDefaultMarketplaceURL    = "https://api.integrations.mattermost.com"
	PluginSettingsOldMarketplaceURL        = "https://marketplace.integrations.mattermost.com"

	ComplianceExportTypeCsv            = "csv"
	ComplianceExportTypeActiance       = "actiance"
	ComplianceExportTypeGlobalrelay    = "globalrelay"
	ComplianceExportTypeGlobalrelayZip = "globalrelay-zip"
	GlobalrelayCustomerTypeA9          = "A9"
	GlobalrelayCustomerTypeA10         = "A10"

	ClientSideCertCheckPrimaryAuth   = "primary"
	ClientSideCertCheckSecondaryAuth = "secondary"

	ImageProxyTypeLocal     = "local"
	ImageProxyTypeAtmosCamo = "atmos/camo"

	GoogleSettingsDefaultScope           = "profile email"
	GoogleSettingsDefaultAuthEndpoint    = "https://accounts.google.com/o/oauth2/v2/auth"
	GoogleSettingsDefaultTokenEndpoint   = "https://www.googleapis.com/oauth2/v4/token"
	GoogleSettingsDefaultUserAPIEndpoint = "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata"

	Office365SettingsDefaultScope           = "User.Read"
	Office365SettingsDefaultAuthEndpoint    = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
	Office365SettingsDefaultTokenEndpoint   = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
	Office365SettingsDefaultUserAPIEndpoint = "https://graph.microsoft.com/v1.0/me"

	CloudSettingsDefaultCwsURL    = "https://customers.mattermost.com"
	CloudSettingsDefaultCwsAPIURL = "https://portal.internal.prod.cloud.mattermost.com"
	OpenidSettingsDefaultScope    = "profile openid email"

	LocalModeSocketPath = "/var/tmp/mattermost_local.socket"
)
View Source
const (
	UserPropsKeyCustomStatus = "customStatus"

	CustomStatusTextMaxRunes = 100
	MaxRecentCustomStatuses  = 5
	DefaultCustomStatusEmoji = "speech_balloon"
)
View Source
const (
	EmojiNameMaxLength = 64
	EmojiSortByName    = "name"
)
View Source
const (
	FileinfoSortByCreated = "CreateAt"
	FileinfoSortBySize    = "Size"
)
View Source
const (
	GroupSourceLdap   GroupSource = "ldap"
	GroupSourceCustom GroupSource = "custom"

	GroupNameMaxLength        = 64
	GroupSourceMaxLength      = 64
	GroupDisplayNameMaxLength = 128
	GroupDescriptionMaxLength = 1024
	GroupRemoteIDMaxLength    = 48
)
View Source
const (
	TimeRangeToday string = "today"
	TimeRange7Day  string = "7_day"
	TimeRange28Day string = "28_day"
)
View Source
const (
	PostActionTypeButton                        = "button"
	PostActionTypeSelect                        = "select"
	InteractiveDialogTriggerTimeoutMilliseconds = 3000
)
View Source
const (
	JobTypeDataRetention                = "data_retention"
	JobTypeMessageExport                = "message_export"
	JobTypeElasticsearchPostIndexing    = "elasticsearch_post_indexing"
	JobTypeElasticsearchPostAggregation = "elasticsearch_post_aggregation"
	JobTypeBlevePostIndexing            = "bleve_post_indexing"
	JobTypeLdapSync                     = "ldap_sync"
	JobTypeMigrations                   = "migrations"
	JobTypePlugins                      = "plugins"
	JobTypeExpiryNotify                 = "expiry_notify"
	JobTypeProductNotices               = "product_notices"
	JobTypeActiveUsers                  = "active_users"
	JobTypeImportProcess                = "import_process"
	JobTypeImportDelete                 = "import_delete"
	JobTypeExportProcess                = "export_process"
	JobTypeExportDelete                 = "export_delete"
	JobTypeCloud                        = "cloud"
	JobTypeResendInvitationEmail        = "resend_invitation_email"
	JobTypeExtractContent               = "extract_content"

	JobStatusPending         = "pending"
	JobStatusInProgress      = "in_progress"
	JobStatusSuccess         = "success"
	JobStatusError           = "error"
	JobStatusCancelRequested = "cancel_requested"
	JobStatusCanceled        = "canceled"
	JobStatusWarning         = "warning"
)
View Source
const (
	UserAuthServiceLdap       = "ldap"
	LdapPublicCertificateName = "ldap-public.crt"
	LdapPrivateKeyName        = "ldap-private.key"
)
View Source
const (
	DayInSeconds      = 24 * 60 * 60
	DayInMilliseconds = DayInSeconds * 1000

	ExpiredLicenseError = "api.license.add_license.expired.app_error"
	InvalidLicenseError = "api.license.add_license.invalid.app_error"
	LicenseGracePeriod  = DayInMilliseconds * 10 //10 days
	LicenseRenewalLink  = "https://mattermost.com/renew/"

	LicenseShortSkuE10          = "E10"
	LicenseShortSkuE20          = "E20"
	LicenseShortSkuProfessional = "professional"
	LicenseShortSkuEnterprise   = "enterprise"
)
View Source
const (
	LinkMetadataTypeImage     LinkMetadataType = "image"
	LinkMetadataTypeNone      LinkMetadataType = "none"
	LinkMetadataTypeOpengraph LinkMetadataType = "opengraph"
	LinkMetadataMaxImages     int              = 5
)
View Source
const (
	AdvancedPermissionsMigrationKey       = "AdvancedPermissionsMigrationComplete"
	MigrationKeyAdvancedPermissionsPhase2 = "migration_advanced_permissions_phase_2"

	MigrationKeyEmojiPermissionsSplit                  = "emoji_permissions_split"
	MigrationKeyWebhookPermissionsSplit                = "webhook_permissions_split"
	MigrationKeyListJoinPublicPrivateTeams             = "list_join_public_private_teams"
	MigrationKeyRemovePermanentDeleteUser              = "remove_permanent_delete_user"
	MigrationKeyAddBotPermissions                      = "add_bot_permissions"
	MigrationKeyApplyChannelManageDeleteToChannelUser  = "apply_channel_manage_delete_to_channel_user"
	MigrationKeyRemoveChannelManageDeleteFromTeamUser  = "remove_channel_manage_delete_from_team_user"
	MigrationKeyViewMembersNewPermission               = "view_members_new_permission"
	MigrationKeyAddManageGuestsPermissions             = "add_manage_guests_permissions"
	MigrationKeyChannelModerationsPermissions          = "channel_moderations_permissions"
	MigrationKeyAddUseGroupMentionsPermission          = "add_use_group_mentions_permission"
	MigrationKeyAddSystemConsolePermissions            = "add_system_console_permissions"
	MigrationKeySidebarCategoriesPhase2                = "migration_sidebar_categories_phase_2"
	MigrationKeyAddConvertChannelPermissions           = "add_convert_channel_permissions"
	MigrationKeyAddSystemRolesPermissions              = "add_system_roles_permissions"
	MigrationKeyAddBillingPermissions                  = "add_billing_permissions"
	MigrationKeyAddManageSharedChannelPermissions      = "manage_shared_channel_permissions"
	MigrationKeyAddManageSecureConnectionsPermissions  = "manage_secure_connections_permissions"
	MigrationKeyAddDownloadComplianceExportResults     = "download_compliance_export_results"
	MigrationKeyAddComplianceSubsectionPermissions     = "compliance_subsection_permissions"
	MigrationKeyAddExperimentalSubsectionPermissions   = "experimental_subsection_permissions"
	MigrationKeyAddAuthenticationSubsectionPermissions = "authentication_subsection_permissions"
	MigrationKeyAddSiteSubsectionPermissions           = "site_subsection_permissions"
	MigrationKeyAddEnvironmentSubsectionPermissions    = "environment_subsection_permissions"
	MigrationKeyAddReportingSubsectionPermissions      = "reporting_subsection_permissions"
	MigrationKeyAddTestEmailAncillaryPermission        = "test_email_ancillary_permission"
	MigrationKeyAddAboutSubsectionPermissions          = "about_subsection_permissions"
	MigrationKeyAddIntegrationsSubsectionPermissions   = "integrations_subsection_permissions"
	MigrationKeyAddPlaybooksPermissions                = "playbooks_permissions"
	MigrationKeyAddCustomUserGroupsPermissions         = "custom_groups_permissions"
	MigrationKeyAddPlayboosksManageRolesPermissions    = "playbooks_manage_roles"
)
View Source
const (
	OAuthActionSignup     = "signup"
	OAuthActionLogin      = "login"
	OAuthActionEmailToSSO = "email_to_sso"
	OAuthActionSSOToEmail = "sso_to_email"
	OAuthActionMobile     = "mobile"
)
View Source
const (
	PermissionScopeSystem   = "system_scope"
	PermissionScopeTeam     = "team_scope"
	PermissionScopeChannel  = "channel_scope"
	PermissionScopeGroup    = "group_scope"
	PermissionScopePlaybook = "playbook_scope"
	PermissionScopeRun      = "run_scope"
)
View Source
const (
	PluginClusterEventSendTypeReliable   = ClusterSendReliable
	PluginClusterEventSendTypeBestEffort = ClusterSendBestEffort
)
View Source
const (
	KeyValuePluginIdMaxRunes = 190
	KeyValueKeyMaxRunes      = 150
)
View Source
const (
	PluginStateNotRunning          = 0
	PluginStateStarting            = 1 // unused by server
	PluginStateRunning             = 2
	PluginStateFailedToStart       = 3
	PluginStateFailedToStayRunning = 4
	PluginStateStopping            = 5 // unused by server
)
View Source
const (
	MinIdLength  = 3
	MaxIdLength  = 190
	ValidIdRegex = `^[a-zA-Z0-9-_\.]+$`
)
View Source
const (
	PostSystemMessagePrefix        = "system_"
	PostTypeDefault                = ""
	PostTypeSlackAttachment        = "slack_attachment"
	PostTypeSystemGeneric          = "system_generic"
	PostTypeJoinLeave              = "system_join_leave" // Deprecated, use PostJoinChannel or PostLeaveChannel instead
	PostTypeJoinChannel            = "system_join_channel"
	PostTypeGuestJoinChannel       = "system_guest_join_channel"
	PostTypeLeaveChannel           = "system_leave_channel"
	PostTypeJoinTeam               = "system_join_team"
	PostTypeLeaveTeam              = "system_leave_team"
	PostTypeAutoResponder          = "system_auto_responder"
	PostTypeAddRemove              = "system_add_remove" // Deprecated, use PostAddToChannel or PostRemoveFromChannel instead
	PostTypeAddToChannel           = "system_add_to_channel"
	PostTypeAddGuestToChannel      = "system_add_guest_to_chan"
	PostTypeRemoveFromChannel      = "system_remove_from_channel"
	PostTypeMoveChannel            = "system_move_channel"
	PostTypeAddToTeam              = "system_add_to_team"
	PostTypeRemoveFromTeam         = "system_remove_from_team"
	PostTypeHeaderChange           = "system_header_change"
	PostTypeDisplaynameChange      = "system_displayname_change"
	PostTypeConvertChannel         = "system_convert_channel"
	PostTypePurposeChange          = "system_purpose_change"
	PostTypeChannelDeleted         = "system_channel_deleted"
	PostTypeChannelRestored        = "system_channel_restored"
	PostTypeEphemeral              = "system_ephemeral"
	PostTypeChangeChannelPrivacy   = "system_change_chan_privacy"
	PostTypeAddBotTeamsChannels    = "add_bot_teams_channels"
	PostTypeSystemWarnMetricStatus = "warn_metric_status"
	PostTypeMe                     = "me"
	PostCustomTypePrefix           = "custom_"

	PostFileidsMaxRunes   = 300
	PostFilenamesMaxRunes = 4000
	PostHashtagsMaxRunes  = 1000
	PostMessageMaxRunesV1 = 4000
	PostMessageMaxBytesV2 = 65535                     // Maximum size of a TEXT column in MySQL
	PostMessageMaxRunesV2 = PostMessageMaxBytesV2 / 4 // Assume a worst-case representation
	PostPropsMaxRunes     = 800000
	PostPropsMaxUserRunes = PostPropsMaxRunes - 40000 // Leave some room for system / pre-save modifications

	PropsAddChannelMember = "add_channel_member"

	PostPropsAddedUserId       = "addedUserId"
	PostPropsDeleteBy          = "deleteBy"
	PostPropsOverrideIconURL   = "override_icon_url"
	PostPropsOverrideIconEmoji = "override_icon_emoji"

	PostPropsMentionHighlightDisabled = "mentionHighlightDisabled"
	PostPropsGroupHighlightDisabled   = "disable_group_highlight"

	PostPropsPreviewedPost = "previewed_post"
)
View Source
const (
	PreferenceCategoryDirectChannelShow = "direct_channel_show"
	PreferenceCategoryGroupChannelShow  = "group_channel_show"
	PreferenceCategoryTutorialSteps     = "tutorial_step"
	PreferenceCategoryAdvancedSettings  = "advanced_settings"
	PreferenceCategoryFlaggedPost       = "flagged_post"
	PreferenceCategoryFavoriteChannel   = "favorite_channel"
	PreferenceCategorySidebarSettings   = "sidebar_settings"

	PreferenceCategoryDisplaySettings     = "display_settings"
	PreferenceNameCollapsedThreadsEnabled = "collapsed_reply_threads"
	PreferenceNameChannelDisplayMode      = "channel_display_mode"
	PreferenceNameCollapseSetting         = "collapse_previews"
	PreferenceNameMessageDisplay          = "message_display"
	PreferenceNameNameFormat              = "name_format"
	PreferenceNameUseMilitaryTime         = "use_military_time"
	PreferenceRecommendedNextSteps        = "recommended_next_steps"

	PreferenceCategoryTheme = "theme"

	PreferenceCategoryAuthorizedOAuthApp = "oauth_app"

	PreferenceCategoryLast    = "last"
	PreferenceNameLastChannel = "channel"
	PreferenceNameLastTeam    = "team"

	PreferenceCategoryCustomStatus          = "custom_status"
	PreferenceNameRecentCustomStatuses      = "recent_custom_statuses"
	PreferenceNameCustomStatusTutorialState = "custom_status_tutorial_state"

	PreferenceCustomStatusModalViewed = "custom_status_modal_viewed"

	PreferenceCategoryNotifications = "notifications"
	PreferenceNameEmailInterval     = "email_interval"

	PreferenceEmailIntervalNoBatchingSeconds = "30"  // the "immediate" setting is actually 30s
	PreferenceEmailIntervalBatchingSeconds   = "900" // fifteen minutes is 900 seconds
	PreferenceEmailIntervalImmediately       = "immediately"
	PreferenceEmailIntervalFifteen           = "fifteen"
	PreferenceEmailIntervalFifteenAsSeconds  = "900"
	PreferenceEmailIntervalHour              = "hour"
	PreferenceEmailIntervalHourAsSeconds     = "3600"
)
View Source
const (
	PushNotifyApple              = "apple"
	PushNotifyAndroid            = "android"
	PushNotifyAppleReactNative   = "apple_rn"
	PushNotifyAndroidReactNative = "android_rn"

	PushTypeMessage     = "message"
	PushTypeClear       = "clear"
	PushTypeUpdateBadge = "update_badge"
	PushTypeSession     = "session"
	PushTypeTest        = "test"
	PushMessageV2       = "v2"

	PushSoundNone = "none"

	// The category is set to handle a set of interactive Actions
	// with the push notifications
	CategoryCanReply = "CAN_REPLY"

	MHPNS = "https://push.mattermost.com"

	PushSendPrepare = "Prepared to send"
	PushSendSuccess = "Successful"
	PushNotSent     = "Not Sent due to preferences"
	PushReceived    = "Received by device"
)
View Source
const (
	PushStatus         = "status"
	PushStatusOk       = "OK"
	PushStatusFail     = "FAIL"
	PushStatusRemove   = "REMOVE"
	PushStatusErrorMsg = "error"
)
View Source
const (
	RemoteOfflineAfterMillis = 1000 * 60 * 5 // 5 minutes
	RemoteNameMinLength      = 1
	RemoteNameMaxLength      = 64
)
View Source
const (
	SystemGuestRoleId           = "system_guest"
	SystemUserRoleId            = "system_user"
	SystemAdminRoleId           = "system_admin"
	SystemPostAllRoleId         = "system_post_all"
	SystemPostAllPublicRoleId   = "system_post_all_public"
	SystemUserAccessTokenRoleId = "system_user_access_token"
	SystemUserManagerRoleId     = "system_user_manager"
	SystemReadOnlyAdminRoleId   = "system_read_only_admin"
	SystemManagerRoleId         = "system_manager"

	TeamGuestRoleId         = "team_guest"
	TeamUserRoleId          = "team_user"
	TeamAdminRoleId         = "team_admin"
	TeamPostAllRoleId       = "team_post_all"
	TeamPostAllPublicRoleId = "team_post_all_public"

	ChannelGuestRoleId = "channel_guest"
	ChannelUserRoleId  = "channel_user"
	ChannelAdminRoleId = "channel_admin"

	CustomGroupUserRoleId = "custom_group_user"

	PlaybookAdminRoleId  = "playbook_admin"
	PlaybookMemberRoleId = "playbook_member"
	RunAdminRoleId       = "run_admin"
	RunMemberRoleId      = "run_member"

	RoleNameMaxLength        = 64
	RoleDisplayNameMaxLength = 128
	RoleDescriptionMaxLength = 1024

	RoleScopeSystem  RoleScope = "System"
	RoleScopeTeam    RoleScope = "Team"
	RoleScopeChannel RoleScope = "Channel"
	RoleScopeGroup   RoleScope = "Group"

	RoleTypeGuest RoleType = "Guest"
	RoleTypeUser  RoleType = "User"
	RoleTypeAdmin RoleType = "Admin"
)
View Source
const (
	UserAuthServiceSaml     = "saml"
	UserAuthServiceSamlText = "SAML"
	UserAuthServiceIsSaml   = "isSaml"
	UserAuthServiceIsMobile = "isMobile"
	UserAuthServiceIsOAuth  = "isOAuthUser"
)
View Source
const (
	SchemeDisplayNameMaxLength = 128
	SchemeNameMaxLength        = 64
	SchemeDescriptionMaxLength = 1024
	SchemeScopeTeam            = "team"
	SchemeScopeChannel         = "channel"
	SchemeScopePlaybook        = "playbook"
	SchemeScopeRun             = "run"
)
View Source
const (
	SessionCookieToken            = "MMAUTHTOKEN"
	SessionCookieUser             = "MMUSERID"
	SessionCookieCsrf             = "MMCSRF"
	SessionCookieCloudUrl         = "MMCLOUDURL"
	SessionCacheSize              = 35000
	SessionPropPlatform           = "platform"
	SessionPropOs                 = "os"
	SessionPropBrowser            = "browser"
	SessionPropType               = "type"
	SessionPropUserAccessTokenId  = "user_access_token_id"
	SessionPropIsBot              = "is_bot"
	SessionPropIsBotValue         = "true"
	SessionPropOAuthAppID         = "oauth_app_id"
	SessionPropMattermostAppID    = "mattermost_app_id"
	SessionTypeUserAccessToken    = "UserAccessToken"
	SessionTypeCloudKey           = "CloudKey"
	SessionTypeRemoteclusterToken = "RemoteClusterToken"
	SessionPropIsGuest            = "is_guest"
	SessionActivityTimeout        = 1000 * 60 * 5 // 5 minutes
	SessionUserAccessTokenExpiry  = 100 * 365     // 100 years
)
View Source
const (
	StatusOutOfOffice    = "ooo"
	StatusOffline        = "offline"
	StatusAway           = "away"
	StatusDnd            = "dnd"
	StatusOnline         = "online"
	StatusCacheSize      = SessionCacheSize
	StatusChannelTimeout = 20000  // 20 seconds
	StatusMinUpdateTime  = 120000 // 2 minutes
)
View Source
const (
	SystemTelemetryId                      = "DiagnosticId"
	SystemRanUnitTests                     = "RanUnitTests"
	SystemLastSecurityTime                 = "LastSecurityTime"
	SystemActiveLicenseId                  = "ActiveLicenseId"
	SystemLastComplianceTime               = "LastComplianceTime"
	SystemAsymmetricSigningKeyKey          = "AsymmetricSigningKey"
	SystemPostActionCookieSecretKey        = "PostActionCookieSecret"
	SystemInstallationDateKey              = "InstallationDate"
	SystemFirstServerRunTimestampKey       = "FirstServerRunTimestamp"
	SystemClusterEncryptionKey             = "ClusterEncryptionKey"
	SystemUpgradedFromTeId                 = "UpgradedFromTE"
	SystemWarnMetricNumberOfTeams5         = "warn_metric_number_of_teams_5"
	SystemWarnMetricNumberOfChannels50     = "warn_metric_number_of_channels_50"
	SystemWarnMetricMfa                    = "warn_metric_mfa"
	SystemWarnMetricEmailDomain            = "warn_metric_email_domain"
	SystemWarnMetricNumberOfActiveUsers100 = "warn_metric_number_of_active_users_100"
	SystemWarnMetricNumberOfActiveUsers200 = "warn_metric_number_of_active_users_200"
	SystemWarnMetricNumberOfActiveUsers300 = "warn_metric_number_of_active_users_300"
	SystemWarnMetricNumberOfActiveUsers500 = "warn_metric_number_of_active_users_500"
	SystemWarnMetricNumberOfPosts2m        = "warn_metric_number_of_posts_2M"
	SystemWarnMetricLastRunTimestampKey    = "LastWarnMetricRunTimestamp"
	SystemFirstAdminVisitMarketplace       = "FirstAdminVisitMarketplace"
	SystemFirstAdminSetupComplete          = "FirstAdminSetupComplete"
	AwsMeteringReportInterval              = 1
	AwsMeteringDimensionUsageHrs           = "UsageHrs"
)
View Source
const (
	WarnMetricStatusLimitReached    = "true"
	WarnMetricStatusRunonce         = "runonce"
	WarnMetricStatusAck             = "ack"
	WarnMetricStatusStorePrefix     = "warn_metric_"
	WarnMetricJobInterval           = 24 * 7
	WarnMetricNumberOfActiveUsers25 = 25
	WarnMetricJobWaitTime           = 1000 * 3600 * 24 * 7 // 7 days
)
View Source
const (
	TeamOpen                    = "O"
	TeamInvite                  = "I"
	TeamAllowedDomainsMaxLength = 500
	TeamCompanyNameMaxLength    = 64
	TeamDescriptionMaxLength    = 255
	TeamDisplayNameMaxRunes     = 64
	TeamEmailMaxLength          = 128
	TeamNameMaxLength           = 64
	TeamNameMinLength           = 2
)
View Source
const (
	TokenSize          = 64
	MaxTokenExipryTime = 1000 * 60 * 60 * 48 // 48 hour
	TokenTypeOAuth     = "oauth"
)
View Source
const (
	Me                             = "me"
	UserNotifyAll                  = "all"
	UserNotifyHere                 = "here"
	UserNotifyMention              = "mention"
	UserNotifyNone                 = "none"
	DesktopNotifyProp              = "desktop"
	DesktopSoundNotifyProp         = "desktop_sound"
	MarkUnreadNotifyProp           = "mark_unread"
	PushNotifyProp                 = "push"
	PushStatusNotifyProp           = "push_status"
	EmailNotifyProp                = "email"
	ChannelMentionsNotifyProp      = "channel"
	CommentsNotifyProp             = "comments"
	MentionKeysNotifyProp          = "mention_keys"
	CommentsNotifyNever            = "never"
	CommentsNotifyRoot             = "root"
	CommentsNotifyAny              = "any"
	CommentsNotifyCRT              = "crt"
	FirstNameNotifyProp            = "first_name"
	AutoResponderActiveNotifyProp  = "auto_responder_active"
	AutoResponderMessageNotifyProp = "auto_responder_message"
	DesktopThreadsNotifyProp       = "desktop_threads"
	PushThreadsNotifyProp          = "push_threads"
	EmailThreadsNotifyProp         = "email_threads"

	DefaultLocale        = "en"
	UserAuthServiceEmail = "email"

	UserEmailMaxLength    = 128
	UserNicknameMaxRunes  = 64
	UserPositionMaxRunes  = 128
	UserFirstNameMaxRunes = 64
	UserLastNameMaxRunes  = 64
	UserAuthDataMaxLength = 128
	UserNameMaxLength     = 64
	UserNameMinLength     = 1
	UserPasswordMaxLength = 72
	UserLocaleMaxLength   = 5
	UserTimezoneMaxRunes  = 256
	UserRolesMaxLength    = 256
)
View Source
const (
	LowercaseLetters = "abcdefghijklmnopqrstuvwxyz"
	UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	NUMBERS          = "0123456789"
	SYMBOLS          = " !\"\\#$%&'()*+,-./:;<=>?@[]^_`|~"
	BinaryParamKey   = "MM_BINARY_PARAMETERS"
)
View Source
const (
	SocketMaxMessageSizeKb   = 8 * 1024 // 8KB
	PingTimeoutBufferSeconds = 5
)
View Source
const (
	WebsocketEventTyping                              = "typing"
	WebsocketEventPosted                              = "posted"
	WebsocketEventPostEdited                          = "post_edited"
	WebsocketEventPostDeleted                         = "post_deleted"
	WebsocketEventPostUnread                          = "post_unread"
	WebsocketEventChannelConverted                    = "channel_converted"
	WebsocketEventChannelCreated                      = "channel_created"
	WebsocketEventChannelDeleted                      = "channel_deleted"
	WebsocketEventChannelRestored                     = "channel_restored"
	WebsocketEventChannelUpdated                      = "channel_updated"
	WebsocketEventChannelMemberUpdated                = "channel_member_updated"
	WebsocketEventChannelSchemeUpdated                = "channel_scheme_updated"
	WebsocketEventDirectAdded                         = "direct_added"
	WebsocketEventGroupAdded                          = "group_added"
	WebsocketEventNewUser                             = "new_user"
	WebsocketEventAddedToTeam                         = "added_to_team"
	WebsocketEventLeaveTeam                           = "leave_team"
	WebsocketEventUpdateTeam                          = "update_team"
	WebsocketEventDeleteTeam                          = "delete_team"
	WebsocketEventRestoreTeam                         = "restore_team"
	WebsocketEventUpdateTeamScheme                    = "update_team_scheme"
	WebsocketEventUserAdded                           = "user_added"
	WebsocketEventUserUpdated                         = "user_updated"
	WebsocketEventUserRoleUpdated                     = "user_role_updated"
	WebsocketEventMemberroleUpdated                   = "memberrole_updated"
	WebsocketEventUserRemoved                         = "user_removed"
	WebsocketEventPreferenceChanged                   = "preference_changed"
	WebsocketEventPreferencesChanged                  = "preferences_changed"
	WebsocketEventPreferencesDeleted                  = "preferences_deleted"
	WebsocketEventEphemeralMessage                    = "ephemeral_message"
	WebsocketEventStatusChange                        = "status_change"
	WebsocketEventHello                               = "hello"
	WebsocketAuthenticationChallenge                  = "authentication_challenge"
	WebsocketEventReactionAdded                       = "reaction_added"
	WebsocketEventReactionRemoved                     = "reaction_removed"
	WebsocketEventResponse                            = "response"
	WebsocketEventEmojiAdded                          = "emoji_added"
	WebsocketEventChannelViewed                       = "channel_viewed"
	WebsocketEventPluginStatusesChanged               = "plugin_statuses_changed"
	WebsocketEventPluginEnabled                       = "plugin_enabled"
	WebsocketEventPluginDisabled                      = "plugin_disabled"
	WebsocketEventRoleUpdated                         = "role_updated"
	WebsocketEventLicenseChanged                      = "license_changed"
	WebsocketEventConfigChanged                       = "config_changed"
	WebsocketEventOpenDialog                          = "open_dialog"
	WebsocketEventGuestsDeactivated                   = "guests_deactivated"
	WebsocketEventUserActivationStatusChange          = "user_activation_status_change"
	WebsocketEventReceivedGroup                       = "received_group"
	WebsocketEventReceivedGroupAssociatedToTeam       = "received_group_associated_to_team"
	WebsocketEventReceivedGroupNotAssociatedToTeam    = "received_group_not_associated_to_team"
	WebsocketEventReceivedGroupAssociatedToChannel    = "received_group_associated_to_channel"
	WebsocketEventReceivedGroupNotAssociatedToChannel = "received_group_not_associated_to_channel"
	WebsocketEventGroupMemberDelete                   = "group_member_deleted"
	WebsocketEventGroupMemberAdd                      = "group_member_add"
	WebsocketEventSidebarCategoryCreated              = "sidebar_category_created"
	WebsocketEventSidebarCategoryUpdated              = "sidebar_category_updated"
	WebsocketEventSidebarCategoryDeleted              = "sidebar_category_deleted"
	WebsocketEventSidebarCategoryOrderUpdated         = "sidebar_category_order_updated"
	WebsocketWarnMetricStatusReceived                 = "warn_metric_status_received"
	WebsocketWarnMetricStatusRemoved                  = "warn_metric_status_removed"
	WebsocketEventCloudPaymentStatusUpdated           = "cloud_payment_status_updated"
	WebsocketEventThreadUpdated                       = "thread_updated"
	WebsocketEventThreadFollowChanged                 = "thread_follow_changed"
	WebsocketEventThreadReadChanged                   = "thread_read_changed"
	WebsocketFirstAdminVisitMarketplaceStatusReceived = "first_admin_visit_marketplace_status_received"
)
View Source
const ChannelSearchDefaultLimit = 50
View Source
const (
	CommandWebhookLifetime = 1000 * 60 * 30
)
View Source
const ConfigAccessTagAnySysConsoleRead = "*_read"

Allows read access if any PermissionSysconsoleRead* is allowed

View Source
const ConfigAccessTagCloudRestrictable = "cloud_restrictable"
View Source
const ConfigAccessTagType = "access"
View Source
const ConfigAccessTagWriteRestrictable = "write_restrictable"
View Source
const (
	DefaultWebhookUsername = "webhook"
)
View Source
const ExportDataDir = "data"

ExportDataDir is the name of the directory were to store additional data included with the export (e.g. file attachments).

View Source
const (
	LicenseUpForRenewalEmailSent = "LicenseUpForRenewalEmailSent"
)
View Source
const (
	MaxImageSize = int64(6048 * 4032) // 24 megapixels, roughly 36MB as a raw image
)
View Source
const OutgoingHookResponseTypeComment = "comment"
View Source
const (
	USERNAME = "Username"
)
View Source
const UploadNoUserID = "nouser"

UploadNoUserID is a "fake" user id used by the API layer when in local mode.

View Source
const (
	UserAuthServiceGitlab = "gitlab"
)
View Source
const UserSearchDefaultLimit = 100
View Source
const UserSearchMaxLimit = 1000

Variables

View Source
var AllPermissions []*Permission
View Source
var BuildDate string
View Source
var BuildEnterpriseReady string
View Source
var BuildHash string
View Source
var BuildHashEnterprise string
View Source
var BuildNumber string
View Source
var BuiltInSchemeManagedRoleIDs []string
View Source
var ChannelModeratedPermissions []string
View Source
var ChannelModeratedPermissionsMap map[string]string
View Source
var CurrentVersion string = versions[0]
View Source
var DeprecatedPermissions []*Permission
View Source
var EmojiPattern = regexp.MustCompile(`:[a-zA-Z0-9_+-]+:`)
View Source
var MockCWS string
View Source
var NewSystemRoleIDs []string
View Source
var PostActionRetainPropKeys = []string{"from_webhook", "override_username", "override_icon_url"}
View Source
var ServerTLSSupportedCiphers = map[string]uint16{
	"TLS_RSA_WITH_RC4_128_SHA":                tls.TLS_RSA_WITH_RC4_128_SHA,
	"TLS_RSA_WITH_3DES_EDE_CBC_SHA":           tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
	"TLS_RSA_WITH_AES_128_CBC_SHA":            tls.TLS_RSA_WITH_AES_128_CBC_SHA,
	"TLS_RSA_WITH_AES_256_CBC_SHA":            tls.TLS_RSA_WITH_AES_256_CBC_SHA,
	"TLS_RSA_WITH_AES_128_CBC_SHA256":         tls.TLS_RSA_WITH_AES_128_CBC_SHA256,
	"TLS_RSA_WITH_AES_128_GCM_SHA256":         tls.TLS_RSA_WITH_AES_128_GCM_SHA256,
	"TLS_RSA_WITH_AES_256_GCM_SHA384":         tls.TLS_RSA_WITH_AES_256_GCM_SHA384,
	"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA":        tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
	"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA":    tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
	"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA":    tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
	"TLS_ECDHE_RSA_WITH_RC4_128_SHA":          tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,
	"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA":     tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
	"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA":      tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
	"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA":      tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
	"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
	"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256":   tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
	"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256":   tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
	"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
	"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384":   tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
	"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
	"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305":    tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
	"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305":  tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
}
View Source
var SysconsoleAncillaryPermissions map[string][]*Permission

SysconsoleAncillaryPermissions maps the non-sysconsole permissions required by each sysconsole view.

View Source
var SysconsoleReadPermissions []*Permission
View Source
var SysconsoleWritePermissions []*Permission
View Source
var SystemEmojis = map[string]string{} /* 4458 elements not displayed */
View Source
var SystemManagerDefaultPermissions []string
View Source
var SystemReadOnlyAdminDefaultPermissions []string
View Source
var SystemUserManagerDefaultPermissions []string
View Source
var WarnMetricsTable = map[string]WarnMetric{
	SystemWarnMetricMfa: {
		Id:        SystemWarnMetricMfa,
		Limit:     -1,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricEmailDomain: {
		Id:        SystemWarnMetricEmailDomain,
		Limit:     -1,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfTeams5: {
		Id:        SystemWarnMetricNumberOfTeams5,
		Limit:     5,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfChannels50: {
		Id:        SystemWarnMetricNumberOfChannels50,
		Limit:     50,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfActiveUsers100: {
		Id:        SystemWarnMetricNumberOfActiveUsers100,
		Limit:     100,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfActiveUsers200: {
		Id:        SystemWarnMetricNumberOfActiveUsers200,
		Limit:     200,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfActiveUsers300: {
		Id:        SystemWarnMetricNumberOfActiveUsers300,
		Limit:     300,
		IsBotOnly: true,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfActiveUsers500: {
		Id:        SystemWarnMetricNumberOfActiveUsers500,
		Limit:     500,
		IsBotOnly: false,
		IsRunOnce: true,
	},
	SystemWarnMetricNumberOfPosts2m: {
		Id:        SystemWarnMetricNumberOfPosts2m,
		Limit:     2000000,
		IsBotOnly: false,
		IsRunOnce: true,
	},
}

Functions

func AddAncillaryPermissions

func AddAncillaryPermissions(permissions []string) []string

func AppErrorInit

func AppErrorInit(t i18n.TranslateFunc)

func ArrayFromInterface

func ArrayFromInterface(data interface{}) []string

func ArrayFromJSON

func ArrayFromJSON(data io.Reader) []string

func ArrayToJSON

func ArrayToJSON(objmap []string) string

func AuditModelTypeConv

func AuditModelTypeConv(val interface{}) (newVal interface{}, converted bool)

AuditModelTypeConv converts key model types to something better suited for audit output.

func ChannelMentions

func ChannelMentions(message string) []string

func ChannelModeratedPermissionsChangedByPatch

func ChannelModeratedPermissionsChangedByPatch(role *Role, patch *RolePatch) []string

func CleanRoleNames

func CleanRoleNames(roleNames []string) ([]string, bool)

func CleanTeamName

func CleanTeamName(s string) string

func CleanUsername

func CleanUsername(username string) string

func ClearMentionTags

func ClearMentionTags(post string) string

func CompliancePostHeader

func CompliancePostHeader() []string

func CopyStringMap

func CopyStringMap(originalMap map[string]string) map[string]string

func DecryptPostActionCookie

func DecryptPostActionCookie(encoded string, secret []byte) (string, error)

func EmailInviteWithErrorToEmails

func EmailInviteWithErrorToEmails(o []*EmailInviteWithError) []string

func EmailInviteWithErrorToString

func EmailInviteWithErrorToString(o *EmailInviteWithError) string

func Etag

func Etag(parts ...interface{}) string

func FloorToNearestHour

func FloorToNearestHour(ms int64) int64

FloorToNearestHour takes a timestamp (in milliseconds) and returns it rounded to the previous hour in UTC.

func GenerateLinkMetadataHash

func GenerateLinkMetadataHash(url string, timestamp int64) int64

GenerateLinkMetadataHash generates a unique hash for a given URL and timestamp for use as a database key.

func GetDMNameFromIds

func GetDMNameFromIds(userId1, userId2 string) string

func GetDefaultAppCustomURLSchemes

func GetDefaultAppCustomURLSchemes() []string

func GetEmojiNameFromUnicode

func GetEmojiNameFromUnicode(unicode string) (emojiName string, count int)

func GetEndOfDayMillis

func GetEndOfDayMillis(thisTime time.Time, timeZoneOffset int) int64

GetEndOfDayMillis is a convenience method to get milliseconds since epoch for provided date's end of day

func GetEtagForFileInfos

func GetEtagForFileInfos(infos []*FileInfo) string

func GetGroupDisplayNameFromUsers

func GetGroupDisplayNameFromUsers(users []*User, truncate bool) string

func GetGroupNameFromUserIds

func GetGroupNameFromUserIds(userIds []string) string

func GetInfoForBytes

func GetInfoForBytes(name string, data io.ReadSeeker, size int) (*FileInfo, *AppError)

func GetMillis

func GetMillis() int64

GetMillis is a convenience method to get milliseconds since epoch.

func GetMillisForTime

func GetMillisForTime(thisTime time.Time) int64

GetMillisForTime is a convenience method to get milliseconds since epoch for provided Time.

func GetPreferredTimezone

func GetPreferredTimezone(timezone StringMap) string

func GetPreviousVersion

func GetPreviousVersion(version string) string

func GetServerIPAddress

func GetServerIPAddress(iface string) string

func GetStartOfDayMillis

func GetStartOfDayMillis(thisTime time.Time, timeZoneOffset int) int64

GetStartOfDayMillis is a convenience method to get milliseconds since epoch for provided date's start of day

func GetSystemEmojiId

func GetSystemEmojiId(emojiName string) (string, bool)

func GetTimeForMillis

func GetTimeForMillis(millis int64) time.Time

GetTimeForMillis is a convenience method to get time.Time for milliseconds since epoch.

func HashPassword

func HashPassword(password string) string

HashPassword generates a hash using the bcrypt.GenerateFromPassword

func IncomingWebhookRequestFromJSON

func IncomingWebhookRequestFromJSON(data io.Reader) (*IncomingWebhookRequest, *AppError)

func IsBotDMChannel

func IsBotDMChannel(channel *Channel, botUserID string) bool

func IsChannelMarkUnreadLevelValid

func IsChannelMarkUnreadLevelValid(markUnreadLevel string) bool

func IsChannelNotifyLevelValid

func IsChannelNotifyLevelValid(notifyLevel string) bool

func IsCurrentVersion

func IsCurrentVersion(versionToCheck string) bool

func IsIgnoreChannelMentionsValid

func IsIgnoreChannelMentionsValid(ignoreChannelMentions string) bool

func IsInRole

func IsInRole(userRoles string, inRole string) bool

Make sure you actually want to use this function. In context.go there are functions to check permissions This function should not be used to check permissions.

func IsPreviousVersionsSupported

func IsPreviousVersionsSupported(versionToCheck string) bool

func IsReservedTeamName

func IsReservedTeamName(s string) bool

func IsSendEmailValid

func IsSendEmailValid(sendEmail string) bool

func IsValidAlphaNumHyphenUnderscore

func IsValidAlphaNumHyphenUnderscore(s string, withFormat bool) bool

func IsValidAlphaNumHyphenUnderscorePlus

func IsValidAlphaNumHyphenUnderscorePlus(s string) bool

func IsValidCategoryId

func IsValidCategoryId(s string) bool

func IsValidChannelIdentifier

func IsValidChannelIdentifier(s string) bool

func IsValidEmail

func IsValidEmail(email string) bool

func IsValidHTTPURL

func IsValidHTTPURL(rawURL string) bool

func IsValidId

func IsValidId(value string) bool

func IsValidLocale

func IsValidLocale(locale string) bool

func IsValidPluginId

func IsValidPluginId(id string) bool

IsValidPluginId verifies that the plugin id has a minimum length of 3, maximum length of 190, and contains only alphanumeric characters, dashes, underscores and periods.

These constraints are necessary since the plugin id is used as part of a filesystem path.

func IsValidRemoteName

func IsValidRemoteName(s string) bool

func IsValidRoleName

func IsValidRoleName(roleName string) bool

func IsValidSchemeName

func IsValidSchemeName(name string) bool

func IsValidTeamName

func IsValidTeamName(s string) bool

func IsValidUserRoles

func IsValidUserRoles(userRoles string) bool

func IsValidUsername

func IsValidUsername(s string) bool

func IsValidUsernameAllowRemote

func IsValidUsernameAllowRemote(s string) bool

func MakeDefaultRoles

func MakeDefaultRoles() map[string]*Role

func MapBoolFromJSON

func MapBoolFromJSON(data io.Reader) map[string]bool

MapFromJSON will decode the key/value pair map

func MapBoolToJSON

func MapBoolToJSON(objmap map[string]bool) string

MapBoolToJSON converts a map to a json string

func MapFromJSON

func MapFromJSON(data io.Reader) map[string]string

MapFromJSON will decode the key/value pair map

func MapToJSON

func MapToJSON(objmap map[string]string) string

MapToJSON converts a map to a json string

func NewBool

func NewBool(b bool) *bool

func NewId

func NewId() string

NewId is a globally unique identifier. It is a [A-Z0-9] string 26 characters long. It is a UUID version 4 Guid that is zbased32 encoded with the padding stripped off.

func NewInt

func NewInt(n int) *int

func NewInt64

func NewInt64(n int64) *int64

func NewPluginKeyValueFromOptions

func NewPluginKeyValueFromOptions(pluginId, key string, value []byte, opt PluginKVSetOptions) (*PluginKeyValue, *AppError)

NewPluginKeyValueFromOptions return a PluginKeyValue given a pluginID, a KV pair and options.

func NewRandomString

func NewRandomString(length int) string

NewRandomString returns a random string of the given length. The resulting entropy will be (5 * length) bits.

func NewRandomTeamName

func NewRandomTeamName() string

NewRandomTeamName is a NewId that will be a valid team name.

func NewString

func NewString(s string) *string

func NormalizeEmail

func NormalizeEmail(email string) string

func NormalizeRemoteName

func NormalizeRemoteName(name string) string

func NormalizeUsername

func NormalizeUsername(username string) string

func PadDateStringZeros

func PadDateStringZeros(dateString string) string

PadDateStringZeros is a convenience method to pad 2 digit date parts with zeros to meet ISO 8601 format

func ParseHashtags

func ParseHashtags(text string) (string, string)

func ParseSlackAttachment

func ParseSlackAttachment(post *Post, attachments []*SlackAttachment)

This method only parses and processes the attachments, all else should be set in the post which is passed

func ParseSlackLinksToMarkdown

func ParseSlackLinksToMarkdown(text string) string

func PermissionsChangedByPatch

func PermissionsChangedByPatch(role *Role, patch *RolePatch) []string

Returns an array of permissions that are in either role.Permissions or patch.Permissions, but not both.

func RemoveDuplicateStrings

func RemoveDuplicateStrings(in []string) []string

RemoveDuplicateStrings does an in-place removal of duplicate strings from the input slice. The original slice gets modified.

func RewriteImageURLs

func RewriteImageURLs(message string, f func(string) string) string

RewriteImageURLs takes a message and returns a copy that has all of the image URLs replaced according to the function f. For each image URL, f will be invoked, and the resulting markdown will contain the URL returned by that invocation instead.

Image URLs are destination URLs used in inline images or reference definitions that are used anywhere in the input markdown as an image.

func RuneToHexadecimalString

func RuneToHexadecimalString(r rune) string

func SanitizeUnicode

func SanitizeUnicode(s string) string

SanitizeUnicode will remove undesirable Unicode characters from a string.

func SplitVersion

func SplitVersion(version string) (int64, int64, int64)

func StatusListToJSON

func StatusListToJSON(u []*Status) ([]byte, error)

func StatusMapToInterfaceMap

func StatusMapToInterfaceMap(statusMap map[string]*Status) map[string]interface{}

func StringInterfaceFromJSON

func StringInterfaceFromJSON(data io.Reader) map[string]interface{}

func StringInterfaceToJSON

func StringInterfaceToJSON(objmap map[string]interface{}) string

func TeamMemberWithErrorToString

func TeamMemberWithErrorToString(o *TeamMemberWithError) string

func ToJSON

func ToJSON(v interface{}) []byte

ToJSON serializes an arbitrary data type to JSON, discarding the error.

func TruncateOpenGraph

func TruncateOpenGraph(ogdata *opengraph.OpenGraph) *opengraph.OpenGraph

TruncateOpenGraph ensure OpenGraph metadata doesn't grow too big by shortening strings, trimming fields and reducing the number of images.

Types

type AccessData

type AccessData struct {
	ClientId     string `json:"client_id"`
	UserId       string `json:"user_id"`
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
	RedirectUri  string `json:"redirect_uri"`
	ExpiresAt    int64  `json:"expires_at"`
	Scope        string `json:"scope"`
}

func (*AccessData) IsExpired

func (ad *AccessData) IsExpired() bool

func (*AccessData) IsValid

func (ad *AccessData) IsValid() *AppError

IsValid validates the AccessData and returns an error if it isn't configured correctly.

type AccessResponse

type AccessResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int32  `json:"expires_in"`
	Scope        string `json:"scope"`
	RefreshToken string `json:"refresh_token"`
	IdToken      string `json:"id_token"`
}

type AddOn

type AddOn struct {
	ID           string  `json:"id"`
	Name         string  `json:"name"`
	DisplayName  string  `json:"display_name"`
	PricePerSeat float64 `json:"price_per_seat"`
}

AddOn represents an addon to a product.

type 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"`
}

Address model represents a customer's address.

type AnalyticsPostCountsOptions

type AnalyticsPostCountsOptions struct {
	TeamId        string
	BotsOnly      bool
	YesterdayOnly bool
}

type AnalyticsRow

type AnalyticsRow struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
}

type AnalyticsRows

type AnalyticsRows []*AnalyticsRow

type AnalyticsSettings

type AnalyticsSettings struct {
	MaxUsersForStatistics *int `access:"write_restrictable,cloud_restrictable"`
}

func (*AnalyticsSettings) SetDefaults

func (s *AnalyticsSettings) SetDefaults()

type AnnouncementSettings

type AnnouncementSettings struct {
	EnableBanner          *bool   `access:"site_announcement_banner"`
	BannerText            *string `access:"site_announcement_banner"` // telemetry: none
	BannerColor           *string `access:"site_announcement_banner"`
	BannerTextColor       *string `access:"site_announcement_banner"`
	AllowBannerDismissal  *bool   `access:"site_announcement_banner"`
	AdminNoticesEnabled   *bool   `access:"site_notices"`
	UserNoticesEnabled    *bool   `access:"site_notices"`
	NoticesURL            *string `access:"site_notices,write_restrictable"` // telemetry: none
	NoticesFetchFrequency *int    `access:"site_notices,write_restrictable"` // telemetry: none
	NoticesSkipCache      *bool   `access:"site_notices,write_restrictable"` // telemetry: none
}

func (*AnnouncementSettings) SetDefaults

func (s *AnnouncementSettings) SetDefaults()

type AppError

type AppError struct {
	Id            string `json:"id"`
	Message       string `json:"message"`               // Message to be display to the end user without debugging information
	DetailedError string `json:"detailed_error"`        // Internal error string to help the developer
	RequestId     string `json:"request_id,omitempty"`  // The RequestId that's also set in the header
	StatusCode    int    `json:"status_code,omitempty"` // The http status code
	Where         string `json:"-"`                     // The function where it happened in the form of Struct.Func
	IsOAuth       bool   `json:"is_oauth,omitempty"`    // Whether the error is OAuth specific
	// contains filtered or unexported fields
}

func AppErrorFromJSON

func AppErrorFromJSON(data io.Reader) *AppError

AppErrorFromJSON will decode the input and return an AppError

func DecodeAndVerifyTriggerId

func DecodeAndVerifyTriggerId(triggerId string, s *ecdsa.PrivateKey) (string, string, *AppError)

func GenerateTriggerId

func GenerateTriggerId(userId string, s crypto.Signer) (string, string, *AppError)

func GetStartUnixMilliForTimeRange added in v6.7.0

func GetStartUnixMilliForTimeRange(timeRange string) (int64, *AppError)

GetStartUnixMilliForTimeRange gets the unix start time in milliseconds from the given time range. Time range can be one of: "1_day", "7_day", or "28_day".

func InvalidTermsOfServiceError

func InvalidTermsOfServiceError(fieldName string, termsOfServiceId string) *AppError

func InvalidUserError

func InvalidUserError(fieldName string, userId string) *AppError

func InvalidUserTermsOfServiceError

func InvalidUserTermsOfServiceError(fieldName string, userTermsOfServiceId string) *AppError

func IsSearchParamsListValid

func IsSearchParamsListValid(paramsList []*SearchParams) *AppError

func IsValidEmojiName

func IsValidEmojiName(name string) *AppError

func MakeBotNotFoundError

func MakeBotNotFoundError(userId string) *AppError

MakeBotNotFoundError creates the error returned when a bot does not exist, or when the user isn't allowed to query the bot. The errors must the same in both cases to avoid leaking that a user is a bot.

func NewAppError

func NewAppError(where string, id string, params map[string]interface{}, details string, status int) *AppError

func (*AppError) Error

func (er *AppError) Error() string

func (*AppError) SystemMessage

func (er *AppError) SystemMessage(T i18n.TranslateFunc) string

func (*AppError) ToJSON

func (er *AppError) ToJSON() string

func (*AppError) Translate

func (er *AppError) Translate(T i18n.TranslateFunc)

type AppliedMigration added in v6.6.0

type AppliedMigration struct {
	Version int    `json:"version"`
	Name    string `json:"name"`
}

type Attribute

type Attribute struct {
	XMLName      xml.Name
	FriendlyName string           `xml:",attr"`
	Name         string           `xml:",attr"`
	NameFormat   string           `xml:",attr"`
	Values       []AttributeValue `xml:"AttributeValue"`
}

type AttributeValue

type AttributeValue struct {
	Type   string `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr"`
	Value  string `xml:",chardata"`
	NameID *NameID
}

type Audit

type Audit struct {
	Id        string `json:"id"`
	CreateAt  int64  `json:"create_at"`
	UserId    string `json:"user_id"`
	Action    string `json:"action"`
	ExtraInfo string `json:"extra_info"`
	IpAddress string `json:"ip_address"`
	SessionId string `json:"session_id"`
}

type Audits

type Audits []Audit

func (Audits) Etag

func (o Audits) Etag() string

type AuthData

type AuthData struct {
	ClientId    string `json:"client_id"`
	UserId      string `json:"user_id"`
	Code        string `json:"code"`
	ExpiresIn   int32  `json:"expires_in"`
	CreateAt    int64  `json:"create_at"`
	RedirectUri string `json:"redirect_uri"`
	State       string `json:"state"`
	Scope       string `json:"scope"`
}

func (*AuthData) IsExpired

func (ad *AuthData) IsExpired() bool

func (*AuthData) IsValid

func (ad *AuthData) IsValid() *AppError

IsValid validates the AuthData and returns an error if it isn't configured correctly.

func (*AuthData) PreSave

func (ad *AuthData) PreSave()

type AuthorizeRequest

type AuthorizeRequest struct {
	ResponseType string `json:"response_type"`
	ClientId     string `json:"client_id"`
	RedirectURI  string `json:"redirect_uri"`
	Scope        string `json:"scope"`
	State        string `json:"state"`
}

func (*AuthorizeRequest) IsValid

func (ar *AuthorizeRequest) IsValid() *AppError

IsValid validates the AuthorizeRequest and returns an error if it isn't configured correctly.

type AutocompleteArg

type AutocompleteArg struct {
	// Name of the argument
	Name string
	// Text displayed to the user to help with the autocomplete
	HelpText string
	// Type of the argument
	Type AutocompleteArgType
	// Required determines if argument is optional or not.
	Required bool
	// Actual data of the argument (depends on the Type)
	Data interface{}
}

AutocompleteArg describes an argument of the command. Arguments can be named or positional. If Name is empty string Argument is positional otherwise it is named argument. Named arguments are passed as --Name Argument_Value.

func (*AutocompleteArg) Equals

func (a *AutocompleteArg) Equals(arg *AutocompleteArg) bool

Equals method checks if argument is the same.

func (*AutocompleteArg) UnmarshalJSON

func (a *AutocompleteArg) UnmarshalJSON(b []byte) error

UnmarshalJSON will unmarshal argument

type AutocompleteArgType

type AutocompleteArgType string

AutocompleteArgType describes autocomplete argument type

const (
	AutocompleteArgTypeText        AutocompleteArgType = "TextInput"
	AutocompleteArgTypeStaticList  AutocompleteArgType = "StaticList"
	AutocompleteArgTypeDynamicList AutocompleteArgType = "DynamicList"
)

Argument types

type AutocompleteData

type AutocompleteData struct {
	// Trigger of the command
	Trigger string
	// Hint of a command
	Hint string
	// Text displayed to the user to help with the autocomplete description
	HelpText string
	// Role of the user who should be able to see the autocomplete info of this command
	RoleID string
	// Arguments of the command. Arguments can be named or positional.
	// If they are positional order in the list matters, if they are named order does not matter.
	// All arguments should be either named or positional, no mixing allowed.
	Arguments []*AutocompleteArg
	// Subcommands of the command
	SubCommands []*AutocompleteData
}

AutocompleteData describes slash command autocomplete information.

func NewAutocompleteData

func NewAutocompleteData(trigger, hint, helpText string) *AutocompleteData

NewAutocompleteData returns new Autocomplete data.

func (*AutocompleteData) AddCommand

func (ad *AutocompleteData) AddCommand(command *AutocompleteData)

AddCommand adds a subcommand to the autocomplete data.

func (*AutocompleteData) AddDynamicListArgument

func (ad *AutocompleteData) AddDynamicListArgument(helpText, url string, required bool)

AddDynamicListArgument adds positional AutocompleteArgTypeDynamicList argument to the command.

func (*AutocompleteData) AddNamedDynamicListArgument

func (ad *AutocompleteData) AddNamedDynamicListArgument(name, helpText, url string, required bool)

AddNamedDynamicListArgument adds named AutocompleteArgTypeDynamicList argument to the command.

func (*AutocompleteData) AddNamedStaticListArgument

func (ad *AutocompleteData) AddNamedStaticListArgument(name, helpText string, required bool, items []AutocompleteListItem)

AddNamedStaticListArgument adds named AutocompleteArgTypeStaticList argument to the command.

func (*AutocompleteData) AddNamedTextArgument

func (ad *AutocompleteData) AddNamedTextArgument(name, helpText, hint, pattern string, required bool)

AddNamedTextArgument adds named AutocompleteArgTypeText argument to the command.

func (*AutocompleteData) AddStaticListArgument

func (ad *AutocompleteData) AddStaticListArgument(helpText string, required bool, items []AutocompleteListItem)

AddStaticListArgument adds positional AutocompleteArgTypeStaticList argument to the command.

func (*AutocompleteData) AddTextArgument

func (ad *AutocompleteData) AddTextArgument(helpText, hint, pattern string)

AddTextArgument adds positional AutocompleteArgTypeText argument to the command.

func (*AutocompleteData) Equals

func (ad *AutocompleteData) Equals(command *AutocompleteData) bool

Equals method checks if command is the same.

func (*AutocompleteData) IsValid

func (ad *AutocompleteData) IsValid() error

IsValid method checks if autocomplete data is valid.

func (*AutocompleteData) UpdateRelativeURLsForPluginCommands

func (ad *AutocompleteData) UpdateRelativeURLsForPluginCommands(baseURL *url.URL) error

UpdateRelativeURLsForPluginCommands method updates relative urls for plugin commands

type AutocompleteDynamicListArg

type AutocompleteDynamicListArg struct {
	FetchURL string
}

AutocompleteDynamicListArg is used when user wants to download possible argument list from the URL.

type AutocompleteListItem

type AutocompleteListItem struct {
	Item     string
	Hint     string
	HelpText string
}

AutocompleteListItem describes an item in the AutocompleteStaticListArg.

type AutocompleteStaticListArg

type AutocompleteStaticListArg struct {
	PossibleArguments []AutocompleteListItem
}

AutocompleteStaticListArg is used to input one of the arguments from the list, for example [yes, no], [on, off], and so on.

type AutocompleteSuggestion

type AutocompleteSuggestion struct {
	// Complete describes completed suggestion
	Complete string
	// Suggestion describes what user might want to input next
	Suggestion string
	// Hint describes a hint about the suggested input
	Hint string
	// Description of the command or a suggestion
	Description string
	// IconData is base64 encoded svg image
	IconData string
}

AutocompleteSuggestion describes a single suggestion item sent to the front-end Example: for user input `/jira cre` - Complete might be `/jira create` Suggestion might be `create`, Hint might be `[issue text]`, Description might be `Create a new Issue`

type AutocompleteTextArg

type AutocompleteTextArg struct {
	// Hint of the input text
	Hint string
	// Regex pattern to match
	Pattern string
}

AutocompleteTextArg describes text user can input as an argument.

type BaseMarketplacePlugin

type BaseMarketplacePlugin struct {
	HomepageURL     string             `json:"homepage_url"`
	IconData        string             `json:"icon_data"`
	DownloadURL     string             `json:"download_url"`
	ReleaseNotesURL string             `json:"release_notes_url"`
	Labels          []MarketplaceLabel `json:"labels,omitempty"`
	Hosting         string             `json:"hosting"`       // Indicated if the plugin is limited to a certain hosting type
	AuthorType      string             `json:"author_type"`   // The maintainer of the plugin
	ReleaseStage    string             `json:"release_stage"` // The stage in the software release cycle that the plugin is in
	Enterprise      bool               `json:"enterprise"`    // Indicated if the plugin is an enterprise plugin
	Signature       string             `json:"signature"`     // Signature represents a signature of a plugin saved in base64 encoding.
	Manifest        *Manifest          `json:"manifest"`
}

BaseMarketplacePlugin is a Mattermost plugin received from the Marketplace server.

func BaseMarketplacePluginsFromReader

func BaseMarketplacePluginsFromReader(reader io.Reader) ([]*BaseMarketplacePlugin, error)

BaseMarketplacePluginsFromReader decodes a json-encoded list of plugins from the given io.Reader.

func (*BaseMarketplacePlugin) DecodeSignature

func (plugin *BaseMarketplacePlugin) DecodeSignature() (io.ReadSeeker, error)

DecodeSignature Decodes signature and returns ReadSeeker.

type BillingScheme

type BillingScheme string

type BleveSettings

type BleveSettings struct {
	IndexDir                      *string `access:"experimental_bleve"` // telemetry: none
	EnableIndexing                *bool   `access:"experimental_bleve"`
	EnableSearching               *bool   `access:"experimental_bleve"`
	EnableAutocomplete            *bool   `access:"experimental_bleve"`
	BulkIndexingTimeWindowSeconds *int    `json:",omitempty"` // telemetry: none
	BatchSize                     *int    `access:"experimental_bleve"`
}

func (*BleveSettings) SetDefaults

func (bs *BleveSettings) SetDefaults()

type Bot

type Bot struct {
	UserId         string `json:"user_id"`
	Username       string `json:"username"`
	DisplayName    string `json:"display_name,omitempty"`
	Description    string `json:"description,omitempty"`
	OwnerId        string `json:"owner_id"`
	LastIconUpdate int64  `json:"last_icon_update,omitempty"`
	CreateAt       int64  `json:"create_at"`
	UpdateAt       int64  `json:"update_at"`
	DeleteAt       int64  `json:"delete_at"`
}

Bot is a special type of User meant for programmatic interactions. Note that the primary key of a bot is the UserId, and matches the primary key of the corresponding user.

func BotFromUser

func BotFromUser(u *User) *Bot

BotFromUser returns a bot model given a user model

func (*Bot) Clone

func (b *Bot) Clone() *Bot

Clone returns a shallow copy of the bot.

func (*Bot) Etag

func (b *Bot) Etag() string

Etag generates an etag for caching.

func (*Bot) IsValid

func (b *Bot) IsValid() *AppError

IsValid validates the bot and returns an error if it isn't configured correctly.

func (*Bot) IsValidCreate added in v6.1.0

func (b *Bot) IsValidCreate() *AppError

IsValidCreate validates bot for Create call. This skips validations of fields that are auto-filled on Create

func (*Bot) Patch

func (b *Bot) Patch(patch *BotPatch)

Patch modifies an existing bot with optional fields from the given patch. TODO 6.0: consider returning a boolean to indicate whether or not the patch applied any changes.

func (*Bot) PreSave

func (b *Bot) PreSave()

PreSave should be run before saving a new bot to the database.

func (*Bot) PreUpdate

func (b *Bot) PreUpdate()

PreUpdate should be run before saving an updated bot to the database.

func (*Bot) Trace

func (b *Bot) Trace() map[string]interface{}

Trace describes the minimum information required to identify a bot for the purpose of logging.

func (*Bot) WouldPatch

func (b *Bot) WouldPatch(patch *BotPatch) bool

WouldPatch returns whether or not the given patch would be applied or not.

type BotGetOptions

type BotGetOptions struct {
	OwnerId        string
	IncludeDeleted bool
	OnlyOrphaned   bool
	Page           int
	PerPage        int
}

BotGetOptions acts as a filter on bulk bot fetching queries.

type BotList

type BotList []*Bot

BotList is a list of bots.

func (*BotList) Etag

func (l *BotList) Etag() string

Etag computes the etag for a list of bots.

type BotPatch

type BotPatch struct {
	Username    *string `json:"username"`
	DisplayName *string `json:"display_name"`
	Description *string `json:"description"`
}

BotPatch is a description of what fields to update on an existing bot.

type BulkExportOpts added in v6.5.0

type BulkExportOpts struct {
	IncludeAttachments bool
	CreateArchive      bool
}

type BundleInfo

type BundleInfo struct {
	Path string

	Manifest      *Manifest
	ManifestPath  string
	ManifestError error
}

func BundleInfoForPath

func BundleInfoForPath(path string) *BundleInfo

Returns bundle info for the given path. The return value is never nil.

func (*BundleInfo) WrapLogger

func (b *BundleInfo) WrapLogger(logger *mlog.Logger) *mlog.Logger

type CWSWebhookPayload

type CWSWebhookPayload struct {
	Event                             string               `json:"event"`
	FailedPayment                     *FailedPayment       `json:"failed_payment"`
	CloudWorkspaceOwner               *CloudWorkspaceOwner `json:"cloud_workspace_owner"`
	SubscriptionTrialEndUnixTimeStamp int64                `json:"trial_end_time_stamp"`
}

type Channel

type Channel struct {
	Id                string                 `json:"id"`
	CreateAt          int64                  `json:"create_at"`
	UpdateAt          int64                  `json:"update_at"`
	DeleteAt          int64                  `json:"delete_at"`
	TeamId            string                 `json:"team_id"`
	Type              ChannelType            `json:"type"`
	DisplayName       string                 `json:"display_name"`
	Name              string                 `json:"name"`
	Header            string                 `json:"header"`
	Purpose           string                 `json:"purpose"`
	LastPostAt        int64                  `json:"last_post_at"`
	TotalMsgCount     int64                  `json:"total_msg_count"`
	ExtraUpdateAt     int64                  `json:"extra_update_at"`
	CreatorId         string                 `json:"creator_id"`
	SchemeId          *string                `json:"scheme_id"`
	Props             map[string]interface{} `json:"props"`
	GroupConstrained  *bool                  `json:"group_constrained"`
	Shared            *bool                  `json:"shared"`
	TotalMsgCountRoot int64                  `json:"total_msg_count_root"`
	PolicyID          *string                `json:"policy_id"`
	LastRootPostAt    int64                  `json:"last_root_post_at"`
}

func (*Channel) AddProp

func (o *Channel) AddProp(key string, value interface{})

func (*Channel) CreateAt_ added in v6.5.0

func (o *Channel) CreateAt_() float64

func (*Channel) DeepCopy

func (o *Channel) DeepCopy() *Channel

func (*Channel) DeleteAt_ added in v6.5.0

func (o *Channel) DeleteAt_() float64

func (*Channel) Etag

func (o *Channel) Etag() string

func (*Channel) GetOtherUserIdForDM

func (o *Channel) GetOtherUserIdForDM(userId string) string

func (*Channel) IsGroupConstrained

func (o *Channel) IsGroupConstrained() bool

func (*Channel) IsGroupOrDirect

func (o *Channel) IsGroupOrDirect() bool

func (*Channel) IsOpen

func (o *Channel) IsOpen() bool

func (*Channel) IsShared

func (o *Channel) IsShared() bool

func (*Channel) IsValid

func (o *Channel) IsValid() *AppError

func (*Channel) LastPostAt_ added in v6.6.0

func (o *Channel) LastPostAt_() float64

func (*Channel) MakeNonNil

func (o *Channel) MakeNonNil()

func (*Channel) Patch

func (o *Channel) Patch(patch *ChannelPatch)

func (*Channel) PreSave

func (o *Channel) PreSave()

func (*Channel) PreUpdate

func (o *Channel) PreUpdate()

func (*Channel) TotalMsgCount_ added in v6.6.0

func (o *Channel) TotalMsgCount_() float64

func (*Channel) UpdateAt_ added in v6.5.0

func (o *Channel) UpdateAt_() float64

type ChannelCounts

type ChannelCounts struct {
	Counts      map[string]int64 `json:"counts"`
	CountsRoot  map[string]int64 `json:"counts_root"`
	UpdateTimes map[string]int64 `json:"update_times"`
}

func (*ChannelCounts) Etag

func (o *ChannelCounts) Etag() string

type ChannelData

type ChannelData struct {
	Channel *Channel       `json:"channel"`
	Member  *ChannelMember `json:"member"`
}

func (*ChannelData) Etag

func (o *ChannelData) Etag() string

type ChannelForExport

type ChannelForExport struct {
	Channel
	TeamName   string
	SchemeName *string
}

type ChannelList

type ChannelList []*Channel

func (*ChannelList) Etag

func (o *ChannelList) Etag() string

type ChannelListWithTeamData

type ChannelListWithTeamData []*ChannelWithTeamData

func (*ChannelListWithTeamData) Etag

func (o *ChannelListWithTeamData) Etag() string

type ChannelMember

type ChannelMember struct {
	ChannelId        string    `json:"channel_id"`
	UserId           string    `json:"user_id"`
	Roles            string    `json:"roles"`
	LastViewedAt     int64     `json:"last_viewed_at"`
	MsgCount         int64     `json:"msg_count"`
	MentionCount     int64     `json:"mention_count"`
	MentionCountRoot int64     `json:"mention_count_root"`
	MsgCountRoot     int64     `json:"msg_count_root"`
	NotifyProps      StringMap `json:"notify_props"`
	LastUpdateAt     int64     `json:"last_update_at"`
	SchemeGuest      bool      `json:"scheme_guest"`
	SchemeUser       bool      `json:"scheme_user"`
	SchemeAdmin      bool      `json:"scheme_admin"`
	ExplicitRoles    string    `json:"explicit_roles"`
}

func (*ChannelMember) GetRoles

func (o *ChannelMember) GetRoles() []string

func (*ChannelMember) IsChannelMuted

func (o *ChannelMember) IsChannelMuted() bool

func (*ChannelMember) IsValid

func (o *ChannelMember) IsValid() *AppError

func (*ChannelMember) LastUpdateAt_ added in v6.5.0

func (o *ChannelMember) LastUpdateAt_() float64

func (*ChannelMember) LastViewedAt_ added in v6.5.0

func (o *ChannelMember) LastViewedAt_() float64

func (*ChannelMember) MentionCountRoot_ added in v6.5.0

func (o *ChannelMember) MentionCountRoot_() float64

func (*ChannelMember) MentionCount_ added in v6.5.0

func (o *ChannelMember) MentionCount_() float64

func (*ChannelMember) MsgCount_ added in v6.5.0

func (o *ChannelMember) MsgCount_() float64

func (*ChannelMember) PreSave

func (o *ChannelMember) PreSave()

func (*ChannelMember) PreUpdate

func (o *ChannelMember) PreUpdate()

func (*ChannelMember) SetChannelMuted

func (o *ChannelMember) SetChannelMuted(muted bool)

type ChannelMemberCountByGroup

type ChannelMemberCountByGroup struct {
	GroupId                     string `json:"group_id"`
	ChannelMemberCount          int64  `json:"channel_member_count"`
	ChannelMemberTimezonesCount int64  `json:"channel_member_timezones_count"`
}

type ChannelMemberForExport

type ChannelMemberForExport struct {
	ChannelMember
	ChannelName string
	Username    string
}

type ChannelMemberHistory

type ChannelMemberHistory struct {
	ChannelId string
	UserId    string
	JoinTime  int64
	LeaveTime *int64
}

type ChannelMemberHistoryResult

type ChannelMemberHistoryResult struct {
	ChannelId string
	UserId    string
	JoinTime  int64
	LeaveTime *int64

	// these two fields are never set in the database - when we SELECT, we join on Users to get them
	UserEmail    string `db:"Email"`
	Username     string
	IsBot        bool
	UserDeleteAt int64
}

type ChannelMemberWithTeamData added in v6.2.0

type ChannelMemberWithTeamData struct {
	ChannelMember
	TeamDisplayName string `json:"team_display_name"`
	TeamName        string `json:"team_name"`
	TeamUpdateAt    int64  `json:"team_update_at"`
}

ChannelMemberWithTeamData contains ChannelMember appended with extra team information as well.

type ChannelMembers

type ChannelMembers []ChannelMember

type ChannelMembersWithTeamData added in v6.2.0

type ChannelMembersWithTeamData []ChannelMemberWithTeamData

type ChannelMentionMap

type ChannelMentionMap map[string]string

func ChannelMentionMapFromURLValues

func ChannelMentionMapFromURLValues(values url.Values) (ChannelMentionMap, error)

func (ChannelMentionMap) ToURLValues

func (m ChannelMentionMap) ToURLValues() url.Values

type ChannelModeratedRole

type ChannelModeratedRole struct {
	Value   bool `json:"value"`
	Enabled bool `json:"enabled"`
}

type ChannelModeratedRoles

type ChannelModeratedRoles struct {
	Guests  *ChannelModeratedRole `json:"guests"`
	Members *ChannelModeratedRole `json:"members"`
}

type ChannelModeratedRolesPatch

type ChannelModeratedRolesPatch struct {
	Guests  *bool `json:"guests"`
	Members *bool `json:"members"`
}

type ChannelModeration

type ChannelModeration struct {
	Name  string                 `json:"name"`
	Roles *ChannelModeratedRoles `json:"roles"`
}

type ChannelModerationPatch

type ChannelModerationPatch struct {
	Name  *string                     `json:"name"`
	Roles *ChannelModeratedRolesPatch `json:"roles"`
}

type ChannelOption

type ChannelOption func(channel *Channel)

func WithID

func WithID(ID string) ChannelOption

type ChannelPatch

type ChannelPatch struct {
	DisplayName      *string `json:"display_name"`
	Name             *string `json:"name"`
	Header           *string `json:"header"`
	Purpose          *string `json:"purpose"`
	GroupConstrained *bool   `json:"group_constrained"`
}

type ChannelSearch

type ChannelSearch struct {
	Term                     string   `json:"term"`
	ExcludeDefaultChannels   bool     `json:"exclude_default_channels"`
	NotAssociatedToGroup     string   `json:"not_associated_to_group"`
	TeamIds                  []string `json:"team_ids"`
	GroupConstrained         bool     `json:"group_constrained"`
	ExcludeGroupConstrained