model

package
v5.31.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: AGPL-3.0, Apache-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCESS_TOKEN_GRANT_TYPE  = "authorization_code"
	ACCESS_TOKEN_TYPE        = "bearer"
	REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
)
View Source
const (
	AUTHCODE_EXPIRE_TIME   = 60 * 10 // 10 minutes
	AUTHCODE_RESPONSE_TYPE = "code"
	IMPLICIT_RESPONSE_TYPE = "token"
	DEFAULT_SCOPE          = "user"
)
View Source
const (
	BOT_DISPLAY_NAME_MAX_RUNES   = USER_FIRST_NAME_MAX_RUNES
	BOT_DESCRIPTION_MAX_RUNES    = 1024
	BOT_CREATOR_ID_MAX_RUNES     = KEY_VALUE_PLUGIN_ID_MAX_RUNES // UserId or PluginId
	BOT_WARN_METRIC_BOT_USERNAME = "mattermost-advisor"
)
View Source
const (
	CHANNEL_OPEN                   = "O"
	CHANNEL_PRIVATE                = "P"
	CHANNEL_DIRECT                 = "D"
	CHANNEL_GROUP                  = "G"
	CHANNEL_GROUP_MAX_USERS        = 8
	CHANNEL_GROUP_MIN_USERS        = 3
	DEFAULT_CHANNEL                = "town-square"
	CHANNEL_DISPLAY_NAME_MAX_RUNES = 64
	CHANNEL_NAME_MIN_LENGTH        = 2
	CHANNEL_NAME_MAX_LENGTH        = 64
	CHANNEL_HEADER_MAX_RUNES       = 1024
	CHANNEL_PURPOSE_MAX_RUNES      = 250
	CHANNEL_CACHE_SIZE             = 25000

	CHANNEL_SORT_BY_USERNAME = "username"
	CHANNEL_SORT_BY_STATUS   = "status"
)
View Source
const (
	CHANNEL_NOTIFY_DEFAULT              = "default"
	CHANNEL_NOTIFY_ALL                  = "all"
	CHANNEL_NOTIFY_MENTION              = "mention"
	CHANNEL_NOTIFY_NONE                 = "none"
	CHANNEL_MARK_UNREAD_ALL             = "all"
	CHANNEL_MARK_UNREAD_MENTION         = "mention"
	IGNORE_CHANNEL_MENTIONS_DEFAULT     = "default"
	IGNORE_CHANNEL_MENTIONS_OFF         = "off"
	IGNORE_CHANNEL_MENTIONS_ON          = "on"
	IGNORE_CHANNEL_MENTIONS_NOTIFY_PROP = "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 (
	HEADER_REQUEST_ID         = "X-Request-ID"
	HEADER_VERSION_ID         = "X-Version-ID"
	HEADER_CLUSTER_ID         = "X-Cluster-ID"
	HEADER_ETAG_SERVER        = "ETag"
	HEADER_ETAG_CLIENT        = "If-None-Match"
	HEADER_FORWARDED          = "X-Forwarded-For"
	HEADER_REAL_IP            = "X-Real-IP"
	HEADER_FORWARDED_PROTO    = "X-Forwarded-Proto"
	HEADER_TOKEN              = "token"
	HEADER_CSRF_TOKEN         = "X-CSRF-Token"
	HEADER_BEARER             = "BEARER"
	HEADER_AUTH               = "Authorization"
	HEADER_CLOUD_TOKEN        = "X-Cloud-Token"
	HEADER_REQUESTED_WITH     = "X-Requested-With"
	HEADER_REQUESTED_WITH_XML = "XMLHttpRequest"
	STATUS                    = "status"
	STATUS_OK                 = "OK"
	STATUS_FAIL               = "FAIL"
	STATUS_UNHEALTHY          = "UNHEALTHY"
	STATUS_REMOVE             = "REMOVE"

	CLIENT_DIR = "client"

	API_URL_SUFFIX_V1 = "/api/v1"
	API_URL_SUFFIX_V4 = "/api/v4"
	API_URL_SUFFIX    = API_URL_SUFFIX_V4
)
View Source
const (
	EventTypeFailedPayment       = "failed-payment"
	EventTypeFailedPaymentNoCard = "failed-payment-no-card"
)
View Source
const (
	CDS_OFFLINE_AFTER_MILLIS = 1000 * 60 * 30 // 30 minutes
	CDS_TYPE_APP             = "mattermost_app"
)
View Source
const (
	CLUSTER_EVENT_PUBLISH                                           = "publish"
	CLUSTER_EVENT_UPDATE_STATUS                                     = "update_status"
	CLUSTER_EVENT_INVALIDATE_ALL_CACHES                             = "inv_all_caches"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS                    = "inv_reactions"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_WEBHOOK                      = "inv_webhook"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_POSTS                = "inv_channel_posts"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBERS_NOTIFY_PROPS = "inv_channel_members_notify_props"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBERS              = "inv_channel_members"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_BY_NAME              = "inv_channel_name"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL                      = "inv_channel"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_GUEST_COUNT          = "inv_channel_guest_count"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_USER                         = "inv_user"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_USER_TEAMS                   = "inv_user_teams"
	CLUSTER_EVENT_CLEAR_SESSION_CACHE_FOR_USER                      = "clear_session_user"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES                        = "inv_roles"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLE_PERMISSIONS             = "inv_role_permissions"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_PROFILE_BY_IDS               = "inv_profile_ids"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_PROFILE_IN_CHANNEL           = "inv_profile_in_channel"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_SCHEMES                      = "inv_schemes"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_FILE_INFOS                   = "inv_file_infos"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_WEBHOOKS                     = "inv_webhooks"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_EMOJIS_BY_ID                 = "inv_emojis_by_id"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_EMOJIS_ID_BY_NAME            = "inv_emojis_id_by_name"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_PINNEDPOSTS_COUNTS   = "inv_channel_pinnedposts_counts"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBER_COUNTS        = "inv_channel_member_counts"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_LAST_POSTS                   = "inv_last_posts"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_LAST_POST_TIME               = "inv_last_post_time"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_TEAMS                        = "inv_teams"
	CLUSTER_EVENT_CLEAR_SESSION_CACHE_FOR_ALL_USERS                 = "inv_all_user_sessions"
	CLUSTER_EVENT_INSTALL_PLUGIN                                    = "install_plugin"
	CLUSTER_EVENT_REMOVE_PLUGIN                                     = "remove_plugin"
	CLUSTER_EVENT_INVALIDATE_CACHE_FOR_TERMS_OF_SERVICE             = "inv_terms_of_service"
	CLUSTER_EVENT_BUSY_STATE_CHANGED                                = "busy_state_change"

	// Gossip communication
	CLUSTER_GOSSIP_EVENT_REQUEST_GET_LOGS             = "gossip_request_get_logs"
	CLUSTER_GOSSIP_EVENT_RESPONSE_GET_LOGS            = "gossip_response_get_logs"
	CLUSTER_GOSSIP_EVENT_REQUEST_GET_CLUSTER_STATS    = "gossip_request_cluster_stats"
	CLUSTER_GOSSIP_EVENT_RESPONSE_GET_CLUSTER_STATS   = "gossip_response_cluster_stats"
	CLUSTER_GOSSIP_EVENT_REQUEST_GET_PLUGIN_STATUSES  = "gossip_request_plugin_statuses"
	CLUSTER_GOSSIP_EVENT_RESPONSE_GET_PLUGIN_STATUSES = "gossip_response_plugin_statuses"
	CLUSTER_GOSSIP_EVENT_REQUEST_SAVE_CONFIG          = "gossip_request_save_config"
	CLUSTER_GOSSIP_EVENT_RESPONSE_SAVE_CONFIG         = "gossip_response_save_config"

	// SendTypes for ClusterMessage.
	CLUSTER_SEND_BEST_EFFORT = "best_effort"
	CLUSTER_SEND_RELIABLE    = "reliable"
)
View Source
const (
	COMMAND_METHOD_POST = "P"
	COMMAND_METHOD_GET  = "G"
	MIN_TRIGGER_LENGTH  = 1
	MAX_TRIGGER_LENGTH  = 128
)
View Source
const (
	COMMAND_RESPONSE_TYPE_IN_CHANNEL = "in_channel"
	COMMAND_RESPONSE_TYPE_EPHEMERAL  = "ephemeral"
)
View Source
const (
	COMPLIANCE_STATUS_CREATED  = "created"
	COMPLIANCE_STATUS_RUNNING  = "running"
	COMPLIANCE_STATUS_FINISHED = "finished"
	COMPLIANCE_STATUS_FAILED   = "failed"
	COMPLIANCE_STATUS_REMOVED  = "removed"

	COMPLIANCE_TYPE_DAILY = "daily"
	COMPLIANCE_TYPE_ADHOC = "adhoc"
)
View Source
const (
	CONN_SECURITY_NONE     = ""
	CONN_SECURITY_PLAIN    = "PLAIN"
	CONN_SECURITY_TLS      = "TLS"
	CONN_SECURITY_STARTTLS = "STARTTLS"

	IMAGE_DRIVER_LOCAL = "local"
	IMAGE_DRIVER_S3    = "amazons3"

	DATABASE_DRIVER_SQLITE   = "sqlite3"
	DATABASE_DRIVER_MYSQL    = "mysql"
	DATABASE_DRIVER_POSTGRES = "postgres"

	MINIO_ACCESS_KEY = "minioaccesskey"
	MINIO_SECRET_KEY = "miniosecretkey"
	MINIO_BUCKET     = "mattermost-test"

	PASSWORD_MAXIMUM_LENGTH = 64
	PASSWORD_MINIMUM_LENGTH = 5

	SERVICE_GITLAB    = "gitlab"
	SERVICE_GOOGLE    = "google"
	SERVICE_OFFICE365 = "office365"
	SERVICE_OPENID    = "openid"

	GENERIC_NO_CHANNEL_NOTIFICATION = "generic_no_channel"
	GENERIC_NOTIFICATION            = "generic"
	GENERIC_NOTIFICATION_SERVER     = "https://push-test.mattermost.com"
	MM_SUPPORT_ADVISOR_ADDRESS      = "support-advisor@mattermost.com"
	FULL_NOTIFICATION               = "full"
	ID_LOADED_NOTIFICATION          = "id_loaded"

	DIRECT_MESSAGE_ANY  = "any"
	DIRECT_MESSAGE_TEAM = "team"

	SHOW_USERNAME          = "username"
	SHOW_NICKNAME_FULLNAME = "nickname_full_name"
	SHOW_FULLNAME          = "full_name"

	PERMISSIONS_ALL           = "all"
	PERMISSIONS_CHANNEL_ADMIN = "channel_admin"
	PERMISSIONS_TEAM_ADMIN    = "team_admin"
	PERMISSIONS_SYSTEM_ADMIN  = "system_admin"

	FAKE_SETTING = "********************************"

	RESTRICT_EMOJI_CREATION_ALL          = "all"
	RESTRICT_EMOJI_CREATION_ADMIN        = "admin"
	RESTRICT_EMOJI_CREATION_SYSTEM_ADMIN = "system_admin"

	PERMISSIONS_DELETE_POST_ALL          = "all"
	PERMISSIONS_DELETE_POST_TEAM_ADMIN   = "team_admin"
	PERMISSIONS_DELETE_POST_SYSTEM_ADMIN = "system_admin"

	ALLOW_EDIT_POST_ALWAYS     = "always"
	ALLOW_EDIT_POST_NEVER      = "never"
	ALLOW_EDIT_POST_TIME_LIMIT = "time_limit"

	GROUP_UNREAD_CHANNELS_DISABLED    = "disabled"
	GROUP_UNREAD_CHANNELS_DEFAULT_ON  = "default_on"
	GROUP_UNREAD_CHANNELS_DEFAULT_OFF = "default_off"

	COLLAPSED_THREADS_DISABLED    = "disabled"
	COLLAPSED_THREADS_DEFAULT_ON  = "default_on"
	COLLAPSED_THREADS_DEFAULT_OFF = "default_off"

	EMAIL_BATCHING_BUFFER_SIZE = 256
	EMAIL_BATCHING_INTERVAL    = 30

	EMAIL_NOTIFICATION_CONTENTS_FULL    = "full"
	EMAIL_NOTIFICATION_CONTENTS_GENERIC = "generic"

	SITENAME_MAX_LENGTH = 30

	SERVICE_SETTINGS_DEFAULT_SITE_URL           = "http://localhost:8065"
	SERVICE_SETTINGS_DEFAULT_TLS_CERT_FILE      = ""
	SERVICE_SETTINGS_DEFAULT_TLS_KEY_FILE       = ""
	SERVICE_SETTINGS_DEFAULT_READ_TIMEOUT       = 300
	SERVICE_SETTINGS_DEFAULT_WRITE_TIMEOUT      = 300
	SERVICE_SETTINGS_DEFAULT_IDLE_TIMEOUT       = 60
	SERVICE_SETTINGS_DEFAULT_MAX_LOGIN_ATTEMPTS = 10
	SERVICE_SETTINGS_DEFAULT_ALLOW_CORS_FROM    = ""
	SERVICE_SETTINGS_DEFAULT_LISTEN_AND_ADDRESS = ":8065"
	SERVICE_SETTINGS_DEFAULT_GFYCAT_API_KEY     = "2_KtH_W5"
	SERVICE_SETTINGS_DEFAULT_GFYCAT_API_SECRET  = "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof"

	TEAM_SETTINGS_DEFAULT_SITE_NAME                = "Mattermost"
	TEAM_SETTINGS_DEFAULT_MAX_USERS_PER_TEAM       = 50
	TEAM_SETTINGS_DEFAULT_CUSTOM_BRAND_TEXT        = ""
	TEAM_SETTINGS_DEFAULT_CUSTOM_DESCRIPTION_TEXT  = ""
	TEAM_SETTINGS_DEFAULT_USER_STATUS_AWAY_TIMEOUT = 300

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

	FILE_SETTINGS_DEFAULT_DIRECTORY = "./data/"

	IMPORT_SETTINGS_DEFAULT_DIRECTORY      = "./import"
	IMPORT_SETTINGS_DEFAULT_RETENTION_DAYS = 30

	EMAIL_SETTINGS_DEFAULT_FEEDBACK_ORGANIZATION = ""

	SUPPORT_SETTINGS_DEFAULT_TERMS_OF_SERVICE_LINK = "https://about.mattermost.com/default-terms/"
	SUPPORT_SETTINGS_DEFAULT_PRIVACY_POLICY_LINK   = "https://about.mattermost.com/default-privacy-policy/"
	SUPPORT_SETTINGS_DEFAULT_ABOUT_LINK            = "https://about.mattermost.com/default-about/"
	SUPPORT_SETTINGS_DEFAULT_HELP_LINK             = "https://about.mattermost.com/default-help/"
	SUPPORT_SETTINGS_DEFAULT_REPORT_A_PROBLEM_LINK = "https://about.mattermost.com/default-report-a-problem/"
	SUPPORT_SETTINGS_DEFAULT_SUPPORT_EMAIL         = "feedback@mattermost.com"
	SUPPORT_SETTINGS_DEFAULT_RE_ACCEPTANCE_PERIOD  = 365

	LDAP_SETTINGS_DEFAULT_FIRST_NAME_ATTRIBUTE         = ""
	LDAP_SETTINGS_DEFAULT_LAST_NAME_ATTRIBUTE          = ""
	LDAP_SETTINGS_DEFAULT_EMAIL_ATTRIBUTE              = ""
	LDAP_SETTINGS_DEFAULT_USERNAME_ATTRIBUTE           = ""
	LDAP_SETTINGS_DEFAULT_NICKNAME_ATTRIBUTE           = ""
	LDAP_SETTINGS_DEFAULT_ID_ATTRIBUTE                 = ""
	LDAP_SETTINGS_DEFAULT_POSITION_ATTRIBUTE           = ""
	LDAP_SETTINGS_DEFAULT_LOGIN_FIELD_NAME             = ""
	LDAP_SETTINGS_DEFAULT_GROUP_DISPLAY_NAME_ATTRIBUTE = ""
	LDAP_SETTINGS_DEFAULT_GROUP_ID_ATTRIBUTE           = ""
	LDAP_SETTINGS_DEFAULT_PICTURE_ATTRIBUTE            = ""

	SAML_SETTINGS_DEFAULT_ID_ATTRIBUTE         = ""
	SAML_SETTINGS_DEFAULT_GUEST_ATTRIBUTE      = ""
	SAML_SETTINGS_DEFAULT_ADMIN_ATTRIBUTE      = ""
	SAML_SETTINGS_DEFAULT_FIRST_NAME_ATTRIBUTE = ""
	SAML_SETTINGS_DEFAULT_LAST_NAME_ATTRIBUTE  = ""
	SAML_SETTINGS_DEFAULT_EMAIL_ATTRIBUTE      = ""
	SAML_SETTINGS_DEFAULT_USERNAME_ATTRIBUTE   = ""
	SAML_SETTINGS_DEFAULT_NICKNAME_ATTRIBUTE   = ""
	SAML_SETTINGS_DEFAULT_LOCALE_ATTRIBUTE     = ""
	SAML_SETTINGS_DEFAULT_POSITION_ATTRIBUTE   = ""

	SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA1    = "RSAwithSHA1"
	SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA256  = "RSAwithSHA256"
	SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA512  = "RSAwithSHA512"
	SAML_SETTINGS_DEFAULT_SIGNATURE_ALGORITHM = SAML_SETTINGS_SIGNATURE_ALGORITHM_SHA1

	SAML_SETTINGS_CANONICAL_ALGORITHM_C14N    = "Canonical1.0"
	SAML_SETTINGS_CANONICAL_ALGORITHM_C14N11  = "Canonical1.1"
	SAML_SETTINGS_DEFAULT_CANONICAL_ALGORITHM = SAML_SETTINGS_CANONICAL_ALGORITHM_C14N

	NATIVEAPP_SETTINGS_DEFAULT_APP_DOWNLOAD_LINK         = "https://mattermost.com/download/#mattermostApps"
	NATIVEAPP_SETTINGS_DEFAULT_ANDROID_APP_DOWNLOAD_LINK = "https://about.mattermost.com/mattermost-android-app/"
	NATIVEAPP_SETTINGS_DEFAULT_IOS_APP_DOWNLOAD_LINK     = "https://about.mattermost.com/mattermost-ios-app/"

	EXPERIMENTAL_SETTINGS_DEFAULT_LINK_METADATA_TIMEOUT_MILLISECONDS = 5000

	ANALYTICS_SETTINGS_DEFAULT_MAX_USERS_FOR_STATISTICS = 2500

	ANNOUNCEMENT_SETTINGS_DEFAULT_BANNER_COLOR                    = "#f2a93b"
	ANNOUNCEMENT_SETTINGS_DEFAULT_BANNER_TEXT_COLOR               = "#333333"
	ANNOUNCEMENT_SETTINGS_DEFAULT_NOTICES_JSON_URL                = "https://notices.mattermost.com/"
	ANNOUNCEMENT_SETTINGS_DEFAULT_NOTICES_FETCH_FREQUENCY_SECONDS = 3600

	TEAM_SETTINGS_DEFAULT_TEAM_TEXT = "default"

	ELASTICSEARCH_SETTINGS_DEFAULT_CONNECTION_URL                    = "http://localhost:9200"
	ELASTICSEARCH_SETTINGS_DEFAULT_USERNAME                          = "elastic"
	ELASTICSEARCH_SETTINGS_DEFAULT_PASSWORD                          = "changeme"
	ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_REPLICAS               = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_SHARDS                 = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_CHANNEL_INDEX_REPLICAS            = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_CHANNEL_INDEX_SHARDS              = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_USER_INDEX_REPLICAS               = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_USER_INDEX_SHARDS                 = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_AGGREGATE_POSTS_AFTER_DAYS        = 365
	ELASTICSEARCH_SETTINGS_DEFAULT_POSTS_AGGREGATOR_JOB_START_TIME   = "03:00"
	ELASTICSEARCH_SETTINGS_DEFAULT_INDEX_PREFIX                      = ""
	ELASTICSEARCH_SETTINGS_DEFAULT_LIVE_INDEXING_BATCH_SIZE          = 1
	ELASTICSEARCH_SETTINGS_DEFAULT_BULK_INDEXING_TIME_WINDOW_SECONDS = 3600
	ELASTICSEARCH_SETTINGS_DEFAULT_REQUEST_TIMEOUT_SECONDS           = 30

	BLEVE_SETTINGS_DEFAULT_INDEX_DIR                         = ""
	BLEVE_SETTINGS_DEFAULT_BULK_INDEXING_TIME_WINDOW_SECONDS = 3600

	DATA_RETENTION_SETTINGS_DEFAULT_MESSAGE_RETENTION_DAYS  = 365
	DATA_RETENTION_SETTINGS_DEFAULT_FILE_RETENTION_DAYS     = 365
	DATA_RETENTION_SETTINGS_DEFAULT_DELETION_JOB_START_TIME = "02:00"

	PLUGIN_SETTINGS_DEFAULT_DIRECTORY          = "./plugins"
	PLUGIN_SETTINGS_DEFAULT_CLIENT_DIRECTORY   = "./client/plugins"
	PLUGIN_SETTINGS_DEFAULT_ENABLE_MARKETPLACE = true
	PLUGIN_SETTINGS_DEFAULT_MARKETPLACE_URL    = "https://api.integrations.mattermost.com"
	PLUGIN_SETTINGS_OLD_MARKETPLACE_URL        = "https://marketplace.integrations.mattermost.com"

	COMPLIANCE_EXPORT_TYPE_CSV             = "csv"
	COMPLIANCE_EXPORT_TYPE_ACTIANCE        = "actiance"
	COMPLIANCE_EXPORT_TYPE_GLOBALRELAY     = "globalrelay"
	COMPLIANCE_EXPORT_TYPE_GLOBALRELAY_ZIP = "globalrelay-zip"
	GLOBALRELAY_CUSTOMER_TYPE_A9           = "A9"
	GLOBALRELAY_CUSTOMER_TYPE_A10          = "A10"

	CLIENT_SIDE_CERT_CHECK_PRIMARY_AUTH   = "primary"
	CLIENT_SIDE_CERT_CHECK_SECONDARY_AUTH = "secondary"

	IMAGE_PROXY_TYPE_LOCAL      = "local"
	IMAGE_PROXY_TYPE_ATMOS_CAMO = "atmos/camo"

	GOOGLE_SETTINGS_DEFAULT_SCOPE             = "profile email"
	GOOGLE_SETTINGS_DEFAULT_AUTH_ENDPOINT     = "https://accounts.google.com/o/oauth2/v2/auth"
	GOOGLE_SETTINGS_DEFAULT_TOKEN_ENDPOINT    = "https://www.googleapis.com/oauth2/v4/token"
	GOOGLE_SETTINGS_DEFAULT_USER_API_ENDPOINT = "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata"

	OFFICE365_SETTINGS_DEFAULT_SCOPE             = "User.Read"
	OFFICE365_SETTINGS_DEFAULT_AUTH_ENDPOINT     = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
	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"
	OPENID_SETTINGS_DEFAULT_SCOPE  = "profile openid email"

	LOCAL_MODE_SOCKET_PATH = "/var/tmp/mattermost_local.socket"
)
View Source
const (
	EMOJI_NAME_MAX_LENGTH = 64
	EMOJI_SORT_BY_NAME    = "name"
)
View Source
const (
	FILEINFO_SORT_BY_CREATED = "CreateAt"
	FILEINFO_SORT_BY_SIZE    = "Size"
)
View Source
const (
	GroupSourceLdap GroupSource = "ldap"

	GroupNameMaxLength        = 64
	GroupSourceMaxLength      = 64
	GroupDisplayNameMaxLength = 128
	GroupDescriptionMaxLength = 1024
	GroupRemoteIDMaxLength    = 48
)
View Source
const (
	POST_ACTION_TYPE_BUTTON                         = "button"
	POST_ACTION_TYPE_SELECT                         = "select"
	INTERACTIVE_DIALOG_TRIGGER_TIMEOUT_MILLISECONDS = 3000
)
View Source
const (
	JOB_TYPE_DATA_RETENTION                 = "data_retention"
	JOB_TYPE_MESSAGE_EXPORT                 = "message_export"
	JOB_TYPE_ELASTICSEARCH_POST_INDEXING    = "elasticsearch_post_indexing"
	JOB_TYPE_ELASTICSEARCH_POST_AGGREGATION = "elasticsearch_post_aggregation"
	JOB_TYPE_BLEVE_POST_INDEXING            = "bleve_post_indexing"
	JOB_TYPE_LDAP_SYNC                      = "ldap_sync"
	JOB_TYPE_MIGRATIONS                     = "migrations"
	JOB_TYPE_PLUGINS                        = "plugins"
	JOB_TYPE_EXPIRY_NOTIFY                  = "expiry_notify"
	JOB_TYPE_PRODUCT_NOTICES                = "product_notices"
	JOB_TYPE_ACTIVE_USERS                   = "active_users"
	JOB_TYPE_IMPORT_PROCESS                 = "import_process"
	JOB_TYPE_CLOUD                          = "cloud"

	JOB_STATUS_PENDING          = "pending"
	JOB_STATUS_IN_PROGRESS      = "in_progress"
	JOB_STATUS_SUCCESS          = "success"
	JOB_STATUS_ERROR            = "error"
	JOB_STATUS_CANCEL_REQUESTED = "cancel_requested"
	JOB_STATUS_CANCELED         = "canceled"
	JOB_STATUS_WARNING          = "warning"
)
View Source
const (
	USER_AUTH_SERVICE_LDAP       = "ldap"
	LDAP_PUBLIC_CERTIFICATE_NAME = "ldap-public.crt"
	LDAP_PRIVATE_KEY_NAME        = "ldap-private.key"
)
View Source
const (
	EXPIRED_LICENSE_ERROR = "api.license.add_license.expired.app_error"
	INVALID_LICENSE_ERROR = "api.license.add_license.invalid.app_error"
	LICENSE_GRACE_PERIOD  = 1000 * 60 * 60 * 24 * 10 //10 days
	LICENSE_RENEWAL_LINK  = "https://mattermost.com/renew/"
)
View Source
const (
	LINK_METADATA_TYPE_IMAGE     LinkMetadataType = "image"
	LINK_METADATA_TYPE_NONE      LinkMetadataType = "none"
	LINK_METADATA_TYPE_OPENGRAPH LinkMetadataType = "opengraph"
	MAX_IMAGES                   int              = 5
)
View Source
const (
	ADVANCED_PERMISSIONS_MIGRATION_KEY         = "AdvancedPermissionsMigrationComplete"
	MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2 = "migration_advanced_permissions_phase_2"

	MIGRATION_KEY_EMOJI_PERMISSIONS_SPLIT                     = "emoji_permissions_split"
	MIGRATION_KEY_WEBHOOK_PERMISSIONS_SPLIT                   = "webhook_permissions_split"
	MIGRATION_KEY_LIST_JOIN_PUBLIC_PRIVATE_TEAMS              = "list_join_public_private_teams"
	MIGRATION_KEY_REMOVE_PERMANENT_DELETE_USER                = "remove_permanent_delete_user"
	MIGRATION_KEY_ADD_BOT_PERMISSIONS                         = "add_bot_permissions"
	MIGRATION_KEY_APPLY_CHANNEL_MANAGE_DELETE_TO_CHANNEL_USER = "apply_channel_manage_delete_to_channel_user"
	MIGRATION_KEY_REMOVE_CHANNEL_MANAGE_DELETE_FROM_TEAM_USER = "remove_channel_manage_delete_from_team_user"
	MIGRATION_KEY_VIEW_MEMBERS_NEW_PERMISSION                 = "view_members_new_permission"
	MIGRATION_KEY_ADD_MANAGE_GUESTS_PERMISSIONS               = "add_manage_guests_permissions"
	MIGRATION_KEY_CHANNEL_MODERATIONS_PERMISSIONS             = "channel_moderations_permissions"
	MIGRATION_KEY_ADD_USE_GROUP_MENTIONS_PERMISSION           = "add_use_group_mentions_permission"
	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_BILLING_PERMISSIONS                     = "add_billing_permissions"
	MIGRATION_KEY_ADD_MANAGE_SHARED_CHANNEL_PERMISSIONS       = "manage_shared_channel_permissions"
	MIGRATION_KEY_ADD_MANAGE_REMOTE_CLUSTERS_PERMISSIONS      = "manage_remote_clusters_permissions"
)
View Source
const (
	OAUTH_ACTION_SIGNUP       = "signup"
	OAUTH_ACTION_LOGIN        = "login"
	OAUTH_ACTION_EMAIL_TO_SSO = "email_to_sso"
	OAUTH_ACTION_SSO_TO_EMAIL = "sso_to_email"
	OAUTH_ACTION_MOBILE       = "mobile"
)
View Source
const (
	PermissionScopeSystem  = "system_scope"
	PermissionScopeTeam    = "team_scope"
	PermissionScopeChannel = "channel_scope"
)
View Source
const (
	KEY_VALUE_PLUGIN_ID_MAX_RUNES = 190
	KEY_VALUE_KEY_MAX_RUNES       = 50
)
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 (
	POST_SYSTEM_MESSAGE_PREFIX  = "system_"
	POST_DEFAULT                = ""
	POST_SLACK_ATTACHMENT       = "slack_attachment"
	POST_SYSTEM_GENERIC         = "system_generic"
	POST_JOIN_LEAVE             = "system_join_leave" // Deprecated, use POST_JOIN_CHANNEL or POST_LEAVE_CHANNEL instead
	POST_JOIN_CHANNEL           = "system_join_channel"
	POST_GUEST_JOIN_CHANNEL     = "system_guest_join_channel"
	POST_LEAVE_CHANNEL          = "system_leave_channel"
	POST_JOIN_TEAM              = "system_join_team"
	POST_LEAVE_TEAM             = "system_leave_team"
	POST_AUTO_RESPONDER         = "system_auto_responder"
	POST_ADD_REMOVE             = "system_add_remove" // Deprecated, use POST_ADD_TO_CHANNEL or POST_REMOVE_FROM_CHANNEL instead
	POST_ADD_TO_CHANNEL         = "system_add_to_channel"
	POST_ADD_GUEST_TO_CHANNEL   = "system_add_guest_to_chan"
	POST_REMOVE_FROM_CHANNEL    = "system_remove_from_channel"
	POST_MOVE_CHANNEL           = "system_move_channel"
	POST_ADD_TO_TEAM            = "system_add_to_team"
	POST_REMOVE_FROM_TEAM       = "system_remove_from_team"
	POST_HEADER_CHANGE          = "system_header_change"
	POST_DISPLAYNAME_CHANGE     = "system_displayname_change"
	POST_CONVERT_CHANNEL        = "system_convert_channel"
	POST_PURPOSE_CHANGE         = "system_purpose_change"
	POST_CHANNEL_DELETED        = "system_channel_deleted"
	POST_CHANNEL_RESTORED       = "system_channel_restored"
	POST_EPHEMERAL              = "system_ephemeral"
	POST_CHANGE_CHANNEL_PRIVACY = "system_change_chan_privacy"
	POST_ADD_BOT_TEAMS_CHANNELS = "add_bot_teams_channels"
	POST_MAX_FILES              = 10
	POST_FILEIDS_MAX_RUNES      = 300
	POST_FILENAMES_MAX_RUNES    = 4000
	POST_HASHTAGS_MAX_RUNES     = 1000
	POST_MESSAGE_MAX_RUNES_V1   = 4000
	POST_MESSAGE_MAX_BYTES_V2   = 65535                         // Maximum size of a TEXT column in MySQL
	POST_MESSAGE_MAX_RUNES_V2   = POST_MESSAGE_MAX_BYTES_V2 / 4 // Assume a worst-case representation
	POST_PROPS_MAX_RUNES        = 8000
	POST_PROPS_MAX_USER_RUNES   = POST_PROPS_MAX_RUNES - 400 // Leave some room for system / pre-save modifications
	POST_CUSTOM_TYPE_PREFIX     = "custom_"
	POST_ME                     = "me"
	PROPS_ADD_CHANNEL_MEMBER    = "add_channel_member"

	POST_PROPS_ADDED_USER_ID       = "addedUserId"
	POST_PROPS_DELETE_BY           = "deleteBy"
	POST_PROPS_OVERRIDE_ICON_URL   = "override_icon_url"
	POST_PROPS_OVERRIDE_ICON_EMOJI = "override_icon_emoji"

	POST_PROPS_MENTION_HIGHLIGHT_DISABLED = "mentionHighlightDisabled"
	POST_PROPS_GROUP_HIGHLIGHT_DISABLED   = "disable_group_highlight"
	POST_SYSTEM_WARN_METRIC_STATUS        = "warn_metric_status"
)
View Source
const (
	PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW        = "direct_channel_show"
	PREFERENCE_CATEGORY_GROUP_CHANNEL_SHOW         = "group_channel_show"
	PREFERENCE_CATEGORY_TUTORIAL_STEPS             = "tutorial_step"
	PREFERENCE_CATEGORY_ADVANCED_SETTINGS          = "advanced_settings"
	PREFERENCE_CATEGORY_FLAGGED_POST               = "flagged_post"
	PREFERENCE_CATEGORY_FAVORITE_CHANNEL           = "favorite_channel"
	PREFERENCE_CATEGORY_SIDEBAR_SETTINGS           = "sidebar_settings"
	PREFERENCE_CATEGORY_COLLAPSED_THREADS_SETTINGS = "collapsed_threads_settings"

	PREFERENCE_CATEGORY_DISPLAY_SETTINGS      = "display_settings"
	PREFERENCE_NAME_COLLAPSED_THREADS_ENABLED = "collapsed_threads_enabled"
	PREFERENCE_NAME_CHANNEL_DISPLAY_MODE      = "channel_display_mode"
	PREFERENCE_NAME_COLLAPSE_SETTING          = "collapse_previews"
	PREFERENCE_NAME_MESSAGE_DISPLAY           = "message_display"
	PREFERENCE_NAME_NAME_FORMAT               = "name_format"
	PREFERENCE_NAME_USE_MILITARY_TIME         = "use_military_time"

	PREFERENCE_CATEGORY_THEME = "theme"

	PREFERENCE_CATEGORY_AUTHORIZED_OAUTH_APP = "oauth_app"

	PREFERENCE_CATEGORY_LAST     = "last"
	PREFERENCE_NAME_LAST_CHANNEL = "channel"
	PREFERENCE_NAME_LAST_TEAM    = "team"

	PREFERENCE_CATEGORY_NOTIFICATIONS = "notifications"
	PREFERENCE_NAME_EMAIL_INTERVAL    = "email_interval"

	PREFERENCE_EMAIL_INTERVAL_NO_BATCHING_SECONDS = "30"  // the "immediate" setting is actually 30s
	PREFERENCE_EMAIL_INTERVAL_BATCHING_SECONDS    = "900" // fifteen minutes is 900 seconds
	PREFERENCE_EMAIL_INTERVAL_IMMEDIATELY         = "immediately"
	PREFERENCE_EMAIL_INTERVAL_FIFTEEN             = "fifteen"
	PREFERENCE_EMAIL_INTERVAL_FIFTEEN_AS_SECONDS  = "900"
	PREFERENCE_EMAIL_INTERVAL_HOUR                = "hour"
	PREFERENCE_EMAIL_INTERVAL_HOUR_AS_SECONDS     = "3600"
)
View Source
const (
	PUSH_NOTIFY_APPLE                = "apple"
	PUSH_NOTIFY_ANDROID              = "android"
	PUSH_NOTIFY_APPLE_REACT_NATIVE   = "apple_rn"
	PUSH_NOTIFY_ANDROID_REACT_NATIVE = "android_rn"

	PUSH_TYPE_MESSAGE      = "message"
	PUSH_TYPE_CLEAR        = "clear"
	PUSH_TYPE_UPDATE_BADGE = "update_badge"
	PUSH_TYPE_SESSION      = "session"
	PUSH_MESSAGE_V2        = "v2"

	PUSH_SOUND_NONE = "none"

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

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

	PUSH_SEND_PREPARE = "Prepared to send"
	PUSH_SEND_SUCCESS = "Successful"
	PUSH_NOT_SENT     = "Not Sent due to preferences"
	PUSH_RECEIVED     = "Received by device"
)
View Source
const (
	PUSH_STATUS           = "status"
	PUSH_STATUS_OK        = "OK"
	PUSH_STATUS_FAIL      = "FAIL"
	PUSH_STATUS_REMOVE    = "REMOVE"
	PUSH_STATUS_ERROR_MSG = "error"
)
View Source
const (
	SYSTEM_GUEST_ROLE_ID             = "system_guest"
	SYSTEM_USER_ROLE_ID              = "system_user"
	SYSTEM_ADMIN_ROLE_ID             = "system_admin"
	SYSTEM_POST_ALL_ROLE_ID          = "system_post_all"
	SYSTEM_POST_ALL_PUBLIC_ROLE_ID   = "system_post_all_public"
	SYSTEM_USER_ACCESS_TOKEN_ROLE_ID = "system_user_access_token"
	SYSTEM_USER_MANAGER_ROLE_ID      = "system_user_manager"
	SYSTEM_READ_ONLY_ADMIN_ROLE_ID   = "system_read_only_admin"
	SYSTEM_MANAGER_ROLE_ID           = "system_manager"

	TEAM_GUEST_ROLE_ID           = "team_guest"
	TEAM_USER_ROLE_ID            = "team_user"
	TEAM_ADMIN_ROLE_ID           = "team_admin"
	TEAM_POST_ALL_ROLE_ID        = "team_post_all"
	TEAM_POST_ALL_PUBLIC_ROLE_ID = "team_post_all_public"

	CHANNEL_GUEST_ROLE_ID = "channel_guest"
	CHANNEL_USER_ROLE_ID  = "channel_user"
	CHANNEL_ADMIN_ROLE_ID = "channel_admin"

	ROLE_NAME_MAX_LENGTH         = 64
	ROLE_DISPLAY_NAME_MAX_LENGTH = 128
	ROLE_DESCRIPTION_MAX_LENGTH  = 1024

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

	RoleTypeGuest RoleType = "Guest"
	RoleTypeUser  RoleType = "User"
	RoleTypeAdmin RoleType = "Admin"
)
View Source
const (
	USER_AUTH_SERVICE_SAML      = "saml"
	USER_AUTH_SERVICE_SAML_TEXT = "SAML"
	USER_AUTH_SERVICE_IS_SAML   = "isSaml"
	USER_AUTH_SERVICE_IS_MOBILE = "isMobile"
	USER_AUTH_SERVICE_IS_OAUTH  = "isOAuthUser"
)
View Source
const (
	SCHEME_DISPLAY_NAME_MAX_LENGTH = 128
	SCHEME_NAME_MAX_LENGTH         = 64
	SCHEME_DESCRIPTION_MAX_LENGTH  = 1024
	SCHEME_SCOPE_TEAM              = "team"
	SCHEME_SCOPE_CHANNEL           = "channel"
)
View Source
const (
	SESSION_COOKIE_TOKEN              = "MMAUTHTOKEN"
	SESSION_COOKIE_USER               = "MMUSERID"
	SESSION_COOKIE_CSRF               = "MMCSRF"
	SESSION_CACHE_SIZE                = 35000
	SESSION_PROP_PLATFORM             = "platform"
	SESSION_PROP_OS                   = "os"
	SESSION_PROP_BROWSER              = "browser"
	SESSION_PROP_TYPE                 = "type"
	SESSION_PROP_USER_ACCESS_TOKEN_ID = "user_access_token_id"
	SESSION_PROP_IS_BOT               = "is_bot"
	SESSION_PROP_IS_BOT_VALUE         = "true"
	SESSION_TYPE_USER_ACCESS_TOKEN    = "UserAccessToken"
	SESSION_TYPE_CLOUD_KEY            = "CloudKey"
	SESSION_PROP_IS_GUEST             = "is_guest"
	SESSION_ACTIVITY_TIMEOUT          = 1000 * 60 * 5 // 5 minutes
	SESSION_USER_ACCESS_TOKEN_EXPIRY  = 100 * 365     // 100 years
)
View Source
const (
	STATUS_OUT_OF_OFFICE   = "ooo"
	STATUS_OFFLINE         = "offline"
	STATUS_AWAY            = "away"
	STATUS_DND             = "dnd"
	STATUS_ONLINE          = "online"
	STATUS_CACHE_SIZE      = SESSION_CACHE_SIZE
	STATUS_CHANNEL_TIMEOUT = 20000  // 20 seconds
	STATUS_MIN_UPDATE_TIME = 120000 // 2 minutes
)
View Source
const (
	SYSTEM_TELEMETRY_ID                           = "DiagnosticId"
	SYSTEM_RAN_UNIT_TESTS                         = "RanUnitTests"
	SYSTEM_LAST_SECURITY_TIME                     = "LastSecurityTime"
	SYSTEM_ACTIVE_LICENSE_ID                      = "ActiveLicenseId"
	SYSTEM_LICENSE_RENEWAL_TOKEN                  = "LicenseRenewalToken"
	SYSTEM_LAST_COMPLIANCE_TIME                   = "LastComplianceTime"
	SYSTEM_ASYMMETRIC_SIGNING_KEY                 = "AsymmetricSigningKey"
	SYSTEM_POST_ACTION_COOKIE_SECRET              = "PostActionCookieSecret"
	SYSTEM_INSTALLATION_DATE_KEY                  = "InstallationDate"
	SYSTEM_FIRST_SERVER_RUN_TIMESTAMP_KEY         = "FirstServerRunTimestamp"
	SYSTEM_CLUSTER_ENCRYPTION_KEY                 = "ClusterEncryptionKey"
	SYSTEM_UPGRADED_FROM_TE_ID                    = "UpgradedFromTE"
	SYSTEM_WARN_METRIC_NUMBER_OF_TEAMS_5          = "warn_metric_number_of_teams_5"
	SYSTEM_WARN_METRIC_NUMBER_OF_CHANNELS_50      = "warn_metric_number_of_channels_50"
	SYSTEM_WARN_METRIC_MFA                        = "warn_metric_mfa"
	SYSTEM_WARN_METRIC_EMAIL_DOMAIN               = "warn_metric_email_domain"
	SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_100 = "warn_metric_number_of_active_users_100"
	SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_200 = "warn_metric_number_of_active_users_200"
	SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_300 = "warn_metric_number_of_active_users_300"
	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"
	OVER_USER_LIMIT_LAST_EMAIL_SENT               = "OverUserLimitLastEmailSent"
)
View Source
const (
	WARN_METRIC_STATUS_LIMIT_REACHED      = "true"
	WARN_METRIC_STATUS_RUNONCE            = "runonce"
	WARN_METRIC_STATUS_ACK                = "ack"
	WARN_METRIC_STATUS_STORE_PREFIX       = "warn_metric_"
	WARN_METRIC_JOB_INTERVAL              = 24 * 7
	WARN_METRIC_NUMBER_OF_ACTIVE_USERS_25 = 25
	WARN_METRIC_JOB_WAIT_TIME             = 1000 * 3600 * 24 * 7 // 7 days
)
View Source
const (
	TEAM_OPEN                       = "O"
	TEAM_INVITE                     = "I"
	TEAM_ALLOWED_DOMAINS_MAX_LENGTH = 500
	TEAM_COMPANY_NAME_MAX_LENGTH    = 64
	TEAM_DESCRIPTION_MAX_LENGTH     = 255
	TEAM_DISPLAY_NAME_MAX_RUNES     = 64
	TEAM_EMAIL_MAX_LENGTH           = 128
	TEAM_NAME_MAX_LENGTH            = 64
	TEAM_NAME_MIN_LENGTH            = 2
)
View Source
const (
	TOKEN_SIZE            = 64
	MAX_TOKEN_EXIPRY_TIME = 1000 * 60 * 60 * 48 // 48 hour
	TOKEN_TYPE_OAUTH      = "oauth"
)
View Source
const (
	ME                                 = "me"
	USER_NOTIFY_ALL                    = "all"
	USER_NOTIFY_HERE                   = "here"
	USER_NOTIFY_MENTION                = "mention"
	USER_NOTIFY_NONE                   = "none"
	DESKTOP_NOTIFY_PROP                = "desktop"
	DESKTOP_SOUND_NOTIFY_PROP          = "desktop_sound"
	MARK_UNREAD_NOTIFY_PROP            = "mark_unread"
	PUSH_NOTIFY_PROP                   = "push"
	PUSH_STATUS_NOTIFY_PROP            = "push_status"
	EMAIL_NOTIFY_PROP                  = "email"
	CHANNEL_MENTIONS_NOTIFY_PROP       = "channel"
	COMMENTS_NOTIFY_PROP               = "comments"
	MENTION_KEYS_NOTIFY_PROP           = "mention_keys"
	COMMENTS_NOTIFY_NEVER              = "never"
	COMMENTS_NOTIFY_ROOT               = "root"
	COMMENTS_NOTIFY_ANY                = "any"
	FIRST_NAME_NOTIFY_PROP             = "first_name"
	AUTO_RESPONDER_ACTIVE_NOTIFY_PROP  = "auto_responder_active"
	AUTO_RESPONDER_MESSAGE_NOTIFY_PROP = "auto_responder_message"

	DEFAULT_LOCALE          = "en"
	USER_AUTH_SERVICE_EMAIL = "email"

	USER_EMAIL_MAX_LENGTH     = 128
	USER_NICKNAME_MAX_RUNES   = 64
	USER_POSITION_MAX_RUNES   = 128
	USER_FIRST_NAME_MAX_RUNES = 64
	USER_LAST_NAME_MAX_RUNES  = 64
	USER_AUTH_DATA_MAX_LENGTH = 128
	USER_NAME_MAX_LENGTH      = 64
	USER_NAME_MIN_LENGTH      = 1
	USER_PASSWORD_MAX_LENGTH  = 72
	USER_LOCALE_MAX_LENGTH    = 5
)
View Source
const (
	LOWERCASE_LETTERS = "abcdefghijklmnopqrstuvwxyz"
	UPPERCASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	NUMBERS           = "0123456789"
	SYMBOLS           = " !\"\\#$%&'()*+,-./:;<=>?@[]^_`|~"
)
View Source
const (
	SOCKET_MAX_MESSAGE_SIZE_KB  = 8 * 1024 // 8KB
	PING_TIMEOUT_BUFFER_SECONDS = 5
)
View Source
const (
	WEBSOCKET_EVENT_TYPING                                   = "typing"
	WEBSOCKET_EVENT_POSTED                                   = "posted"
	WEBSOCKET_EVENT_POST_EDITED                              = "post_edited"
	WEBSOCKET_EVENT_POST_DELETED                             = "post_deleted"
	WEBSOCKET_EVENT_POST_UNREAD                              = "post_unread"
	WEBSOCKET_EVENT_CHANNEL_CONVERTED                        = "channel_converted"
	WEBSOCKET_EVENT_CHANNEL_CREATED                          = "channel_created"
	WEBSOCKET_EVENT_CHANNEL_DELETED                          = "channel_deleted"
	WEBSOCKET_EVENT_CHANNEL_RESTORED                         = "channel_restored"
	WEBSOCKET_EVENT_CHANNEL_UPDATED                          = "channel_updated"
	WEBSOCKET_EVENT_CHANNEL_MEMBER_UPDATED                   = "channel_member_updated"
	WEBSOCKET_EVENT_CHANNEL_SCHEME_UPDATED                   = "channel_scheme_updated"
	WEBSOCKET_EVENT_DIRECT_ADDED                             = "direct_added"
	WEBSOCKET_EVENT_GROUP_ADDED                              = "group_added"
	WEBSOCKET_EVENT_NEW_USER                                 = "new_user"
	WEBSOCKET_EVENT_ADDED_TO_TEAM                            = "added_to_team"
	WEBSOCKET_EVENT_LEAVE_TEAM                               = "leave_team"
	WEBSOCKET_EVENT_UPDATE_TEAM                              = "update_team"
	WEBSOCKET_EVENT_DELETE_TEAM                              = "delete_team"
	WEBSOCKET_EVENT_RESTORE_TEAM                             = "restore_team"
	WEBSOCKET_EVENT_UPDATE_TEAM_SCHEME                       = "update_team_scheme"
	WEBSOCKET_EVENT_USER_ADDED                               = "user_added"
	WEBSOCKET_EVENT_USER_UPDATED                             = "user_updated"
	WEBSOCKET_EVENT_USER_ROLE_UPDATED                        = "user_role_updated"
	WEBSOCKET_EVENT_MEMBERROLE_UPDATED                       = "memberrole_updated"
	WEBSOCKET_EVENT_USER_REMOVED                             = "user_removed"
	WEBSOCKET_EVENT_PREFERENCE_CHANGED                       = "preference_changed"
	WEBSOCKET_EVENT_PREFERENCES_CHANGED                      = "preferences_changed"
	WEBSOCKET_EVENT_PREFERENCES_DELETED                      = "preferences_deleted"
	WEBSOCKET_EVENT_EPHEMERAL_MESSAGE                        = "ephemeral_message"
	WEBSOCKET_EVENT_STATUS_CHANGE                            = "status_change"
	WEBSOCKET_EVENT_HELLO                                    = "hello"
	WEBSOCKET_AUTHENTICATION_CHALLENGE                       = "authentication_challenge"
	WEBSOCKET_EVENT_REACTION_ADDED                           = "reaction_added"
	WEBSOCKET_EVENT_REACTION_REMOVED                         = "reaction_removed"
	WEBSOCKET_EVENT_RESPONSE                                 = "response"
	WEBSOCKET_EVENT_EMOJI_ADDED                              = "emoji_added"
	WEBSOCKET_EVENT_CHANNEL_VIEWED                           = "channel_viewed"
	WEBSOCKET_EVENT_PLUGIN_STATUSES_CHANGED                  = "plugin_statuses_changed"
	WEBSOCKET_EVENT_PLUGIN_ENABLED                           = "plugin_enabled"
	WEBSOCKET_EVENT_PLUGIN_DISABLED                          = "plugin_disabled"
	WEBSOCKET_EVENT_ROLE_UPDATED                             = "role_updated"
	WEBSOCKET_EVENT_LICENSE_CHANGED                          = "license_changed"
	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"
	WEBSOCKET_EVENT_RECEIVED_GROUP_ASSOCIATED_TO_CHANNEL     = "received_group_associated_to_channel"
	WEBSOCKET_EVENT_RECEIVED_GROUP_NOT_ASSOCIATED_TO_CHANNEL = "received_group_not_associated_to_channel"
	WEBSOCKET_EVENT_SIDEBAR_CATEGORY_CREATED                 = "sidebar_category_created"
	WEBSOCKET_EVENT_SIDEBAR_CATEGORY_UPDATED                 = "sidebar_category_updated"
	WEBSOCKET_EVENT_SIDEBAR_CATEGORY_DELETED                 = "sidebar_category_deleted"
	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"
	WEBSOCKET_EVENT_THREAD_UPDATED                           = "thread_updated"
	WEBSOCKET_EVENT_THREAD_FOLLOW_CHANGED                    = "thread_follow_changed"
	WEBSOCKET_EVENT_THREAD_READ_CHANGED                      = "thread_read_changed"
)
View Source
const CHANNEL_SEARCH_DEFAULT_LIMIT = 50
View Source
const (
	COMMAND_WEBHOOK_LIFETIME = 1000 * 60 * 30
)
View Source
const ConfigAccessTagCloudRestrictable = "cloud_restrictable"
View Source
const ConfigAccessTagType = "access"
View Source
const ConfigAccessTagWriteRestrictable = "write_restrictable"
View Source
const (
	DEFAULT_WEBHOOK_USERNAME = "webhook"
)
View Source
const (
	MaxImageSize = int64(6048 * 4032) // 24 megapixels, roughly 36MB as a raw image
)
View Source
const OUTGOING_HOOK_RESPONSE_TYPE_COMMENT = "comment"
View Source
const TERMS_OF_SERVICE_CACHE_SIZE = 1
View Source
const (
	USERNAME = "Username"
)
View Source
const (
	USER_AUTH_SERVICE_GITLAB = "gitlab"
)
View Source
const USER_SEARCH_DEFAULT_LIMIT = 100
View Source
const USER_SEARCH_MAX_LIMIT = 1000
View Source
const UploadNoUserID = "nouser"

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

Variables

View Source
var (
	IMAGE_EXTENSIONS = [7]string{".jpg", ".jpeg", ".gif", ".bmp", ".png", ".tiff", "tif"}
	IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff", ".tif": "image/tif"}
)
View Source
var AT_MENTION_PATTEN = regexp.MustCompile(`\B@`)
View Source
var AllPermissions []*Permission
View Source
var BotDefaultImage = []byte{}/* 3372 elements not displayed */
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 EMOJI_PATTERN = regexp.MustCompile(`:[a-zA-Z0-9_-]+:`)
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{} /* 2383 elements not displayed */
View Source
var SystemManagerDefaultPermissions []string
View Source
var SystemReadOnlyAdminDefaultPermissions []string
View Source
var SystemUserManagerDefaultPermissions []string

Functions

func AppErrorInit

func AppErrorInit(t goi18n.TranslateFunc)

func ArrayFromInterface

func ArrayFromInterface(data interface{}) []string

func ArrayFromJson

func ArrayFromJson(data io.Reader) []string

func ArrayToJson

func ArrayToJson(objmap []string) string

func AsStringBoolMap

func AsStringBoolMap(list []string) map[string]bool

func AuditModelTypeConv

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

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

func AutocompleteStaticListItemsToJSON

func AutocompleteStaticListItemsToJSON(items []AutocompleteListItem) []byte

AutocompleteStaticListItemsToJSON returns json for a list of AutocompleteStaticListItem objects

func AutocompleteSuggestionsToJSON

func AutocompleteSuggestionsToJSON(suggestions []AutocompleteSuggestion) []byte

AutocompleteSuggestionsToJSON returns json for a list of AutocompleteSuggestion objects

func ChannelMentions

func ChannelMentions(message string) []string

func ChannelModeratedPermissionsChangedByPatch

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

func CheckStatusOK

func CheckStatusOK(r *http.Response) bool

CheckStatusOK is a convenience function for checking the standard OK response from the web service.

func CleanRoleNames

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

func CleanTeamName

func CleanTeamName(s string) string

func CleanUsername

func CleanUsername(s string) string

func ClearMentionTags

func ClearMentionTags(post string) string

func ClusterInfosToJson

func ClusterInfosToJson(objmap []*ClusterInfo) string

func CommandListToJson

func CommandListToJson(l []*Command) string

func ComparePassword

func ComparePassword(hash string, password string) bool

ComparePassword compares the hash

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 EmailInviteWithErrorToJson

func EmailInviteWithErrorToJson(o []*EmailInviteWithError) string

func EmailInviteWithErrorToString

func EmailInviteWithErrorToString(o *EmailInviteWithError) string

func EmojiListToJson

func EmojiListToJson(emojiList []*Emoji) string

func Etag

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

func FileInfosToJson

func FileInfosToJson(infos []*FileInfo) 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 GenerateMiniPreviewImage

func GenerateMiniPreviewImage(img image.Image) *[]byte

func GeneratePassword

func GeneratePassword(minimumLength int) string

func GetDMNameFromIds

func GetDMNameFromIds(userId1, userId2 string) string

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 GetImageMimeType

func GetImageMimeType(ext 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 HashPassword

func HashPassword(password string) string

HashPassword generates a hash using the bcrypt.GenerateFromPassword

func IncomingWebhookListToJson

func IncomingWebhookListToJson(l []*IncomingWebhook) string

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 IsFileExtImage

func IsFileExtImage(ext string) bool

func IsIgnoreChannelMentionsValid

func IsIgnoreChannelMentionsValid(ignoreChannelMentions string) bool

func IsInRole

func IsInRole(userRoles string, inRole string) bool

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

func IsLower

func IsLower(s string) bool

func IsPreviousVersionsSupported

func IsPreviousVersionsSupported(versionToCheck string) bool

func IsReservedTeamName

func IsReservedTeamName(s string) bool
func IsSafeLink(link *string) bool

func IsSamlFile

func IsSamlFile(saml *SamlSettings, filename string) bool

IsSamlFile checks if filename is a SAML file.

func IsSendEmailValid

func IsSendEmailValid(sendEmail string) bool

func IsValidAlphaNum

func IsValidAlphaNum(s string) bool

func IsValidAlphaNumHyphenUnderscore

func IsValidAlphaNumHyphenUnderscore(s string, withFormat bool) bool

func IsValidCategoryId

func IsValidCategoryId(s string) bool

func IsValidChannelIdentifier

func IsValidChannelIdentifier(s string) bool

func IsValidCommentsNotifyLevel

func IsValidCommentsNotifyLevel(notifyLevel string) bool

func IsValidEmail

func IsValidEmail(email string) bool

func IsValidEmailBatchingInterval

func IsValidEmailBatchingInterval(emailInterval string) bool

func IsValidHttpUrl

func IsValidHttpUrl(rawUrl string) bool

func IsValidId

func IsValidId(value string) bool

func IsValidLocale

func IsValidLocale(locale string) bool

func IsValidNumberString

func IsValidNumberString(value 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 IsValidPushStatusNotifyLevel

func IsValidPushStatusNotifyLevel(notifyLevel string) bool

func IsValidRoleName

func IsValidRoleName(roleName string) bool

func IsValidSchemeName

func IsValidSchemeName(name string) bool

func IsValidTeamName

func IsValidTeamName(s string) bool

func IsValidTrueOrFalseString

func IsValidTrueOrFalseString(value string) bool

func IsValidTurnOrStunServer

func IsValidTurnOrStunServer(rawUri string) bool

func IsValidUserNotifyLevel

func IsValidUserNotifyLevel(notifyLevel string) bool

func IsValidUserRoles

func IsValidUserRoles(userRoles string) bool

func IsValidUsername

func IsValidUsername(s string) bool

func IsValidWebsocketUrl

func IsValidWebsocketUrl(rawUrl string) bool

func JobsToJson

func JobsToJson(jobs []*Job) string

func MakeDefaultRoles

func MakeDefaultRoles() map[string]*Role

func ManifestListToJson

func ManifestListToJson(m []*Manifest) string

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 MapPostIdToReactionsFromJson

func MapPostIdToReactionsFromJson(data io.Reader) map[string][]*Reaction

func MapPostIdToReactionsToJson

func MapPostIdToReactionsToJson(o map[string][]*Reaction) string

func MapToJson

func MapToJson(objmap map[string]string) string

MapToJson converts a map to a json string

func MapWarnMetricStatusToJson

func MapWarnMetricStatusToJson(o map[string]*WarnMetricStatus) 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 NewRandomBase32String

func NewRandomBase32String(size int) string

NewRandomBase32String returns a base32 encoded string of a random slice of bytes of the given size. The resulting entropy will be (8 * size) bits.

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 NewWebSocketClient

func NewWebSocketClient(url, authToken string) (*WebSocketClient, *AppError)

NewWebSocketClient constructs a new WebSocket client with convenience methods for talking to the server.

func NewWebSocketClient4

func NewWebSocketClient4(url, authToken string) (*WebSocketClient, *AppError)

NewWebSocketClient4 constructs a new WebSocket client with convenience methods for talking to the server. Uses the v4 endpoint.

func NewWebSocketClient4WithDialer

func NewWebSocketClient4WithDialer(dialer *websocket.Dialer, url, authToken string) (*WebSocketClient, *AppError)

NewWebSocketClient4WithDialer constructs a new WebSocket client with convenience methods for talking to the server using a custom dialer. Uses the v4 endpoint.

func NewWebSocketClientWithDialer

func NewWebSocketClientWithDialer(dialer *websocket.Dialer, url, authToken string) (*WebSocketClient, *AppError)

NewWebSocketClientWithDialer constructs a new WebSocket client with convenience methods for talking to the server using a custom dialer.

func NormalizeEmail

func NormalizeEmail(email string) string

func NormalizeUsername

func NormalizeUsername(username string) string

func OAuthAppListToJson

func OAuthAppListToJson(l []*OAuthApp) string

func OutgoingWebhookListToJson

func OutgoingWebhookListToJson(l []*OutgoingWebhook) 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 PossibleAtMentions

func PossibleAtMentions(message string) []string

PossibleAtMentions returns all substrings in message that look like valid @ mentions.

func ReactionsToJson

func ReactionsToJson(o []*Reaction) string

func RemoveDuplicateStrings

func RemoveDuplicateStrings(in []string) []string

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 RoleListToJson

func RoleListToJson(r []*Role) string

func SanitizeUnicode

func SanitizeUnicode(s string) string

SanitizeUnicode will remove undesirable Unicode characters from a string.

func SchemeIDFromJson

func SchemeIDFromJson(data io.Reader) *string

func SchemesToJson

func SchemesToJson(schemes []*Scheme) string

func SessionsToJson

func SessionsToJson(o []*Session) string

func SidebarCategoriesWithChannelsToJson

func SidebarCategoriesWithChannelsToJson(o []*SidebarCategoryWithChannels) []byte

func SplitVersion

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

func StatusListToJson

func StatusListToJson(u []*Status) string

func StatusMapToInterfaceMap

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

func StringFromJson

func StringFromJson(data io.Reader) string

func StringInterfaceFromJson

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

func StringInterfaceToJson

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

func StringToJson

func StringToJson(s string) string

func TeamListToJson

func TeamListToJson(t []*Team) string

func TeamMapFromJson

func TeamMapFromJson(data io.Reader) map[string]*Team

func TeamMapToJson

func TeamMapToJson(u map[string]*Team) string

func TeamMemberWithErrorToString

func TeamMemberWithErrorToString(o *TeamMemberWithError) string

func TeamMembersToJson

func TeamMembersToJson(o []*TeamMember) string

func TeamMembersWithErrorToJson

func TeamMembersWithErrorToJson(o []*TeamMemberWithError) string

func TeamsUnreadToJson

func TeamsUnreadToJson(o []*TeamUnread) string

func TeamsWithCountToJson

func TeamsWithCountToJson(tlc *TeamsWithCount) []byte

func TrimUsernameSpecialChar

func TrimUsernameSpecialChar(word string) (string, bool)

TrimUsernameSpecialChar tries to remove the last character from word if it is a special character for usernames (dot, dash or underscore). If not, it returns the same string.

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.

func UploadSessionsToJson

func UploadSessionsToJson(uss []*UploadSession) string

UploadSessionsToJson serializes a list of UploadSession into JSON and returns it as string.

func UserAccessTokenListToJson

func UserAccessTokenListToJson(t []*UserAccessToken) string

func UserListToJson

func UserListToJson(u []*User) string

func UserMapFromJson

func UserMapFromJson(data io.Reader) map[string]*User

func UserMapToJson

func UserMapToJson(u map[string]*User) string

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 AccessDataFromJson

func AccessDataFromJson(data io.Reader) *AccessData

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.

func (*AccessData) ToJson

func (ad *AccessData) ToJson() string

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

func AccessResponseFromJson

func AccessResponseFromJson(data io.Reader) *AccessResponse

func (*AccessResponse) ToJson

func (ar *AccessResponse) ToJson() string

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

func AnalyticsRowFromJson

func AnalyticsRowFromJson(data io.Reader) *AnalyticsRow

func (*AnalyticsRow) ToJson

func (ar *AnalyticsRow) ToJson() string

type AnalyticsRows

type AnalyticsRows []*AnalyticsRow

func AnalyticsRowsFromJson

func AnalyticsRowsFromJson(data io.Reader) AnalyticsRows

func (AnalyticsRows) ToJson

func (ar AnalyticsRows) ToJson() string

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"`
	BannerText            *string `access:"site"`
	BannerColor           *string `access:"site"`
	BannerTextColor       *string `access:"site"`
	AllowBannerDismissal  *bool   `access:"site"`
	AdminNoticesEnabled   *bool   `access:"site"`
	UserNoticesEnabled    *bool   `access:"site"`
	NoticesURL            *string `access:"site,write_restrictable"`
	NoticesFetchFrequency *int    `access:"site,write_restrictable"`
	NoticesSkipCache      *bool   `access:"site,write_restrictable"`
}

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 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 goi18n.TranslateFunc) string

func (*AppError) ToJson

func (er *AppError) ToJson() string

func (*AppError) Translate

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

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

func AuditFromJson

func AuditFromJson(data io.Reader) *Audit

func (*Audit) ToJson

func (o *Audit) ToJson() string

type Audits

type Audits []Audit

func AuditsFromJson

func AuditsFromJson(data io.Reader) Audits

func (Audits) Etag

func (o Audits) Etag() string

func (Audits) ToJson

func (o Audits) ToJson() 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 AuthDataFromJson

func AuthDataFromJson(data io.Reader) *AuthData

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()

func (*AuthData) ToJson

func (ad *AuthData) ToJson() string

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 AuthorizeRequestFromJson

func AuthorizeRequestFromJson(data io.Reader) *AuthorizeRequest

func (*AuthorizeRequest) IsValid

func (ar *AuthorizeRequest) IsValid() *AppError

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

func (*AuthorizeRequest) ToJson

func (ar *AuthorizeRequest) ToJson() string

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 AutocompleteDataFromJSON

func AutocompleteDataFromJSON(data []byte) (*AutocompleteData, error)

AutocompleteDataFromJSON decodes AutocompleteData struct from the json

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) ToJSON

func (ad *AutocompleteData) ToJSON() ([]byte, error)

ToJSON encodes AutocompleteData struct to the json

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