app

package
v5.3.2-0...-ccc9e37 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: AGPL-3.0, Apache-2.0 Imports: 117 Imported by: 0

Documentation

Overview

Installing a managed plugin consists of copying the uploaded plugin (*.tar.gz) to the filestore, unpacking to the configured local directory (PluginSettings.Directory), and copying any webapp bundle therein to the configured local client directory (PluginSettings.ClientDirectory). The unpacking and copy occurs each time the server starts, ensuring it remains synchronized with the set of installed plugins.

When a plugin is enabled, all connected websocket clients are notified so as to fetch any webapp bundle and load the client-side portion of the plugin. This works well in a single-server system, but requires careful coordination in a high-availability cluster with multiple servers. In particular, websocket clients must not be notified of the newly enabled plugin until all servers in the cluster have finished unpacking the plugin, otherwise the webapp bundle might not yet be available. Ideally, each server would just notify its own set of connected peers after it finishes this process, but nothing prevents those clients from re-connecting to a different server behind the load balancer that hasn't finished unpacking.

To achieve this coordination, each server instead checks the status of its peers after unpacking. If it finds peers with differing versions of the plugin, it skips the notification. If it finds all peers with the same version of the plugin, it notifies all websocket clients connected to all peers. There's a small chance that this never occurs if the last server to finish unpacking dies before it can announce. There is also a chance that multiple servers decide to notify, but the webapp handles this idempotently.

Complicating this flow further are the various means of notifying. In addition to websocket events, there are cluster messages between peers. There is a cluster message when the config changes and a plugin is enabled or disabled. There is a cluster message when installing or uninstalling a plugin. There is a cluster message when peer's plugin change its status. And finally the act of notifying websocket clients is propagated itself via a cluster message.

The key methods involved in handling these notifications are notifyPluginEnabled and notifyPluginStatusesChanged. Note that none of this complexity applies to single-server systems or to plugins without a webapp bundle.

Finally, in addition to managed plugins, note that there are unmanaged and prepackaged plugins. Unmanaged plugins are plugins installed manually to the configured local directory (PluginSettings.Directory). Prepackaged plugins are included with the server. They otherwise follow the above flow, except do not get uploaded to the filestore. Prepackaged plugins override all other plugins with the same plugin id, but only when the prepackaged plugin is newer. Managed plugins unconditionally override unmanaged plugins with the same plugin id.

Index

Constants

View Source
const (
	DAY_MILLISECONDS   = 24 * 60 * 60 * 1000
	MONTH_MILLISECONDS = 31 * DAY_MILLISECONDS
)
View Source
const (
	RestLevelID        = 240
	RestContentLevelID = 241
	RestPermsLevelID   = 242
	CLILevelID         = 243
)
View Source
const (
	BRAND_FILE_PATH = "brand/"
	BRAND_FILE_NAME = "image.png"
)
View Source
const (
	MaxEmojiFileSize       = 1 << 20 // 1 MB
	MaxEmojiWidth          = 128
	MaxEmojiHeight         = 128
	MaxEmojiOriginalWidth  = 1028
	MaxEmojiOriginalHeight = 1028
)
View Source
const (
	/*
	  EXIF Image Orientations
	  1        2       3      4         5            6           7          8

	  888888  888888      88  88      8888888888  88                  88  8888888888
	  88          88      88  88      88  88      88  88          88  88      88  88
	  8888      8888    8888  8888    88          8888888888  8888888888          88
	  88          88      88  88
	  88          88  888888  888888
	*/
	Upright            = 1
	UprightMirrored    = 2
	UpsideDown         = 3
	UpsideDownMirrored = 4
	RotatedCWMirrored  = 5
	RotatedCCW         = 6
	RotatedCCWMirrored = 7
	RotatedCW          = 8

	MaxImageSize         = int64(6048 * 4032) // 24 megapixels, roughly 36MB as a raw image
	ImageThumbnailWidth  = 120
	ImageThumbnailHeight = 100
	ImageThumbnailRatio  = float64(ImageThumbnailHeight) / float64(ImageThumbnailWidth)
	ImagePreviewWidth    = 1920

	// Deprecated
	IMAGE_THUMBNAIL_PIXEL_WIDTH  = 120
	IMAGE_THUMBNAIL_PIXEL_HEIGHT = 100
	IMAGE_PREVIEW_PIXEL_WIDTH    = 1920
)
View Source
const (
	OAUTH_COOKIE_MAX_AGE_SECONDS = 30 * 60 // 30 minutes
	COOKIE_OAUTH                 = "MMOAUTH"
)
View Source
const (
	PERMISSION_MANAGE_SYSTEM                     = "manage_system"
	PERMISSION_MANAGE_TEAM                       = "manage_team"
	PERMISSION_MANAGE_EMOJIS                     = "manage_emojis"
	PERMISSION_MANAGE_OTHERS_EMOJIS              = "manage_others_emojis"
	PERMISSION_CREATE_EMOJIS                     = "create_emojis"
	PERMISSION_DELETE_EMOJIS                     = "delete_emojis"
	PERMISSION_DELETE_OTHERS_EMOJIS              = "delete_others_emojis"
	PERMISSION_MANAGE_WEBHOOKS                   = "manage_webhooks"
	PERMISSION_MANAGE_OTHERS_WEBHOOKS            = "manage_others_webhooks"
	PERMISSION_MANAGE_INCOMING_WEBHOOKS          = "manage_incoming_webhooks"
	PERMISSION_MANAGE_OTHERS_INCOMING_WEBHOOKS   = "manage_others_incoming_webhooks"
	PERMISSION_MANAGE_OUTGOING_WEBHOOKS          = "manage_outgoing_webhooks"
	PERMISSION_MANAGE_OTHERS_OUTGOING_WEBHOOKS   = "manage_others_outgoing_webhooks"
	PERMISSION_LIST_PUBLIC_TEAMS                 = "list_public_teams"
	PERMISSION_LIST_PRIVATE_TEAMS                = "list_private_teams"
	PERMISSION_JOIN_PUBLIC_TEAMS                 = "join_public_teams"
	PERMISSION_JOIN_PRIVATE_TEAMS                = "join_private_teams"
	PERMISSION_PERMANENT_DELETE_USER             = "permanent_delete_user"
	PERMISSION_CREATE_BOT                        = "create_bot"
	PERMISSION_READ_BOTS                         = "read_bots"
	PERMISSION_READ_OTHERS_BOTS                  = "read_others_bots"
	PERMISSION_MANAGE_BOTS                       = "manage_bots"
	PERMISSION_MANAGE_OTHERS_BOTS                = "manage_others_bots"
	PERMISSION_DELETE_PUBLIC_CHANNEL             = "delete_public_channel"
	PERMISSION_DELETE_PRIVATE_CHANNEL            = "delete_private_channel"
	PERMISSION_MANAGE_PUBLIC_CHANNEL_PROPERTIES  = "manage_public_channel_properties"
	PERMISSION_MANAGE_PRIVATE_CHANNEL_PROPERTIES = "manage_private_channel_properties"
	PERMISSION_CONVERT_PUBLIC_CHANNEL_TO_PRIVATE = "convert_public_channel_to_private"
	PERMISSION_CONVERT_PRIVATE_CHANNEL_TO_PUBLIC = "convert_private_channel_to_public"
	PERMISSION_VIEW_MEMBERS                      = "view_members"
	PERMISSION_INVITE_USER                       = "invite_user"
	PERMISSION_INVITE_GUEST                      = "invite_guest"
	PERMISSION_PROMOTE_GUEST                     = "promote_guest"
	PERMISSION_DEMOTE_TO_GUEST                   = "demote_to_guest"
	PERMISSION_USE_CHANNEL_MENTIONS              = "use_channel_mentions"
	PERMISSION_CREATE_POST                       = "create_post"
	PERMISSION_CREATE_POST_PUBLIC                = "create_post_public"
	PERMISSION_USE_GROUP_MENTIONS                = "use_group_mentions"
	PERMISSION_ADD_REACTION                      = "add_reaction"
	PERMISSION_REMOVE_REACTION                   = "remove_reaction"
	PERMISSION_MANAGE_PUBLIC_CHANNEL_MEMBERS     = "manage_public_channel_members"
	PERMISSION_MANAGE_PRIVATE_CHANNEL_MEMBERS    = "manage_private_channel_members"
	PERMISSION_READ_JOBS                         = "read_jobs"
	PERMISSION_MANAGE_JOBS                       = "manage_jobs"
	PERMISSION_READ_OTHER_USERS_TEAMS            = "read_other_users_teams"
	PERMISSION_EDIT_OTHER_USERS                  = "edit_other_users"
	PERMISSION_READ_PUBLIC_CHANNEL_GROUPS        = "read_public_channel_groups"
	PERMISSION_READ_PRIVATE_CHANNEL_GROUPS       = "read_private_channel_groups"
	PERMISSION_EDIT_BRAND                        = "edit_brand"
)
View Source
const (
	PENDING_POST_IDS_CACHE_SIZE = 25000
	PENDING_POST_IDS_CACHE_TTL  = 30 * time.Second
	PAGE_DEFAULT                = 0
)
View Source
const (
	SamlPublicCertificateName = "saml-public.crt"
	SamlPrivateKeyName        = "saml-private.key"
	SamlIdpCertificateName    = "saml-idp.crt"
)
View Source
const (
	SECURITY_URL           = "https://securityupdatecheck.mattermost.com"
	SECURITY_UPDATE_PERIOD = 86400000 // 24 hours in milliseconds.

	PROP_SECURITY_ID                = "id"
	PROP_SECURITY_BUILD             = "b"
	PROP_SECURITY_ENTERPRISE_READY  = "be"
	PROP_SECURITY_DATABASE          = "db"
	PROP_SECURITY_OS                = "os"
	PROP_SECURITY_USER_COUNT        = "uc"
	PROP_SECURITY_TEAM_COUNT        = "tc"
	PROP_SECURITY_ACTIVE_USER_COUNT = "auc"
	PROP_SECURITY_UNIT_TESTS        = "ut"
)
View Source
const (
	TOKEN_TYPE_PASSWORD_RECOVERY  = "password_recovery"
	TOKEN_TYPE_VERIFY_EMAIL       = "verify_email"
	TOKEN_TYPE_TEAM_INVITATION    = "team_invitation"
	TOKEN_TYPE_GUEST_INVITATION   = "guest_invitation"
	TOKEN_TYPE_CWS_ACCESS         = "cws_access_token"
	PASSWORD_RECOVER_EXPIRY_TIME  = 1000 * 60 * 60      // 1 hour
	INVITATION_EXPIRY_TIME        = 1000 * 60 * 60 * 48 // 48 hours
	IMAGE_PROFILE_PIXEL_DIMENSION = 128
)
View Source
const (
	TRIGGERWORDS_EXACT_MATCH = 0
	TRIGGERWORDS_STARTS_WITH = 1

	MaxIntegrationResponseSize = 1024 * 1024 // Posts can be <100KB at most, so this is likely more than enough
)
View Source
const (
	DISCOVERY_SERVICE_WRITE_PING = 60 * time.Second
)
View Source
const (
	EMAIL_BATCHING_TASK_NAME = "Email Batching"
)
View Source
const EMOJIS_PERMISSIONS_MIGRATION_KEY = "EmojisPermissionsMigrationComplete"
View Source
const (
	ERROR_TERMS_OF_SERVICE_NO_ROWS_FOUND = "app.terms_of_service.get.no_rows.app_error"
)
View Source
const GUEST_ROLES_CREATION_MIGRATION_KEY = "GuestRolesCreationMigrationComplete"
View Source
const (
	// HTTP_REQUEST_TIMEOUT defines a high timeout for downloading large files
	// from an external URL to avoid slow connections from failing to install.
	HTTP_REQUEST_TIMEOUT = 1 * time.Hour
)
View Source
const LINK_CACHE_DURATION = 1 * time.Hour
View Source
const LINK_CACHE_SIZE = 10000
View Source
const (
	LicenseEnv = "MM_LICENSE"
)
View Source
const MAX_REPEAT_VIEWINGS = 3
View Source
const MIN_SECONDS_BETWEEN_REPEAT_VIEWINGS = 60 * 60
View Source
const MISSING_CHANNEL_MEMBER_ERROR = "app.channel.get_member.missing.app_error"
View Source
const MaxMetadataImageSize = MaxOpenGraphResponseSize
View Source
const MaxOpenGraphResponseSize = 1024 * 1024 * 50
View Source
const (
	OneHourMillis = 60 * 60 * 1000
)
View Source
const (
	SESSIONS_CLEANUP_BATCH_SIZE = 1000
)
View Source
const SYSTEM_CONSOLE_ROLES_CREATION_MIGRATION_KEY = "SystemConsoleRolesCreationMigrationComplete"
View Source
const (
	TIMESTAMP_FORMAT = "Mon Jan 2 15:04:05 -0700 MST 2006"
)
View Source
const TIME_TO_WAIT_FOR_CONNECTIONS_TO_CLOSE_ON_SERVER_SHUTDOWN = time.Second

Variables

View Source
var (
	LevelAPI     = mlog.LvlAuditAPI
	LevelContent = mlog.LvlAuditContent
	LevelPerms   = mlog.LvlAuditPerms
	LevelCLI     = mlog.LvlAuditCLI
)
View Source
var MaxNotificationsPerChannelDefault int64 = 1000000
View Source
var SENTRY_DSN = "placeholder_sentry_dsn"

declaring this as var to allow overriding in tests

Functions

func CheckEmailDomain

func CheckEmailDomain(email string, domains string) bool

CheckEmailDomain checks that an email domain matches a list of space-delimited domains as a string.

func CheckUserDomain

func CheckUserDomain(user *model.User, domains string) bool

CheckUserDomain checks that a user's email domain matches a list of space-delimited domains as a string.

func CreateProfileImage

func CreateProfileImage(username string, userId string, initialFont string) ([]byte, *model.AppError)

func DoesNotifyPropsAllowPushNotification

func DoesNotifyPropsAllowPushNotification(user *model.User, channelNotifyProps model.StringMap, post *model.Post, wasMentioned bool) bool

func DoesStatusAllowPushNotification

func DoesStatusAllowPushNotification(userNotifyProps model.StringMap, status *model.Status, channelId string) bool

func GeneratePublicLinkHash

func GeneratePublicLinkHash(fileId, salt string) string

func GetProtocol

func GetProtocol(r *http.Request) string

func IsCWSLogin

func IsCWSLogin(a *App, token string) bool

func JoinCluster

func JoinCluster(s *Server) error

func RegisterAccountMigrationInterface

func RegisterAccountMigrationInterface(f func(*App) einterfaces.AccountMigrationInterface)

func RegisterCloudInterface

func RegisterCloudInterface(f func(*App) einterfaces.CloudInterface)

func RegisterClusterInterface

func RegisterClusterInterface(f func(*Server) einterfaces.ClusterInterface)

func RegisterCommandProvider

func RegisterCommandProvider(newProvider CommandProvider)

func RegisterComplianceInterface

func RegisterComplianceInterface(f func(*Server) einterfaces.ComplianceInterface)

func RegisterDataRetentionInterface

func RegisterDataRetentionInterface(f func(*Server) einterfaces.DataRetentionInterface)

func RegisterElasticsearchInterface

func RegisterElasticsearchInterface(f func(*Server) searchengine.SearchEngineInterface)

func RegisterJobsActiveUsersInterface

func RegisterJobsActiveUsersInterface(f func(*App) tjobs.ActiveUsersJobInterface)

func RegisterJobsBleveIndexerInterface

func RegisterJobsBleveIndexerInterface(f func(*Server) tjobs.IndexerJobInterface)

func RegisterJobsDataRetentionJobInterface

func RegisterJobsDataRetentionJobInterface(f func(*Server) ejobs.DataRetentionJobInterface)

func RegisterJobsElasticsearchAggregatorInterface

func RegisterJobsElasticsearchAggregatorInterface(f func(*Server) ejobs.ElasticsearchAggregatorInterface)

func RegisterJobsElasticsearchIndexerInterface

func RegisterJobsElasticsearchIndexerInterface(f func(*Server) tjobs.IndexerJobInterface)

func RegisterJobsExpiryNotifyJobInterface

func RegisterJobsExpiryNotifyJobInterface(f func(*App) tjobs.ExpiryNotifyJobInterface)

func RegisterJobsLdapSyncInterface

func RegisterJobsLdapSyncInterface(f func(*App) ejobs.LdapSyncInterface)

func RegisterJobsMessageExportJobInterface

func RegisterJobsMessageExportJobInterface(f func(*Server) ejobs.MessageExportJobInterface)

func RegisterJobsMigrationsJobInterface

func RegisterJobsMigrationsJobInterface(f func(*Server) tjobs.MigrationsJobInterface)

func RegisterJobsPluginsJobInterface

func RegisterJobsPluginsJobInterface(f func(*App) tjobs.PluginsJobInterface)

func RegisterLdapInterface

func RegisterLdapInterface(f func(*App) einterfaces.LdapInterface)

func RegisterMessageExportInterface

func RegisterMessageExportInterface(f func(*Server) einterfaces.MessageExportInterface)

func RegisterMetricsInterface

func RegisterMetricsInterface(f func(*Server) einterfaces.MetricsInterface)

func RegisterNewSamlInterface

func RegisterNewSamlInterface(f func(*App) einterfaces.SamlInterface)

func RegisterNotificationInterface

func RegisterNotificationInterface(f func(*App) einterfaces.NotificationInterface)

func RegisterProductNoticesJobInterface

func RegisterProductNoticesJobInterface(f func(*App) tjobs.ProductNoticesJobInterface)

func RegisterSamlInterface

func RegisterSamlInterface(f func(*App) einterfaces.SamlInterface)

func RemoveRoles

func RemoveRoles(rolesToRemove []string, roles string) string

func RunJobs

func RunJobs(s *Server) error

func ShouldSendPushNotification

func ShouldSendPushNotification(user *model.User, channelNotifyProps model.StringMap, wasMentioned bool, status *model.Status, post *model.Post) bool

func SplitWebhookPost

func SplitWebhookPost(post *model.Post, maxPostSize int) ([]*model.Post, *model.AppError)

func StartMetrics

func StartMetrics(s *Server) error

func StartSearchEngine

func StartSearchEngine(s *Server) error

func UploadFileSetClientId

func UploadFileSetClientId(clientId string) func(t *UploadFileTask)

func UploadFileSetContentLength

func UploadFileSetContentLength(contentLength int64) func(t *UploadFileTask)

func UploadFileSetRaw

func UploadFileSetRaw() func(t *UploadFileTask)

func UploadFileSetTeamId

func UploadFileSetTeamId(teamId string) func(t *UploadFileTask)

func UploadFileSetTimestamp

func UploadFileSetTimestamp(timestamp time.Time) func(t *UploadFileTask)

func UploadFileSetUserId

func UploadFileSetUserId(userId string) func(t *UploadFileTask)

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(options ...AppOption) *App

func (*App) AcceptLanguage

func (a *App) AcceptLanguage() string

func (*App) AccountMigration

func (a *App) AccountMigration() einterfaces.AccountMigrationInterface

func (*App) ActivateMfa

func (a *App) ActivateMfa(userId, token string) *model.AppError

func (*App) AddChannelMember

func (a *App) AddChannelMember(userId string, channel *model.Channel, userRequestorId string, postRootId string) (*model.ChannelMember, *model.AppError)

func (*App) AddConfigListener

func (a *App) AddConfigListener(listener func(*model.Config, *model.Config)) string

func (*App) AddCursorIdsForPostList

func (a *App) AddCursorIdsForPostList(originalList *model.PostList, afterPost, beforePost string, since int64, page, perPage int)

AddCursorIdsForPostList adds NextPostId and PrevPostId as cursor to the PostList. The conditional blocks ensure that it sets those cursor IDs immediately as afterPost, beforePost or empty, and only query to database whenever necessary.

func (*App) AddDirectChannels

func (a *App) AddDirectChannels(teamId string, user *model.User) *model.AppError

func (*App) AddLdapPrivateCertificate

func (a *App) AddLdapPrivateCertificate(fileData *multipart.FileHeader) *model.AppError

func (*App) AddLdapPublicCertificate

func (a *App) AddLdapPublicCertificate(fileData *multipart.FileHeader) *model.AppError

func (*App) AddPublicKey

func (a *App) AddPublicKey(name string, key io.Reader) *model.AppError

AddPublicKey will add plugin public key to the config. Overwrites the previous file

func (*App) AddSamlIdpCertificate

func (a *App) AddSamlIdpCertificate(fileData *multipart.FileHeader) *model.AppError

func (*App) AddSamlPrivateCertificate

func (a *App) AddSamlPrivateCertificate(fileData *multipart.FileHeader) *model.AppError

func (*App) AddSamlPublicCertificate

func (a *App) AddSamlPublicCertificate(fileData *multipart.FileHeader) *model.AppError

func (*App) AddSessionToCache

func (a *App) AddSessionToCache(session *model.Session)

func (*App) AddStatusCache

func (a *App) AddStatusCache(status *model.Status)

func (*App) AddStatusCacheSkipClusterSend

func (a *App) AddStatusCacheSkipClusterSend(status *model.Status)

func (*App) AddTeamMember

func (a *App) AddTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

func (*App) AddTeamMemberByInviteId

func (a *App) AddTeamMemberByInviteId(inviteId, userId string) (*model.TeamMember, *model.AppError)

func (*App) AddTeamMemberByToken

func (a *App) AddTeamMemberByToken(userId, tokenId string) (*model.TeamMember, *model.AppError)

func (*App) AddTeamMembers

func (a *App) AddTeamMembers(teamId string, userIds []string, userRequestorId string, graceful bool) ([]*model.TeamMemberWithError, *model.AppError)

func (*App) AddUserToChannel

func (a *App) AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelMember, *model.AppError)

func (*App) AddUserToTeam

func (a *App) AddUserToTeam(teamId string, userId string, userRequestorId string) (*model.Team, *model.AppError)

func (*App) AddUserToTeamByInviteId

func (a *App) AddUserToTeamByInviteId(inviteId string, userId string) (*model.Team, *model.AppError)

func (*App) AddUserToTeamByTeamId

func (a *App) AddUserToTeamByTeamId(teamId string, user *model.User) *model.AppError

func (*App) AddUserToTeamByToken

func (a *App) AddUserToTeamByToken(userId string, tokenId string) (*model.Team, *model.AppError)

func (*App) AdjustImage

func (a *App) AdjustImage(file io.Reader) (*bytes.Buffer, *model.AppError)

func (*App) AllowOAuthAppAccessToUser

func (a *App) AllowOAuthAppAccessToUser(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)

func (*App) AppendFile

func (a *App) AppendFile(fr io.Reader, path string) (int64, *model.AppError)

func (*App) AsymmetricSigningKey

func (a *App) AsymmetricSigningKey() *ecdsa.PrivateKey

func (*App) AttachDeviceId

func (a *App) AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError

func (*App) AttachSessionCookies

func (a *App) AttachSessionCookies(w http.ResponseWriter, r *http.Request)

func (*App) AuthenticateUserForLogin

func (a *App) AuthenticateUserForLogin(id, loginId, password, mfaToken, cwsToken string, ldapOnly bool) (user *model.User, err *model.AppError)

func (*App) AuthorizeOAuthUser

func (a *App) AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (io.ReadCloser, string, map[string]string, *model.AppError)

func (*App) AutocompleteChannels

func (a *App) AutocompleteChannels(teamId string, term string) (*model.ChannelList, *model.AppError)

func (*App) AutocompleteChannelsForSearch

func (a *App) AutocompleteChannelsForSearch(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)

func (*App) AutocompleteUsersInChannel

func (a *App) AutocompleteUsersInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError)

func (*App) AutocompleteUsersInTeam

func (a *App) AutocompleteUsersInTeam(teamId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInTeam, *model.AppError)

func (*App) BroadcastStatus

func (a *App) BroadcastStatus(status *model.Status)

func (*App) BuildPostReactions

func (a *App) BuildPostReactions(postId string) (*[]ReactionImportData, *model.AppError)

func (*App) BuildPushNotificationMessage

func (a *App) BuildPushNotificationMessage(contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string,
	explicitMention bool, channelWideMention bool, replyToThreadType string) (*model.PushNotification, *model.AppError)

func (*App) BuildSamlMetadataObject

func (a *App) BuildSamlMetadataObject(idpMetadata []byte) (*model.SamlMetadataResponse, *model.AppError)

func (*App) BulkExport

func (a *App) BulkExport(writer io.Writer, file string, pathToEmojiDir string, dirNameToExportEmoji string) *model.AppError

func (*App) BulkImport

func (a *App) BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model.AppError, int)

func (*App) CancelJob

func (a *App) CancelJob(jobId string) *model.AppError

func (*App) ChannelMembersMinusGroupMembers

func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)

ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given groups.

The result can be used, for example, to determine the set of users who would be removed from a channel if the channel were group-constrained with the given groups.

func (*App) ChannelMembersToAdd

func (a *App) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError)

func (*App) ChannelMembersToRemove

func (a *App) ChannelMembersToRemove(teamID *string) ([]*model.ChannelMember, *model.AppError)

func (*App) CheckForClientSideCert

func (a *App) CheckForClientSideCert(r *http.Request) (string, string, string)

func (*App) CheckPasswordAndAllCriteria

func (a *App) CheckPasswordAndAllCriteria(user *model.User, password string, mfaToken string) *model.AppError

func (*App) CheckRolesExist

func (a *App) CheckRolesExist(roleNames []string) *model.AppError

func (*App) CheckUserAllAuthenticationCriteria

func (a *App) CheckUserAllAuthenticationCriteria(user *model.User, mfaToken string) *model.AppError

func (*App) CheckUserMfa

func (a *App) CheckUserMfa(user *model.User, token string) *model.AppError

func (*App) CheckUserPostflightAuthenticationCriteria

func (a *App) CheckUserPostflightAuthenticationCriteria(user *model.User) *model.AppError

func (*App) CheckUserPreflightAuthenticationCriteria

func (a *App) CheckUserPreflightAuthenticationCriteria(user *model.User, mfaToken string) *model.AppError

func (*App) CheckValidDomains

func (a *App) CheckValidDomains(team *model.Team) *model.AppError

func (*App) ClearChannelMembersCache

func (a *App) ClearChannelMembersCache(channelID string)

func (*App) ClearSessionCacheForAllUsers

func (a *App) ClearSessionCacheForAllUsers()

func (*App) ClearSessionCacheForAllUsersSkipClusterSend

func (a *App) ClearSessionCacheForAllUsersSkipClusterSend()

func (*App) ClearSessionCacheForUser

func (a *App) ClearSessionCacheForUser(userId string)

func (*App) ClearSessionCacheForUserSkipClusterSend

func (a *App) ClearSessionCacheForUserSkipClusterSend(userId string)

func (*App) ClearTeamMembersCache

func (a *App) ClearTeamMembersCache(teamID string)

func (*App) ClientConfig

func (a *App) ClientConfig() map[string]string

func (*App) ClientConfigHash

func (a *App) ClientConfigHash() string

func (*App) ClientConfigWithComputed

func (a *App) ClientConfigWithComputed() map[string]string

ClientConfigWithComputed gets the configuration in a format suitable for sending to the client.

func (*App) Cloud

func (a *App) Cloud() einterfaces.CloudInterface

func (*App) Cluster

func (a *App) Cluster() einterfaces.ClusterInterface

func (*App) CompareAndDeletePluginKey

func (a *App) CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError)

func (*App) CompareAndSetPluginKey

func (a *App) CompareAndSetPluginKey(pluginId string, key string, oldValue, newValue []byte) (bool, *model.AppError)

func (*App) CompleteOAuth

func (a *App) CompleteOAuth(service string, body io.ReadCloser, teamId string, props map[string]string) (*model.User, *model.AppError)

func (*App) CompleteSwitchWithOAuth

func (a *App) CompleteSwitchWithOAuth(service string, userData io.Reader, email string) (*model.User, *model.AppError)

func (*App) Compliance

func (a *App) Compliance() einterfaces.ComplianceInterface

func (*App) Config

func (a *App) Config() *model.Config

func (*App) Context

func (a *App) Context() context.Context

func (*App) ConvertBotToUser

func (a *App) ConvertBotToUser(bot *model.Bot, userPatch *model.UserPatch, sysadmin bool) (*model.User, *model.AppError)

ConvertBotToUser converts a bot to user.

func (*App) ConvertUserToBot

func (a *App) ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)

ConvertUserToBot converts a user to bot.

func (*App) CopyFileInfos

func (a *App) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)

func (*App) CreateBot

func (a *App) CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)

CreateBot creates the given bot and corresponding user.

func (*App) CreateChannel

func (a *App) CreateChannel(channel *model.Channel, addMember bool) (*model.Channel, *model.AppError)

func (*App) CreateChannelScheme

func (a *App) CreateChannelScheme(channel *model.Channel) (*model.Scheme, *model.AppError)

CreateChannelScheme creates a new Scheme of scope channel and assigns it to the channel.

func (*App) CreateChannelWithUser

func (a *App) CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channel, *model.AppError)

func (*App) CreateCommand

func (a *App) CreateCommand(cmd *model.Command) (*model.Command, *model.AppError)

func (*App) CreateCommandPost

func (a *App) CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError)

@openTracingParams teamId, skipSlackParsing

func (*App) CreateCommandWebhook

func (a *App) CreateCommandWebhook(commandId string, args *model.CommandArgs) (*model.CommandWebhook, *model.AppError)

func (*App) CreateDefaultChannels

func (a *App) CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)

CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.

func (*App) CreateDefaultMemberships

func (a *App) CreateDefaultMemberships(since int64) error

CreateDefaultMemberships adds users to teams and channels based on their group memberships and how those groups are configured to sync with teams and channels for group members on or after the given timestamp.

func (*App) CreateEmoji

func (a *App) CreateEmoji(sessionUserId string, emoji *model.Emoji, multiPartImageData *multipart.Form) (*model.Emoji, *model.AppError)

func (*App) CreateGroup

func (a *App) CreateGroup(group *model.Group) (*model.Group, *model.AppError)

func (*App) CreateGroupChannel

func (a *App) CreateGroupChannel(userIds []string, creatorId string) (*model.Channel, *model.AppError)

func (*App) CreateGuest

func (a *App) CreateGuest(user *model.User) (*model.User, *model.AppError)

CreateGuest creates a guest and sets several fields of the returned User struct to their zero values.

func (*App) CreateIncomingWebhookForChannel

func (a *App) CreateIncomingWebhookForChannel(creatorId string, channel *model.Channel, hook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)

func (*App) CreateJob

func (a *App) CreateJob(job *model.Job) (*model.Job, *model.AppError)

func (*App) CreateOAuthApp

func (a *App) CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)

func (*App) CreateOAuthStateToken

func (a *App) CreateOAuthStateToken(extra string) (*model.Token, *model.AppError)

func (*App) CreateOAuthUser

func (a *App) CreateOAuthUser(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)

func (*App) CreateOutgoingWebhook

func (a *App) CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)

func (*App) CreatePasswordRecoveryToken

func (a *App) CreatePasswordRecoveryToken(userId, email string) (*model.Token, *model.AppError)

func (*App) CreatePost

func (a *App) CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks, setOnline bool) (savedPost *model.Post, err *model.AppError)

func (*App) CreatePostAsUser

func (a *App) CreatePostAsUser(post *model.Post, currentSessionId string, setOnline bool) (*model.Post, *model.AppError)

func (*App) CreatePostMissingChannel

func (a *App) CreatePostMissingChannel(post *model.Post, triggerWebhooks bool) (*model.Post, *model.AppError)

func (*App) CreateRole

func (a *App) CreateRole(role *model.Role) (*model.Role, *model.AppError)

func (*App) CreateScheme

func (a *App) CreateScheme(scheme *model.Scheme) (*model.Scheme, *model.AppError)

func (*App) CreateSession

func (a *App) CreateSession(session *model.Session) (*model.Session, *model.AppError)

func (*App) CreateSidebarCategory

func (a *App) CreateSidebarCategory(userId, teamId string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)

func (*App) CreateTeam

func (a *App) CreateTeam(team *model.Team) (*model.Team, *model.AppError)

func (*App) CreateTeamWithUser

func (a *App) CreateTeamWithUser(team *model.Team, userId string) (*model.Team, *model.AppError)

func (*App) CreateTermsOfService

func (a *App) CreateTermsOfService(text, userId string) (*model.TermsOfService, *model.AppError)

func (*App) CreateUploadSession

func (a *App) CreateUploadSession(us *model.UploadSession) (*model.UploadSession, *model.AppError)

func (*App) CreateUser

func (a *App) CreateUser(user *model.User) (*model.User, *model.AppError)

CreateUser creates a user and sets several fields of the returned User struct to their zero values.

func (*App) CreateUserAccessToken

func (a *App) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError)

func (*App) CreateUserAsAdmin

func (a *App) CreateUserAsAdmin(user *model.User, redirect string) (*model.User, *model.AppError)

func (*App) CreateUserFromSignup

func (a *App) CreateUserFromSignup(user *model.User, redirect string) (*model.User, *model.AppError)

func (*App) CreateUserWithInviteId

func (a *App) CreateUserWithInviteId(user *model.User, inviteId, redirect string) (*model.User, *model.AppError)

func (*App) CreateUserWithToken

func (a *App) CreateUserWithToken(user *model.User, token *model.Token) (*model.User, *model.AppError)

func (*App) CreateWebhookPost

func (a *App) CreateWebhookPost(userId string, channel *model.Channel, text, overrideUsername, overrideIconUrl, overrideIconEmoji string, props model.StringInterface, postType string, postRootId string) (*model.Post, *model.AppError)

func (*App) DBHealthCheckDelete

func (a *App) DBHealthCheckDelete() error

func (*App) DBHealthCheckWrite

func (a *App) DBHealthCheckWrite() error

func (*App) DataRetention

func (a *App) DataRetention() einterfaces.DataRetentionInterface

func (*App) DeactivateGuests

func (a *App) DeactivateGuests() *model.AppError

func (*App) DeactivateMfa

func (a *App) DeactivateMfa(userId string) *model.AppError

func (*App) DeauthorizeOAuthAppForUser

func (a *App) DeauthorizeOAuthAppForUser(userId, appId string) *model.AppError

func (*App) DefaultChannelNames

func (a *App) DefaultChannelNames() []string

DefaultChannelNames returns the list of system-wide default channel names.

By default the list will be (not necessarily in this order):

['town-square', 'off-topic']

However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace 'off-topic' and be included in the return results in addition to 'town-square'. For example:

['town-square', 'game-of-thrones', 'wow']

func (*App) DeleteAllExpiredPluginKeys

func (a *App) DeleteAllExpiredPluginKeys() *model.AppError

func (*App) DeleteAllKeysForPlugin

func (a *App) DeleteAllKeysForPlugin(pluginId string) *model.AppError

func (*App) DeleteBotIconImage

func (a *App) DeleteBotIconImage(botUserId string) *model.AppError

DeleteBotIconImage deletes LHS icon for a bot.

func (*App) DeleteBrandImage

func (a *App) DeleteBrandImage() *model.AppError

func (*App) DeleteChannel

func (a *App) DeleteChannel(channel *model.Channel, userId string) *model.AppError

func (*App) DeleteChannelScheme

func (a *App) DeleteChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)

DeleteChannelScheme deletes a channels scheme and sets its SchemeId to nil.

func (*App) DeleteCommand

func (a *App) DeleteCommand(commandId string) *model.AppError

func (*App) DeleteEmoji

func (a *App) DeleteEmoji(emoji *model.Emoji) *model.AppError

func (*App) DeleteEphemeralPost

func (a *App) DeleteEphemeralPost(userId, postId string)

func (*App) DeleteFlaggedPosts

func (a *App) DeleteFlaggedPosts(postId string)

func (*App) DeleteGroup

func (a *App) DeleteGroup(groupID string) (*model.Group, *model.AppError)

func (*App) DeleteGroupConstrainedMemberships

func (a *App) DeleteGroupConstrainedMemberships() error

DeleteGroupConstrainedMemberships deletes team and channel memberships of users who aren't members of the allowed groups of all group-constrained teams and channels.

func (*App) DeleteGroupMember

func (a *App) DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)

func (*App) DeleteGroupSyncable

func (a *App) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)

func (*App) DeleteIncomingWebhook

func (a *App) DeleteIncomingWebhook(hookId string) *model.AppError

func (*App) DeleteOAuthApp

func (a *App) DeleteOAuthApp(appId string) *model.AppError

func (*App) DeleteOutgoingWebhook

func (a *App) DeleteOutgoingWebhook(hookId string) *model.AppError

func (*App) DeletePluginKey

func (a *App) DeletePluginKey(pluginId string, key string) *model.AppError

func (*App) DeletePost

func (a *App) DeletePost(postId, deleteByID string) (*model.Post, *model.AppError)

func (*App) DeletePostFiles

func (a *App) DeletePostFiles(post *model.Post)

func (*App) DeletePreferences

func (a *App) DeletePreferences(userId string, preferences model.Preferences) *model.AppError

func (*App) DeletePublicKey

func (a *App) DeletePublicKey(name string) *model.AppError

DeletePublicKey will delete plugin public key from the config.

func (*App) DeleteReactionForPost

func (a *App) DeleteReactionForPost(reaction *model.Reaction) *model.AppError

func (*App) DeleteScheme

func (a *App) DeleteScheme(schemeId string) (*model.Scheme, *model.AppError)

func (*App) DeleteSidebarCategory

func (a *App) DeleteSidebarCategory(userId, teamId, categoryId string) *model.AppError

func (*App) DeleteToken

func (a *App) DeleteToken(token *model.Token) *model.AppError

func (*App) DemoteUserToGuest

func (a *App) DemoteUserToGuest(user *model.User) *model.AppError

DemoteUserToGuest Convert user's roles and all his mermbership's roles from regular user roles to guest roles.

func (*App) DisableAutoResponder

func (a *App) DisableAutoResponder(userId string, asAdmin bool) *model.AppError

func (*App) DisablePlugin

func (a *App) DisablePlugin(id string) *model.AppError

DisablePlugin will set the config for an installed plugin to disabled, triggering deactivation if active. Notifies cluster peers through config change.

func (*App) DisableUserAccessToken

func (a *App) DisableUserAccessToken(token *model.UserAccessToken) *model.AppError

func (*App) DoActionRequest

func (a *App) DoActionRequest(rawURL string, body []byte) (*http.Response, *model.AppError)

Perform an HTTP POST request to an integration's action endpoint. Caller must consume and close returned http.Response as necessary. For internal requests, requests are routed directly to a plugin ServerHTTP hook

func (*App) DoAdvancedPermissionsMigration

func (a *App) DoAdvancedPermissionsMigration()

This function migrates the default built in roles from code/config to the database.

func (*App) DoAppMigrations

func (a *App) DoAppMigrations()

func (*App) DoCommandRequest

func (a *App) DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command, *model.CommandResponse, *model.AppError)

func (*App) DoEmojisPermissionsMigration

func (a *App) DoEmojisPermissionsMigration()

func (*App) DoGuestRolesCreationMigration

func (a *App) DoGuestRolesCreationMigration()

func (*App) DoLocalRequest

func (a *App) DoLocalRequest(rawURL string, body []byte) (*http.Response, *model.AppError)

func (*App) DoLogin

func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string, isMobile, isOAuthUser, isSaml bool) *model.AppError

func (*App) DoPermissionsMigrations

func (a *App) DoPermissionsMigrations() error

DoPermissionsMigrations execute all the permissions migrations need by the current version.

func (*App) DoPostAction

func (a *App) DoPostAction(postId, actionId, userId, selectedOption string) (string, *model.AppError)

func (*App) DoPostActionWithCookie

func (a *App) DoPostActionWithCookie(postId, actionId, userId, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)

func (*App) DoSystemConsoleRolesCreationMigration

func (a *App) DoSystemConsoleRolesCreationMigration()

func (*App) DoUploadFile

func (a *App) DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, *model.AppError)

func (*App) DoUploadFileExpectModification

func (a *App) DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)

func (*App) DoubleCheckPassword

func (a *App) DoubleCheckPassword(user *model.User, password string) *model.AppError

This to be used for places we check the users password when they are already logged in

func (*App) DownloadFromURL

func (a *App) DownloadFromURL(downloadURL string) ([]byte, error)

func (*App) EnablePlugin

func (a *App) EnablePlugin(id string) *model.AppError

EnablePlugin will set the config for an installed plugin to enabled, triggering asynchronous activation if inactive anywhere in the cluster. Notifies cluster peers through config change.

func (*App) EnableUserAccessToken

func (a *App) EnableUserAccessToken(token *model.UserAccessToken) *model.AppError

func (*App) EnvironmentConfig

func (a *App) EnvironmentConfig() map[string]interface{}

func (*App) ExecuteCommand

func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)

@openTracingParams args

func (*App) ExportPermissions

func (a *App) ExportPermissions(w io.Writer) error

func (*App) ExtendSessionExpiryIfNeeded

func (a *App) ExtendSessionExpiryIfNeeded(session *model.Session) bool

ExtendSessionExpiryIfNeeded extends Session.ExpiresAt based on session lengths in config. A new ExpiresAt is only written if enough time has elapsed since last update. Returns true only if the session was extended.

func (*App) FetchSamlMetadataFromIdp

func (a *App) FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)

func (*App) FileBackend

func (a *App) FileBackend() (filesstore.FileBackend, *model.AppError)

func (*App) FileExists

func (a *App) FileExists(path string) (bool, *model.AppError)

func (*App) FileReader

func (a *App) FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError)

Caller must close the first return value

func (*App) FillInChannelProps

func (a *App) FillInChannelProps(channel *model.Channel) *model.AppError

func (*App) FillInChannelsProps

func (a *App) FillInChannelsProps(channelList *model.ChannelList) *model.AppError

func (*App) FillInPostProps

func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError

FillInPostProps should be invoked before saving posts to fill in properties such as channel_mentions.

If channel is nil, FillInPostProps will look up the channel corresponding to the post.

func (*App) FilterNonGroupChannelMembers

func (a *App) FilterNonGroupChannelMembers(userIds []string, channel *model.Channel) ([]string, error)

FilterNonGroupChannelMembers returns the subset of the given user IDs of the users who are not members of groups associated to the channel excluding bots

func (*App) FilterNonGroupTeamMembers

func (a *App) FilterNonGroupTeamMembers(userIds []string, team *model.Team) ([]string, error)

FilterNonGroupTeamMembers returns the subset of the given user IDs of the users who are not members of groups associated to the team excluding bots.

func (*App) FilterUsersByVisible

func (a *App) FilterUsersByVisible(viewer *model.User, otherUsers []*model.User) ([]*model.User, *model.AppError)

func (*App) FindTeamByName

func (a *App) FindTeamByName(name string) bool

func (*App) GenerateMfaSecret

func (a *App) GenerateMfaSecret(userId string) (*model.MfaSecret, *model.AppError)
func (a *App) GeneratePublicLink(siteURL string, info *model.FileInfo) string

func (*App) GetActivePluginManifests

func (a *App) GetActivePluginManifests() ([]*model.Manifest, *model.AppError)

func (*App) GetAllChannels

func (a *App) GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, *model.AppError)

func (*App) GetAllChannelsCount

func (a *App) GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.AppError)

func (*App) GetAllLdapGroupsPage

func (a *App) GetAllLdapGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)

GetAllLdapGroupsPage retrieves all LDAP groups under the configured base DN using the default or configured group filter.

func (*App) GetAllPrivateTeams

func (a *App) GetAllPrivateTeams() ([]*model.Team, *model.AppError)

func (*App) GetAllPrivateTeamsPage

func (a *App) GetAllPrivateTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)

func (*App) GetAllPrivateTeamsPageWithCount

func (a *App) GetAllPrivateTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)

func (*App) GetAllPublicTeams

func (a *App) GetAllPublicTeams() ([]*model.Team, *model.AppError)

func (*App) GetAllPublicTeamsPage

func (a *App) GetAllPublicTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)

func (*App) GetAllPublicTeamsPageWithCount

func (a *App) GetAllPublicTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)

func (*App) GetAllRoles

func (a *App) GetAllRoles() ([]*model.Role, *model.AppError)

func (*App) GetAllStatuses

func (a *App) GetAllStatuses() map[string]*model.Status

func (*App) GetAllTeams

func (a *App) GetAllTeams() ([]*model.Team, *model.AppError)

func (*App) GetAllTeamsPage

func (a *App) GetAllTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)

func (*App) GetAllTeamsPageWithCount

func (a *App) GetAllTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)

func (*App) GetAnalytics

func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *model.AppError)

func (*App) GetAudits

func (a *App) GetAudits(userId string, limit int) (model.Audits, *model.AppError)

func (*App) GetAuditsPage

func (a *App) GetAuditsPage(userId string, page int, perPage int) (model.Audits, *model.AppError)

func (*App) GetAuthorizationCode

func (a *App) GetAuthorizationCode(w http.ResponseWriter, r *http.Request, service string, props map[string]string, loginHint string) (string, *model.AppError)

func (*App) GetAuthorizedAppsForUser

func (a *App) GetAuthorizedAppsForUser(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)

func (*App) GetBot

func (a *App) GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)

GetBot returns the given bot.

func (*App) GetBotIconImage

func (a *App) GetBotIconImage(botUserId string) ([]byte, *model.AppError)

GetBotIconImage retrieves LHS icon for a bot.

func (*App) GetBots

func (a *App) GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)

GetBots returns the requested page of bots.

func (*App) GetBrandImage

func (a *App) GetBrandImage() ([]byte, *model.AppError)

func (*App) GetBulkReactionsForPosts

func (a *App) GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError)

func (*App) GetChannel

func (a *App) GetChannel(channelId string) (*model.Channel, *model.AppError)

func (*App) GetChannelByName

func (a *App) GetChannelByName(channelName, teamId string, includeDeleted bool) (*model.Channel, *model.AppError)

func (*App) GetChannelByNameForTeamName

func (a *App) GetChannelByNameForTeamName(channelName, teamName string, includeDeleted bool) (*model.Channel, *model.AppError)

func (*App) GetChannelCounts

func (a *App) GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, *model.AppError)

func (*App) GetChannelGroupUsers

func (a *App) GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)

GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.

func (*App) GetChannelGuestCount

func (a *App) GetChannelGuestCount(channelId string) (int64, *model.AppError)

func (*App) GetChannelMember

func (a *App) GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError)

func (*App) GetChannelMemberCount

func (a *App) GetChannelMemberCount(channelId string) (int64, *model.AppError)

func (*App) GetChannelMembersByIds

func (a *App) GetChannelMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, *model.AppError)

func (*App) GetChannelMembersForUser

func (a *App) GetChannelMembersForUser(teamId string, userId string) (*model.ChannelMembers, *model.AppError)

func (*App) GetChannelMembersForUserWithPagination

func (a *App) GetChannelMembersForUserWithPagination(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)

func (*App) GetChannelMembersPage

func (a *App) GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)

func (*App) GetChannelMembersTimezones

func (a *App) GetChannelMembersTimezones(channelId string) ([]string, *model.AppError)

func (*App) GetChannelModerationsForChannel

func (a *App) GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)

GetChannelModerationsForChannel Gets a channels ChannelModerations from either the higherScoped roles or from the channel scheme roles.

func (*App) GetChannelPinnedPostCount

func (a *App) GetChannelPinnedPostCount(channelId string) (int64, *model.AppError)

func (*App) GetChannelUnread

func (a *App) GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError)

func (*App) GetChannelsByNames

func (a *App) GetChannelsByNames(channelNames []string, teamId string) ([]*model.Channel, *model.AppError)

func (*App) GetChannelsForScheme

func (a *App) GetChannelsForScheme(scheme *model.Scheme, offset int, limit int) (model.ChannelList, *model.AppError)

func (*App) GetChannelsForSchemePage

func (a *App) GetChannelsForSchemePage(scheme *model.Scheme, page int, perPage int) (model.ChannelList, *model.AppError)

func (*App) GetChannelsForUser

func (a *App) GetChannelsForUser(teamId string, userId string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, *model.AppError)

func (*App) GetChannelsUserNotIn

func (a *App) GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (*model.ChannelList, *model.AppError)

func (*App) GetClusterId

func (a *App) GetClusterId() string

func (*App) GetClusterPluginStatuses

func (a *App) GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)

GetClusterPluginStatuses returns the status for plugins installed anywhere in the cluster.

func (*App) GetClusterStatus

func (a *App) GetClusterStatus() []*model.ClusterInfo

func (*App) GetCommand

func (a *App) GetCommand(commandId string) (*model.Command, *model.AppError)

func (*App) GetComplianceFile

func (a *App) GetComplianceFile(job *model.Compliance) ([]byte, *model.AppError)

func (*App) GetComplianceReport

func (a *App) GetComplianceReport(reportId string) (*model.Compliance, *model.AppError)

func (*App) GetComplianceReports

func (a *App) GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError)

func (*App) GetConfigFile

func (a *App) GetConfigFile(name string) ([]byte, error)

GetConfigFile proxies access to the given configuration file to the underlying config store.

func (*App) GetCookieDomain

func (a *App) GetCookieDomain() string

func (*App) GetDataRetentionPolicy

func (a *App) GetDataRetentionPolicy() (*model.DataRetentionPolicy, *model.AppError)

func (*App) GetDefaultProfileImage

func (a *App) GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError)

func (*App) GetDeletedChannels

func (a *App) GetDeletedChannels(teamId string, offset int, limit int, userId string) (*model.ChannelList, *model.AppError)

func (*App) GetEmoji

func (a *App) GetEmoji(emojiId string) (*model.Emoji, *model.AppError)

func (*App) GetEmojiByName

func (a *App) GetEmojiByName(emojiName string) (*model.Emoji, *model.AppError)

func (*App) GetEmojiImage

func (a *App) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)

func (*App) GetEmojiList

func (a *App) GetEmojiList(page, perPage int, sort string) ([]*model.Emoji, *model.AppError)

func (*App) GetEmojiStaticUrl

func (a *App) GetEmojiStaticUrl(emojiName string) (string, *model.AppError)

GetEmojiStaticUrl returns a relative static URL for system default emojis, and the API route for custom ones. Errors if not found or if custom and deleted.

func (*App) GetEnvironmentConfig

func (a *App) GetEnvironmentConfig() map[string]interface{}

GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable.

func (*App) GetErrorListForEmailsOverLimit

func (a *App) GetErrorListForEmailsOverLimit(emailList []string, cloudUserLimit int64) ([]string, []*model.EmailInviteWithError, *model.AppError)

func (*App) GetFile

func (a *App) GetFile(fileId string) ([]byte, *model.AppError)

func (*App) GetFileInfo

func (a *App) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)

func (*App) GetFileInfos

func (a *App) GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)

func (*App) GetFileInfosForPost

func (a *App) GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError)

func (*App) GetFileInfosForPostWithMigration

func (a *App) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError)

func (*App) GetFilteredUsersStats

func (a *App) GetFilteredUsersStats(options *model.UserCountOptions) (*model.UsersStats, *model.AppError)

GetFilteredUsersStats is used to get a count of users based on the set of filters supported by UserCountOptions.

func (*App) GetFlaggedPosts

func (a *App) GetFlaggedPosts(userId string, offset int, limit int) (*model.PostList, *model.AppError)

func (*App) GetFlaggedPostsForChannel

func (a *App) GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) (*model.PostList, *model.AppError)

func (*App) GetFlaggedPostsForTeam

func (a *App) GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) (*model.PostList, *model.AppError)

func (*App) GetGroup

func (a *App) GetGroup(id string) (*model.Group, *model.AppError)

func (*App) GetGroupByName

func (a *App) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError)

func (*App) GetGroupByRemoteID

func (a *App) GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError)

func (*App) GetGroupChannel

func (a *App) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)

func (*App) GetGroupMemberCount

func (a *App) GetGroupMemberCount(groupID string) (int64, *model.AppError)

func (*App) GetGroupMemberUsers

func (a *App) GetGroupMemberUsers(groupID string) ([]*model.User, *model.AppError)

func (*App) GetGroupMemberUsersPage

func (a *App) GetGroupMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, int, *model.AppError)

func (*App) GetGroupSyncable

func (a *App) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)

func (*App) GetGroupSyncables

func (a *App) GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)

func (*App) GetGroups

func (a *App) GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError)

func (*App) GetGroupsAssociatedToChannelsByTeam

func (a *App) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError)

func (*App) GetGroupsByChannel

func (a *App) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)

func (*App) GetGroupsByIDs

func (a *App) GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError)

func (*App) GetGroupsBySource

func (a *App) GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError)

func (*App) GetGroupsByTeam

func (a *App) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)

GetGroupsByTeam returns the paged list and the total count of group associated to the given team.

func (*App) GetGroupsByUserId

func (a *App) GetGroupsByUserId(userId string) ([]*model.Group, *model.AppError)

func (*App) GetHubForUserId

func (a *App) GetHubForUserId(userId string) *Hub

func (*App) GetIncomingWebhook

func (a *App) GetIncomingWebhook(hookId string) (*model.IncomingWebhook, *model.AppError)

func (*App) GetIncomingWebhooksForTeamPage

func (a *App) GetIncomingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)

func (*App) GetIncomingWebhooksForTeamPageByUser

func (a *App) GetIncomingWebhooksForTeamPageByUser(teamId string, userId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)

func (*App) GetIncomingWebhooksPage

func (a *App) GetIncomingWebhooksPage(page, perPage int) ([]*model.IncomingWebhook, *model.AppError)

func (*App) GetIncomingWebhooksPageByUser

func (a *App) GetIncomingWebhooksPageByUser(userId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)

func (*App) GetJob

func (a *App) GetJob(id string) (*model.Job, *model.AppError)

func (*App) GetJobs

func (a *App) GetJobs(offset int, limit int) ([]*model.Job, *model.AppError)

func (*App) GetJobsByType

func (a *App) GetJobsByType(jobType string, offset int, limit int) ([]*model.Job, *model.AppError)

func (*App) GetJobsByTypePage

func (a *App) GetJobsByTypePage(jobType string, page int, perPage int) ([]*model.Job, *model.AppError)

func (*App) GetJobsPage

func (a *App) GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError)

func (*App) GetKnownUsers

func (a *App) GetKnownUsers(userID string) ([]string, *model.AppError)

GetKnownUsers returns the list of user ids of users with any direct relationship with a user. That means any user sharing any channel, including direct and group channels.

func (*App) GetLatestTermsOfService

func (a *App) GetLatestTermsOfService() (*model.TermsOfService, *model.AppError)

func (*App) GetLdapGroup

func (a *App) GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError)

GetLdapGroup retrieves a single LDAP group by the given LDAP group id.

func (*App) GetLogs

func (a *App) GetLogs(page, perPage int) ([]string, *model.AppError)

func (*App) GetLogsSkipSend

func (a *App) GetLogsSkipSend(page, perPage int) ([]string, *model.AppError)

func (*App) GetMarketplacePlugins

func (a *App) GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*model.MarketplacePlugin, *model.AppError)

GetMarketplacePlugins returns a list of plugins from the marketplace-server, and plugins that are installed locally.

func (*App) GetMemberCountsByGroup

func (a *App) GetMemberCountsByGroup(channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, *model.AppError)

func (*App) GetMessageForNotification

func (a *App) GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string

func (*App) GetMultipleEmojiByName

func (a *App) GetMultipleEmojiByName(names []string) ([]*model.Emoji, *model.AppError)

func (*App) GetNewUsersForTeamPage

func (a *App) GetNewUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetNextPostIdFromPostList

func (a *App) GetNextPostIdFromPostList(postList *model.PostList) string

func (*App) GetNotificationNameFormat

func (a *App) GetNotificationNameFormat(user *model.User) string

func (*App) GetNumberOfChannelsOnTeam

func (a *App) GetNumberOfChannelsOnTeam(teamId string) (int, *model.AppError)

func (*App) GetOAuthAccessTokenForCodeFlow

func (a *App) GetOAuthAccessTokenForCodeFlow(clientId, grantType, redirectUri, code, secret, refreshToken string) (*model.AccessResponse, *model.AppError)

func (*App) GetOAuthAccessTokenForImplicitFlow

func (a *App) GetOAuthAccessTokenForImplicitFlow(userId string, authRequest *model.AuthorizeRequest) (*model.Session, *model.AppError)

func (*App) GetOAuthApp

func (a *App) GetOAuthApp(appId string) (*model.OAuthApp, *model.AppError)

func (*App) GetOAuthApps

func (a *App) GetOAuthApps(page, perPage int) ([]*model.OAuthApp, *model.AppError)

func (*App) GetOAuthAppsByCreator

func (a *App) GetOAuthAppsByCreator(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)

func (*App) GetOAuthCodeRedirect

func (a *App) GetOAuthCodeRedirect(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)

func (*App) GetOAuthImplicitRedirect

func (a *App) GetOAuthImplicitRedirect(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)

func (*App) GetOAuthLoginEndpoint

func (a *App) GetOAuthLoginEndpoint(w http.ResponseWriter, r *http.Request, service, teamId, action, redirectTo, loginHint string, isMobile bool) (string, *model.AppError)

func (*App) GetOAuthSignupEndpoint

func (a *App) GetOAuthSignupEndpoint(w http.ResponseWriter, r *http.Request, service, teamId string) (string, *model.AppError)

func (*App) GetOAuthStateToken

func (a *App) GetOAuthStateToken(token string) (*model.Token, *model.AppError)

func (*App) GetOpenGraphMetadata

func (a *App) GetOpenGraphMetadata(requestURL string) *opengraph.OpenGraph

func (*App) GetOrCreateDirectChannel

func (a *App) GetOrCreateDirectChannel(userId, otherUserId string) (*model.Channel, *model.AppError)

func (*App) GetOutgoingWebhook

func (a *App) GetOutgoingWebhook(hookId string) (*model.OutgoingWebhook, *model.AppError)

func (*App) GetOutgoingWebhooksForChannelPageByUser

func (a *App) GetOutgoingWebhooksForChannelPageByUser(channelId string, userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)

func (*App) GetOutgoingWebhooksForTeamPage

func (a *App) GetOutgoingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)

func (*App) GetOutgoingWebhooksForTeamPageByUser

func (a *App) GetOutgoingWebhooksForTeamPageByUser(teamId string, userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)

func (*App) GetOutgoingWebhooksPage

func (a *App) GetOutgoingWebhooksPage(page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)

func (*App) GetOutgoingWebhooksPageByUser

func (a *App) GetOutgoingWebhooksPageByUser(userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)

func (*App) GetPasswordRecoveryToken

func (a *App) GetPasswordRecoveryToken(token string) (*model.Token, *model.AppError)

func (*App) GetPermalinkPost

func (a *App) GetPermalinkPost(postId string, userId string) (*model.PostList, *model.AppError)

func (*App) GetPinnedPosts

func (a *App) GetPinnedPosts(channelId string) (*model.PostList, *model.AppError)

func (*App) GetPluginKey

func (a *App) GetPluginKey(pluginId string, key string) ([]byte, *model.AppError)

func (*App) GetPluginPublicKeyFiles

func (a *App) GetPluginPublicKeyFiles() ([]string, *model.AppError)

GetPluginPublicKeyFiles returns all public keys listed in the config.

func (*App) GetPluginStatus

func (a *App) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)

GetPluginStatus returns the status for a plugin installed on this server.

func (*App) GetPluginStatuses

func (a *App) GetPluginStatuses() (model.PluginStatuses, *model.AppError)

GetPluginStatuses returns the status for plugins installed on this server.

func (*App) GetPlugins

func (a *App) GetPlugins() (*model.PluginsResponse, *model.AppError)

func (*App) GetPluginsEnvironment

func (a *App) GetPluginsEnvironment() *plugin.Environment

GetPluginsEnvironment returns the plugin environment for use if plugins are enabled and initialized.

To get the plugins environment when the plugins are disabled, manually acquire the plugins lock instead.

func (*App) GetPostAfterTime

func (a *App) GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError)

func (*App) GetPostIdAfterTime

func (a *App) GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError)

func (*App) GetPostIdBeforeTime

func (a *App) GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError)

func (*App) GetPostThread

func (a *App) GetPostThread(postId string, skipFetchThreads bool) (*model.PostList, *model.AppError)

func (*App) GetPosts

func (a *App) GetPosts(channelId string, offset int, limit int) (*model.PostList, *model.AppError)

func (*App) GetPostsAfterPost

func (a *App) GetPostsAfterPost(options model.GetPostsOptions) (*model.PostList, *model.AppError)

func (*App) GetPostsAroundPost

func (a *App) GetPostsAroundPost(before bool, options model.GetPostsOptions) (*model.PostList, *model.AppError)

func (*App) GetPostsBeforePost

func (a *App) GetPostsBeforePost(options model.GetPostsOptions) (*model.PostList, *model.AppError)

func (*App) GetPostsEtag

func (a *App) GetPostsEtag(channelId string) string

func (*App) GetPostsForChannelAroundLastUnread

func (a *App) GetPostsForChannelAroundLastUnread(channelId, userId string, limitBefore, limitAfter int, skipFetchThreads bool) (*model.PostList, *model.AppError)

func (*App) GetPostsPage

func (a *App) GetPostsPage(options model.GetPostsOptions) (*model.PostList, *model.AppError)

func (*App) GetPostsSince

func (a *App) GetPostsSince(options model.GetPostsSinceOptions) (*model.PostList, *model.AppError)

func (*App) GetPreferenceByCategoryAndNameForUser

func (a *App) GetPreferenceByCategoryAndNameForUser(userId string, category string, preferenceName string) (*model.Preference, *model.AppError)

func (*App) GetPreferenceByCategoryForUser

func (a *App) GetPreferenceByCategoryForUser(userId string, category string) (model.Preferences, *model.AppError)

func (*App) GetPreferencesForUser

func (a *App) GetPreferencesForUser(userId string) (model.Preferences, *model.AppError)

func (*App) GetPrevPostIdFromPostList

func (a *App) GetPrevPostIdFromPostList(postList *model.PostList) string

func (*App) GetPrivateChannelsForTeam

func (a *App) GetPrivateChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)

func (*App) GetProductNotices

func (a *App) GetProductNotices(userId, teamId string, client model.NoticeClientType, clientVersion string, locale string) (model.NoticeMessages, *model.AppError)

GetProductNotices is called from the frontend to fetch the product notices that are relevant to the caller

func (*App) GetProfileImage

func (a *App) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)

func (*App) GetPublicChannelsByIdsForTeam

func (a *App) GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*model.ChannelList, *model.AppError)

func (*App) GetPublicChannelsForTeam

func (a *App) GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)

func (*App) GetPublicKey

func (a *App) GetPublicKey(name string) ([]byte, *model.AppError)

GetPublicKey will return the actual public key saved in the `name` file.

func (*App) GetReactionsForPost

func (a *App) GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError)

func (*App) GetRecentlyActiveUsersForTeam

func (a *App) GetRecentlyActiveUsersForTeam(teamId string) (map[string]*model.User, *model.AppError)

func (*App) GetRecentlyActiveUsersForTeamPage

func (a *App) GetRecentlyActiveUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetRole

func (a *App) GetRole(id string) (*model.Role, *model.AppError)

func (*App) GetRoleByName

func (a *App) GetRoleByName(name string) (*model.Role, *model.AppError)

func (*App) GetRolesByNames

func (a *App) GetRolesByNames(names []string) ([]*model.Role, *model.AppError)

func (*App) GetSamlCertificateStatus

func (a *App) GetSamlCertificateStatus() *model.SamlCertificateStatus

func (*App) GetSamlMetadata

func (a *App) GetSamlMetadata() (string, *model.AppError)

func (*App) GetSamlMetadataFromIdp

func (a *App) GetSamlMetadataFromIdp(idpMetadataUrl string) (*model.SamlMetadataResponse, *model.AppError)

func (*App) GetSanitizeOptions

func (a *App) GetSanitizeOptions(asAdmin bool) map[string]bool

func (*App) GetSanitizedConfig

func (a *App) GetSanitizedConfig() *model.Config

GetSanitizedConfig gets the configuration for a system admin without any secrets.

func (*App) GetScheme

func (a *App) GetScheme(id string) (*model.Scheme, *model.AppError)

func (*App) GetSchemeByName

func (a *App) GetSchemeByName(name string) (*model.Scheme, *model.AppError)

func (*App) GetSchemeRolesForChannel

func (a *App) GetSchemeRolesForChannel(channelId string) (guestRoleName, userRoleName, adminRoleName string, err *model.AppError)

GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles.

func (*App) GetSchemeRolesForTeam

func (a *App) GetSchemeRolesForTeam(teamId string) (string, string, string, *model.AppError)

func (*App) GetSchemes

func (a *App) GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError)

func (*App) GetSchemesPage

func (a *App) GetSchemesPage(scope string, page int, perPage int) ([]*model.Scheme, *model.AppError)

func (*App) GetSession

func (a *App) GetSession(token string) (*model.Session, *model.AppError)

func (*App) GetSessionById

func (a *App) GetSessionById(sessionId string) (*model.Session, *model.AppError)

func (*App) GetSessionLengthInMillis

func (a *App) GetSessionLengthInMillis(session *model.Session) int64

GetSessionLengthInMillis returns the session length, in milliseconds, based on the type of session (Mobile, SSO, Web/LDAP).

func (*App) GetSessions

func (a *App) GetSessions(userId string) ([]*model.Session, *model.AppError)

func (*App) GetSidebarCategories

func (a *App) GetSidebarCategories(userId, teamId string) (*model.OrderedSidebarCategories, *model.AppError)

func (*App) GetSidebarCategory

func (a *App) GetSidebarCategory(categoryId string) (*model.SidebarCategoryWithChannels, *model.AppError)

func (*App) GetSidebarCategoryOrder

func (a *App) GetSidebarCategoryOrder(userId, teamId string) ([]string, *model.AppError)

func (*App) GetSinglePost

func (a *App) GetSinglePost(postId string) (*model.Post, *model.AppError)

func (*App) GetSiteURL

func (a *App) GetSiteURL() string

func (*App) GetStatus

func (a *App) GetStatus(userId string) (*model.Status, *model.AppError)

func (*App) GetStatusFromCache

func (a *App) GetStatusFromCache(userId string) *model.Status

func (*App) GetStatusesByIds

func (a *App) GetStatusesByIds(userIds []string) (map[string]interface{}, *model.AppError)

func (*App) GetSuggestions

func (a *App) GetSuggestions(commandArgs *model.CommandArgs, commands []*model.Command, roleID string) []model.AutocompleteSuggestion

GetSuggestions returns suggestions for user input.

func (*App) GetT

func (a *App) GetT() goi18n.TranslateFunc

func (*App) GetTeam

func (a *App) GetTeam(teamId string) (*model.Team, *model.AppError)

func (*App) GetTeamByInviteId

func (a *App) GetTeamByInviteId(inviteId string) (*model.Team, *model.AppError)

func (*App) GetTeamByName

func (a *App) GetTeamByName(name string) (*model.Team, *model.AppError)

func (*App) GetTeamGroupUsers

func (a *App) GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)

GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.

func (*App) GetTeamIcon

func (a *App) GetTeamIcon(team *model.Team) ([]byte, *model.AppError)

func (*App) GetTeamIdFromQuery

func (a *App) GetTeamIdFromQuery(query url.Values) (string, *model.AppError)

func (*App) GetTeamMember

func (a *App) GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

func (*App) GetTeamMembers

func (a *App) GetTeamMembers(teamId string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, *model.AppError)

func (*App) GetTeamMembersByIds

func (a *App) GetTeamMembersByIds(teamId string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, *model.AppError)

func (*App) GetTeamMembersForUser

func (a *App) GetTeamMembersForUser(userId string) ([]*model.TeamMember, *model.AppError)

func (*App) GetTeamMembersForUserWithPagination

func (a *App) GetTeamMembersForUserWithPagination(userId string, page, perPage int) ([]*model.TeamMember, *model.AppError)

func (*App) GetTeamSchemeChannelRoles

func (a *App) GetTeamSchemeChannelRoles(teamId string) (guestRoleName, userRoleName, adminRoleName string, err *model.AppError)

GetTeamSchemeChannelRoles Checks if a team has an override scheme and returns the scheme channel role names or default channel role names.

func (*App) GetTeamStats

func (a *App) GetTeamStats(teamId string, restrictions *model.ViewUsersRestrictions) (*model.TeamStats, *model.AppError)

func (*App) GetTeamUnread

func (a *App) GetTeamUnread(teamId, userId string) (*model.TeamUnread, *model.AppError)

func (*App) GetTeamsForScheme

func (a *App) GetTeamsForScheme(scheme *model.Scheme, offset int, limit int) ([]*model.Team, *model.AppError)

func (*App) GetTeamsForSchemePage

func (a *App) GetTeamsForSchemePage(scheme *model.Scheme, page int, perPage int) ([]*model.Team, *model.AppError)

func (*App) GetTeamsForUser

func (a *App) GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)

func (*App) GetTeamsUnreadForUser

func (a *App) GetTeamsUnreadForUser(excludeTeamId string, userId string) ([]*model.TeamUnread, *model.AppError)

func (*App) GetTermsOfService

func (a *App) GetTermsOfService(id string) (*model.TermsOfService, *model.AppError)

func (*App) GetTotalUsersStats

func (a *App) GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)

GetTotalUsersStats is used for the DM list total

func (*App) GetUploadSession

func (a *App) GetUploadSession(uploadId string) (*model.UploadSession, *model.AppError)

func (*App) GetUploadSessionsForUser

func (a *App) GetUploadSessionsForUser(userId string) ([]*model.UploadSession, *model.AppError)

func (*App) GetUser

func (a *App) GetUser(userId string) (*model.User, *model.AppError)

func (*App) GetUserAccessToken

func (a *App) GetUserAccessToken(tokenId string, sanitize bool) (*model.UserAccessToken, *model.AppError)

func (*App) GetUserAccessTokens

func (a *App) GetUserAccessTokens(page, perPage int) ([]*model.UserAccessToken, *model.AppError)

func (*App) GetUserAccessTokensForUser

func (a *App) GetUserAccessTokensForUser(userId string, page, perPage int) ([]*model.UserAccessToken, *model.AppError)

func (*App) GetUserByAuth

func (a *App) GetUserByAuth(authData *string, authService string) (*model.User, *model.AppError)

func (*App) GetUserByEmail

func (a *App) GetUserByEmail(email string) (*model.User, *model.AppError)

func (*App) GetUserByUsername

func (a *App) GetUserByUsername(username string) (*model.User, *model.AppError)

func (*App) GetUserForLogin

func (a *App) GetUserForLogin(id, loginId string) (*model.User, *model.AppError)

func (*App) GetUserStatusesByIds

func (a *App) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)

GetUserStatusesByIds used by apiV4

func (*App) GetUserTermsOfService

func (a *App) GetUserTermsOfService(userId string) (*model.UserTermsOfService, *model.AppError)

func (*App) GetUsers

func (a *App) GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)

func (*App) GetUsersByGroupChannelIds

func (a *App) GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError)

func (*App) GetUsersByIds

func (a *App) GetUsersByIds(userIds []string, options *store.UserGetByIdsOpts) ([]*model.User, *model.AppError)

func (*App) GetUsersByUsernames

func (a *App) GetUsersByUsernames(usernames []string, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetUsersEtag

func (a *App) GetUsersEtag(restrictionsHash string) string

func (*App) GetUsersInChannel

func (a *App) GetUsersInChannel(options *model.UserGetOptions) ([]*model.User, *model.AppError)

func (*App) GetUsersInChannelByStatus

func (a *App) GetUsersInChannelByStatus(options *model.UserGetOptions) ([]*model.User, *model.AppError)

func (*App) GetUsersInChannelMap

func (a *App) GetUsersInChannelMap(options *model.UserGetOptions, asAdmin bool) (map[string]*model.User, *model.AppError)

func (*App) GetUsersInChannelPage

func (a *App) GetUsersInChannelPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)

func (*App) GetUsersInChannelPageByStatus

func (a *App) GetUsersInChannelPageByStatus(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)

func (*App) GetUsersInTeam

func (a *App) GetUsersInTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError)

func (*App) GetUsersInTeamEtag

func (a *App) GetUsersInTeamEtag(teamId string, restrictionsHash string) string

func (*App) GetUsersInTeamPage

func (a *App) GetUsersInTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)

func (*App) GetUsersNotInChannel

func (a *App) GetUsersNotInChannel(teamId string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetUsersNotInChannelMap

func (a *App) GetUsersNotInChannelMap(teamId string, channelId string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError)

func (*App) GetUsersNotInChannelPage

func (a *App) GetUsersNotInChannelPage(teamId string, channelId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetUsersNotInTeam

func (a *App) GetUsersNotInTeam(teamId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetUsersNotInTeamEtag

func (a *App) GetUsersNotInTeamEtag(teamId string, restrictionsHash string) string

func (*App) GetUsersNotInTeamPage

func (a *App) GetUsersNotInTeamPage(teamId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)

func (*App) GetUsersPage

func (a *App) GetUsersPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)

func (*App) GetUsersWithoutTeam

func (a *App) GetUsersWithoutTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError)

func (*App) GetUsersWithoutTeamPage

func (a *App) GetUsersWithoutTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)

func (*App) GetVerifyEmailToken

func (a *App) GetVerifyEmailToken(token string) (*model.Token, *model.AppError)

func (*App) GetViewUsersRestrictions

func (a *App) GetViewUsersRestrictions(userId string) (*model.ViewUsersRestrictions, *model.AppError)

func (*App) GetWarnMetricsStatus

func (a *App) GetWarnMetricsStatus() (map[string]*model.WarnMetricStatus, *model.AppError)

func (*App) HTTPService

func (a *App) HTTPService() httpservice.HTTPService

func (*App) Handle404

func (a *App) Handle404(w http.ResponseWriter, r *http.Request)

func (*App) HandleCommandResponse

func (a *App) HandleCommandResponse(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError)

func (*App) HandleCommandResponsePost

func (a *App) HandleCommandResponsePost(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.Post, *model.AppError)

func (*App) HandleCommandWebhook

func (a *App) HandleCommandWebhook(hookId string, response *model.CommandResponse) *model.AppError

func (*App) HandleImages

func (a *App) HandleImages(previewPathList []string, thumbnailPathList []string, fileData [][]byte)

func (*App) HandleIncomingWebhook

func (a *App) HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest) *model.AppError

func (*App) HandleMessageExportConfig

func (a *App) HandleMessageExportConfig(cfg *model.Config, appCfg *model.Config)

func (*App) HasPermissionTo

func (a *App) HasPermissionTo(askingUserId string, permission *model.Permission) bool

func (*App) HasPermissionToChannel

func (a *App) HasPermissionToChannel(askingUserId string, channelId string, permission *model.Permission) bool

func (*App) HasPermissionToChannelByPost

func (a *App) HasPermissionToChannelByPost(askingUserId string, postId string, permission *model.Permission) bool

func (*App) HasPermissionToTeam

func (a *App) HasPermissionToTeam(askingUserId string, teamId string, permission *model.Permission) bool

func (*App) HasPermissionToUser

func (a *App) HasPermissionToUser(askingUserId string, userId string) bool

func (*App) HubRegister

func (a *App) HubRegister(webConn *WebConn)

HubRegister registers a connection to a hub.

func (*App) HubStart

func (a *App) HubStart()

HubStart starts all the hubs.

func (*App) HubStop

func (a *App) HubStop()

func (*App) HubUnregister

func (a *App) HubUnregister(webConn *WebConn)

HubUnregister unregisters a connection from a hub.

func (*App) ImageProxy

func (a *App) ImageProxy() *imageproxy.ImageProxy

func (*App) ImageProxyAdder

func (a *App) ImageProxyAdder() func(string) string

func (*App) ImageProxyRemover

func (a *App) ImageProxyRemover() (f func(string) string)

func (*App) ImportPermissions

func (a *App) ImportPermissions(jsonl io.Reader) error

func (*App) InitPlugins

func (a *App) InitPlugins(pluginDir, webappPluginDir string)

func (*App) InitPostMetadata

func (a *App) InitPostMetadata()

func (*App) InitServer

func (a *App) InitServer()

func (*App) InstallMarketplacePlugin

func (a *App) InstallMarketplacePlugin(request *model.InstallMarketplacePluginRequest) (*model.Manifest, *model.AppError)

InstallMarketplacePlugin installs a plugin listed in the marketplace server. It will get the plugin bundle from the prepackaged folder, if available, or remotely if EnableRemoteMarketplace is true.

func (*App) InstallPlugin

func (a *App) InstallPlugin(pluginFile io.ReadSeeker, replace bool) (*model.Manifest, *model.AppError)

InstallPlugin unpacks and installs a plugin but does not enable or activate it.

func (*App) InstallPluginFromData

func (a *App) InstallPluginFromData(data model.PluginEventData)

func (*App) InstallPluginWithSignature

func (a *App) InstallPluginWithSignature(pluginFile, signature io.ReadSeeker) (*model.Manifest, *model.AppError)

InstallPluginWithSignature verifies and installs plugin.

func (*App) InvalidateAllEmailInvites

func (a *App) InvalidateAllEmailInvites() *model.AppError

func (*App) InvalidateCacheForUser

func (a *App) InvalidateCacheForUser(userId string)

func (*App) InvalidateWebConnSessionCacheForUser

func (a *App) InvalidateWebConnSessionCacheForUser(userId string)

func (*App) InviteGuestsToChannels

func (a *App) InviteGuestsToChannels(teamId string, guestsInvite *model.GuestsInvite, senderId string) *model.AppError

func (*App) InviteGuestsToChannelsGracefully

func (a *App) InviteGuestsToChannelsGracefully(teamId string, guestsInvite *model.GuestsInvite, senderId string) ([]*model.EmailInviteWithError, *model.AppError)

func (*App) InviteNewUsersToTeam

func (a *App) InviteNewUsersToTeam(emailList []string, teamId, senderId string) *model.AppError

func (*App) InviteNewUsersToTeamGracefully

func (a *App) InviteNewUsersToTeamGracefully(emailList []string, teamId, senderId string) ([]*model.EmailInviteWithError, *model.AppError)

func (*App) IpAddress

func (a *App) IpAddress() string

func (*App) IsFirstUserAccount

func (a *App) IsFirstUserAccount() bool

func (*App) IsLeader

func (a *App) IsLeader() bool

func (*App) IsPasswordValid

func (a *App) IsPasswordValid(password string) *model.AppError

func (*App) IsPhase2MigrationCompleted

func (a *App) IsPhase2MigrationCompleted() *model.AppError

func (*App) IsUserAway

func (a *App) IsUserAway(lastActivityAt int64) bool

func (*App) IsUserSignUpAllowed

func (a *App) IsUserSignUpAllowed() *model.AppError

func (*App) IsUsernameTaken

func (a *App) IsUsernameTaken(name string) bool

IsUsernameTaken checks if the username is already used by another user. Return false if the username is invalid.

func (*App) JoinChannel

func (a *App) JoinChannel(channel *model.Channel, userId string) *model.AppError

func (*App) JoinDefaultChannels

func (a *App) JoinDefaultChannels(teamId string, user *model.User, shouldBeAdmin bool, userRequestorId string) *model.AppError

func (*App) JoinUserToTeam

func (a *App) JoinUserToTeam(team *model.Team, user *model.User, userRequestorId string) *model.AppError

func (*App) Ldap

func (a *App) Ldap() einterfaces.LdapInterface

func (*App) LeaveChannel

func (a *App) LeaveChannel(channelId string, userId string) *model.AppError

func (*App) LeaveTeam

func (a *App) LeaveTeam(team *model.Team, user *model.User, requestorId string) *model.AppError

func (*App) LimitedClientConfig

func (a *App) LimitedClientConfig() map[string]string

func (*App) LimitedClientConfigWithComputed

func (a *App) LimitedClientConfigWithComputed() map[string]string

LimitedClientConfigWithComputed gets the configuration in a format suitable for sending to the client.

func (*App) ListAllCommands

func (a *App) ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)

func (*App) ListAutocompleteCommands

func (a *App) ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)

@openTracingParams teamId previous ListCommands now ListAutocompleteCommands

func (*App) ListDirectory

func (a *App) ListDirectory(path string) ([]string, *model.AppError)

func (*App) ListPluginKeys

func (a *App) ListPluginKeys(pluginId string, page, perPage int) ([]string, *model.AppError)

func (*App) ListTeamCommands

func (a *App) ListTeamCommands(teamId string) ([]*model.Command, *model.AppError)

func (*App) Log

func (a *App) Log() *mlog.Logger

func (*App) LogAuditRec

func (a *App) LogAuditRec(rec *audit.Record, err error)

LogAuditRec logs an audit record using default LvlAuditCLI.

func (*App) LogAuditRecWithLevel

func (a *App) LogAuditRecWithLevel(rec *audit.Record, level mlog.LogLevel, err error)

LogAuditRecWithLevel logs an audit record using specified Level.

func (*App) LoginByOAuth

func (a *App) LoginByOAuth(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)

func (*App) MakeAuditRecord

func (a *App) MakeAuditRecord(event string, initialStatus string) *audit.Record

MakeAuditRecord creates a audit record pre-populated with defaults.

func (*App) MakePermissionError

func (a *App) MakePermissionError(permissions []*model.Permission) *model.AppError

func (*App) MarkChannelAsUnreadFromPost

func (a *App) MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)

MarkChanelAsUnreadFromPost will take a post and set the channel as unread from that one.

func (*App) MarkChannelsAsViewed

func (a *App) MarkChannelsAsViewed(channelIds []string, userId string, currentSessionId string) (map[string]int64, *model.AppError)

func (*App) MaxPostSize

func (a *App) MaxPostSize() int

func (*App) MentionsToPublicChannels

func (a *App) MentionsToPublicChannels(message, teamId string) model.ChannelMentionMap

MentionsToPublicChannels returns all the mentions to public channels, linking them to their channels

func (*App) MentionsToTeamMembers

func (a *App) MentionsToTeamMembers(message, teamId string) model.UserMentionMap

MentionsToTeamMembers returns all the @ mentions found in message that belong to users in the specified team, linking them to their users

func (*App) MessageExport

func (a *App) MessageExport() einterfaces.MessageExportInterface

func (*App) Metrics

func (a *App) Metrics() einterfaces.MetricsInterface

func (*App) MigrateFilenamesToFileInfos

func (a *App) MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo

Creates and stores FileInfos for a post created before the FileInfos table existed.

func (*App) MigrateIdLDAP

func (a *App) MigrateIdLDAP(toAttribute string) *model.AppError

func (*App) MoveChannel

func (a *App) MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError

MoveChannel method is prone to data races if someone joins to channel during the move process. However this function is only exposed to sysadmins and the possibility of this edge case is realtively small.

func (*App) MoveCommand

func (a *App) MoveCommand(team *model.Team, command *model.Command) *model.AppError

func (*App) MoveFile

func (a *App) MoveFile(oldPath, newPath string) *model.AppError

func (*App) NewClusterDiscoveryService

func (a *App) NewClusterDiscoveryService() *ClusterDiscoveryService

func (*App) NewPluginAPI

func (a *App) NewPluginAPI(manifest *model.Manifest) plugin.API

func (*App) NewWebConn

func (a *App) NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn

NewWebConn returns a new WebConn instance.

func (*App) NewWebHub

func (a *App) NewWebHub() *Hub

NewWebHub creates a new Hub.

func (*App) Notification

func (a *App) Notification() einterfaces.NotificationInterface

func (*App) NotificationsLog

func (a *App) NotificationsLog() *mlog.Logger

func (*App) NotifyAndSetWarnMetricAck

func (a *App) NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User, forceAck bool, isBot bool) *model.AppError

func (*App) NotifySessionsExpired

func (a *App) NotifySessionsExpired() *model.AppError

NotifySessionsExpired is called periodically from the job server to notify any mobile sessions that have expired.

func (*App) OpenInteractiveDialog

func (a *App) OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError

func (*App) OriginChecker

func (a *App) OriginChecker() func(*http.Request) bool

func (*App) OverrideIconURLIfEmoji

func (a *App) OverrideIconURLIfEmoji(post *model.Post)

OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon, so that it points to the URL (relative) of the emoji - static if emoji is default, /api if custom.

func (*App) PatchBot

func (a *App) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)

PatchBot applies the given patch to the bot and corresponding user.

func (*App) PatchChannel

func (a *App) PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userId string) (*model.Channel, *model.AppError)

func (*App) PatchChannelModerationsForChannel

func (a *App) PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)

PatchChannelModerationsForChannel Updates a channels scheme roles based on a given ChannelModerationPatch, if the permissions match the higher scoped role the scheme is deleted.

func (*App) PatchPost

func (a *App) PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError)

func (*App) PatchRole

func (a *App) PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError)

func (*App) PatchScheme

func (a *App) PatchScheme(scheme *model.Scheme, patch *model.SchemePatch) (*model.Scheme, *model.AppError)

func (*App) PatchTeam

func (a *App) PatchTeam(teamId string, patch *model.TeamPatch) (*model.Team, *model.AppError)

func (*App) PatchUser

func (a *App) PatchUser(userId string, patch *model.UserPatch, asAdmin bool) (*model.User, *model.AppError)

func (*App) Path

func (a *App) Path() string

func (*App) PermanentDeleteAllUsers

func (a *App) PermanentDeleteAllUsers() *model.AppError

func (*App) PermanentDeleteBot

func (a *App) PermanentDeleteBot(botUserId string) *model.AppError

PermanentDeleteBot permanently deletes a bot and its corresponding user.

func (*App) PermanentDeleteChannel

func (a *App) PermanentDeleteChannel(channel *model.Channel) *model.AppError

func (*App) PermanentDeleteTeam

func (a *App) PermanentDeleteTeam(team *model.Team) *model.AppError

func (*App) PermanentDeleteTeamId

func (a *App) PermanentDeleteTeamId(teamId string) *model.AppError

func (*App) PermanentDeleteUser

func (a *App) PermanentDeleteUser(user *model.User) *model.AppError

func (*App) PluginCommandsForTeam

func (a *App) PluginCommandsForTeam(teamId string) []*model.Command

func (*App) PluginContext

func (a *App) PluginContext() *plugin.Context

func (*App) PostActionCookieSecret

func (a *App) PostActionCookieSecret() []byte

func (*App) PostAddToChannelMessage

func (a *App) PostAddToChannelMessage(user *model.User, addedUser *model.User, channel *model.Channel, postRootId string) *model.AppError

func (*App) PostPatchWithProxyRemovedFromImageURLs

func (a *App) PostPatchWithProxyRemovedFromImageURLs(patch *model.PostPatch) *model.PostPatch

func (*App) PostUpdateChannelDisplayNameMessage

func (a *App) PostUpdateChannelDisplayNameMessage(userId string, channel *model.Channel, oldChannelDisplayName, newChannelDisplayName string) *model.AppError

func (*App) PostUpdateChannelHeaderMessage

func (a *App) PostUpdateChannelHeaderMessage(userId string, channel *model.Channel, oldChannelHeader, newChannelHeader string) *model.AppError

func (*App) PostUpdateChannelPurposeMessage

func (a *App) PostUpdateChannelPurposeMessage(userId string, channel *model.Channel, oldChannelPurpose string, newChannelPurpose string) *model.AppError

func (*App) PostWithProxyAddedToImageURLs

func (a *App) PostWithProxyAddedToImageURLs(post *model.Post) *model.Post

func (*App) PostWithProxyRemovedFromImageURLs

func (a *App) PostWithProxyRemovedFromImageURLs(post *model.Post) *model.Post

func (*App) PreparePostForClient

func (a *App) PreparePostForClient(originalPost *model.Post, isNewPost bool, isEditPost bool) *model.Post

func (*App) PreparePostListForClient

func (a *App) PreparePostListForClient(originalList *model.PostList) *model.PostList

func (*App) ProcessSlackAttachments

func (a *App) ProcessSlackAttachments(attachments []*model.SlackAttachment) []*model.SlackAttachment

Expand announcements in incoming webhooks from Slack. Those announcements can be found in the text attribute, or in the pretext, text, title and value attributes of the attachment structure. The Slack attachment structure is documented here: https://api.slack.com/docs/attachments

func (*App) ProcessSlackText

func (a *App) ProcessSlackText(text string) string

func (*App) PromoteGuestToUser

func (a *App) PromoteGuestToUser(user *model.User, requestorId string) *model.AppError

PromoteGuestToUser Convert user's roles and all his mermbership's roles from guest roles to regular user roles.

func (*App) Publish

func (a *App) Publish(message *model.WebSocketEvent)

func (*App) PublishSkipClusterSend

func (a *App) PublishSkipClusterSend(message *model.WebSocketEvent)

func (*App) PublishUserTyping

func (a *App) PublishUserTyping(userId, channelId, parentId string) *model.AppError

func (*App) PurgeBleveIndexes

func (a *App) PurgeBleveIndexes() *model.AppError

func (*App) PurgeElasticsearchIndexes

func (a *App) PurgeElasticsearchIndexes() *model.AppError

func (*App) ReadFile

func (a *App) ReadFile(path string) ([]byte, *model.AppError)

func (*App) RecycleDatabaseConnection

func (a *App) RecycleDatabaseConnection()

func (*App) RegenCommandToken

func (a *App) RegenCommandToken(cmd *model.Command) (*model.Command, *model.AppError)

func (*App) RegenOutgoingWebhookToken

func (a *App) RegenOutgoingWebhookToken(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)

func (*App) RegenerateOAuthAppSecret

func (a *App) RegenerateOAuthAppSecret(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)

func (*App) RegenerateTeamInviteId

func (a *App) RegenerateTeamInviteId(teamId string) (*model.Team, *model.AppError)

func (*App) RegisterPluginCommand

func (a *App) RegisterPluginCommand(pluginId string, command *model.Command) error

func (*App) ReloadConfig

func (a *App) ReloadConfig() error

func (*App) RemoveAllDeactivatedMembersFromChannel

func (a *App) RemoveAllDeactivatedMembersFromChannel(channel *model.Channel) *model.AppError

func (*App) RemoveConfigListener

func (a *App) RemoveConfigListener(id string)

func (*App) RemoveFile

func (a *App) RemoveFile(path string) *model.AppError

func (*App) RemoveLdapPrivateCertificate

func (a *App) RemoveLdapPrivateCertificate() *model.AppError

func (*App) RemoveLdapPublicCertificate

func (a *App) RemoveLdapPublicCertificate() *model.AppError

func (*App) RemovePlugin

func (a *App) RemovePlugin(id string) *model.AppError

func (*App) RemovePluginFromData

func (a *App) RemovePluginFromData(data model.PluginEventData)

func (*App) RemoveSamlIdpCertificate

func (a *App) RemoveSamlIdpCertificate() *model.AppError

func (*App) RemoveSamlPrivateCertificate

func (a *App) RemoveSamlPrivateCertificate() *model.AppError

func (*App) RemoveSamlPublicCertificate

func (a *App) RemoveSamlPublicCertificate() *model.AppError

func (*App) RemoveTeamIcon

func (a *App) RemoveTeamIcon(teamId string) *model.AppError

func (*App) RemoveTeamMemberFromTeam

func (a *App) RemoveTeamMemberFromTeam(teamMember *model.TeamMember, requestorId string) *model.AppError

func (*App) RemoveUserFromChannel

func (a *App) RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError

func (*App) RemoveUserFromTeam

func (a *App) RemoveUserFromTeam(teamId string, userId string, requestorId string) *model.AppError

func (*App) RemoveUsersFromChannelNotMemberOfTeam

func (a *App) RemoveUsersFromChannelNotMemberOfTeam(remover *model.User, channel *model.Channel, team *model.Team) *model.AppError

func (*App) RenameChannel

func (a *App) RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError)

RenameChannel is used to rename the channel Name and the DisplayName fields

func (*App) RenameTeam

func (a *App) RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError)

RenameTeam is used to rename the team Name and the DisplayName fields

func (*App) RequestId

func (a *App) RequestId() string

func (*App) RequestLicenseAndAckWarnMetric

func (a *App) RequestLicenseAndAckWarnMetric(warnMetricId string, isBot bool) *model.AppError

func (*App) ResetPasswordFromToken

func (a *App) ResetPasswordFromToken(userSuppliedTokenString, newPassword string) *model.AppError

func (*App) ResetPermissionsSystem

func (a *App) ResetPermissionsSystem() *model.AppError

func (*App) RestoreChannel

func (a *App) RestoreChannel(channel *model.Channel, userId string) (*model.Channel, *model.AppError)

func (*App) RestoreTeam

func (a *App) RestoreTeam(teamId string) *model.AppError

func (*App) RestrictUsersGetByPermissions

func (a *App) RestrictUsersGetByPermissions(userId string, options *model.UserGetOptions) (*model.UserGetOptions, *model.AppError)

func (*App) RestrictUsersSearchByPermissions

func (a *App) RestrictUsersSearchByPermissions(userId string, options *model.UserSearchOptions) (*model.UserSearchOptions, *model.AppError)

func (*App) RevokeAccessToken

func (a *App) RevokeAccessToken(token string) *model.AppError

func (*App) RevokeAllSessions

func (a *App) RevokeAllSessions(userId string) *model.AppError

func (*App) RevokeSession

func (a *App) RevokeSession(session *model.Session) *model.AppError

func (*App) RevokeSessionById

func (a *App) RevokeSessionById(sessionId string) *model.AppError

func (*App) RevokeSessionsForDeviceId

func (a *App) RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError

func (*App) RevokeSessionsFromAllUsers

func (a *App) RevokeSessionsFromAllUsers() *model.AppError

RevokeSessionsFromAllUsers will go through all the sessions active in the server and revoke them

func (*App) RevokeUserAccessToken

func (a *App) RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError

func (*App) RolesGrantPermission

func (a *App) RolesGrantPermission(roleNames []string, permissionId string) bool

func (*App) Saml

func (a *App) Saml() einterfaces.SamlInterface

func (*App) SanitizeProfile

func (a *App) SanitizeProfile(user *model.User, asAdmin bool)

func (*App) SanitizeTeam

func (a *App) SanitizeTeam(session model.Session, team *model.Team) *model.Team

func (*App) SanitizeTeams

func (a *App) SanitizeTeams(session model.Session, teams []*model.Team) []*model.Team

func (*App) SaveAndBroadcastStatus

func (a *App) SaveAndBroadcastStatus(status *model.Status)

func (*App) SaveBrandImage

func (a *App) SaveBrandImage(imageData *multipart.FileHeader) *model.AppError

func (*App) SaveComplianceReport

func (a *App) SaveComplianceReport(job *model.Compliance) (*model.Compliance, *model.AppError)

func (*App) SaveConfig

func (a *App) SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError

SaveConfig replaces the active configuration, optionally notifying cluster peers.

func (*App) SaveReactionForPost

func (a *App) SaveReactionForPost(reaction *model.Reaction) (*model.Reaction, *model.AppError)

func (*App) SaveUserTermsOfService

func (a *App) SaveUserTermsOfService(userId, termsOfServiceId string, accepted bool) *model.AppError

func (*App) SchemesIterator

func (a *App) SchemesIterator(scope string, batchSize int) func() []*model.Scheme

func (*App) SearchAllChannels

func (a *App) SearchAllChannels(term string, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, *model.AppError)

SearchAllChannels returns a list of channels, the total count of the results of the search (if the paginate search option is true), and an error.

func (*App) SearchAllTeams

func (a *App) SearchAllTeams(searchOpts *model.TeamSearch) ([]*model.Team, int64, *model.AppError)

SearchAllTeams returns a team list and the total count of the results

func (*App) SearchArchivedChannels

func (a *App) SearchArchivedChannels(teamId string, term string, userId string) (*model.ChannelList, *model.AppError)

func (*App) SearchChannels

func (a *App) SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError)

func (*App) SearchChannelsForUser

func (a *App) SearchChannelsForUser(userId, teamId, term string) (*model.ChannelList, *model.AppError)

func (*App) SearchChannelsUserNotIn

func (a *App) SearchChannelsUserNotIn(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)

func (*App) SearchEmoji

func (a *App) SearchEmoji(name string, prefixOnly bool, limit int) ([]*model.Emoji, *model.AppError)

func (*App) SearchEngine

func (a *App) SearchEngine() *searchengine.Broker

func (*App) SearchGroupChannels

func (a *App) SearchGroupChannels(userId, term string) (*model.ChannelList, *model.AppError)

func (*App) SearchPostsInTeam

func (a *App) SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) (*model.PostList, *model.AppError)

func (*App) SearchPostsInTeamForUser

func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId string, isOrSearch bool, includeDeletedChannels bool, timeZoneOffset int, page, perPage int) (*model.PostSearchResults, *model.AppError)

func (*App) SearchPrivateTeams

func (a *App) SearchPrivateTeams(term string) ([]*model.Team, *model.AppError)

func (*App) SearchPublicTeams

func (a *App) SearchPublicTeams(term string) ([]*model.Team, *model.AppError)

func (*App) SearchUserAccessTokens

func (a *App) SearchUserAccessTokens(term string) ([]*model.UserAccessToken, *model.AppError)

func (*App) SearchUsers

func (a *App) SearchUsers(props *model.UserSearch, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SearchUsersInChannel

func (a *App) SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SearchUsersInGroup

func (a *App) SearchUsersInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SearchUsersInTeam

func (a *App) SearchUsersInTeam(teamId, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SearchUsersNotInChannel

func (a *App) SearchUsersNotInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SearchUsersNotInTeam

func (a *App) SearchUsersNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SearchUsersWithoutTeam

func (a *App) SearchUsersWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)

func (*App) SendAckToPushProxy

func (a *App) SendAckToPushProxy(ack *model.PushNotificationAck) error

func (*App) SendAutoResponse

func (a *App) SendAutoResponse(channel *model.Channel, receiver *model.User) (bool, *model.AppError)

func (*App) SendAutoResponseIfNecessary

func (a *App) SendAutoResponseIfNecessary(channel *model.Channel, sender *model.User) (bool, *model.AppError)

func (*App) SendEmailVerification

func (a *App) SendEmailVerification(user *model.User, newEmail, redirect string) *model.AppError

func (*App) SendEphemeralPost

func (a *App) SendEphemeralPost(userId string, post *model.Post) *model.Post

func (*App) SendNotifications

func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *model.Channel, sender *model.User, parentPostList *model.PostList, setOnline bool) ([]string, error)

func (*App) SendPasswordReset

func (a *App) SendPasswordReset(email string, siteURL string) (bool, *model.AppError)

func (*App) ServeInterPluginRequest

func (a *App) ServeInterPluginRequest(w http.ResponseWriter, r *http.Request, sourcePluginId, destinationPluginId string)

func (*App) ServePluginPublicRequest

func (a *App) ServePluginPublicRequest(w http.ResponseWriter, r *http.Request)

ServePluginPublicRequest serves public plugin files at the URL http(s)://$SITE_URL/plugins/$PLUGIN_ID/public/{anything}

func (*App) ServePluginRequest

func (a *App) ServePluginRequest(w http.ResponseWriter, r *http.Request)

func (*App) ServerBusyStateChanged

func (a *App) ServerBusyStateChanged(sbs *model.ServerBusyState)

ServerBusyStateChanged is called when a CLUSTER_EVENT_BUSY_STATE_CHANGED is received.

func (*App) Session

func (a *App) Session() *model.Session

func (*App) SessionCacheLength

func (a *App) SessionCacheLength() int

func (*App) SessionHasPermissionTo

func (a *App) SessionHasPermissionTo(session model.Session, permission *model.Permission) bool

func (*App) SessionHasPermissionToAny

func (a *App) SessionHasPermissionToAny(session model.Session, permissions []*model.Permission) bool

func (*App) SessionHasPermissionToCategory

func (a *App) SessionHasPermissionToCategory(session model.Session, userId, teamId, categoryId string) bool

func (*App) SessionHasPermissionToChannel

func (a *App) SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool

func (*App) SessionHasPermissionToChannelByPost

func (a *App) SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool

func (*App) SessionHasPermissionToManageBot

func (a *App) SessionHasPermissionToManageBot(session model.Session, botUserId string) *model.AppError

SessionHasPermissionToManageBot returns nil if the session has access to manage the given bot. This function deviates from other authorization checks in returning an error instead of just a boolean, allowing the permission failure to be exposed with more granularity.

func (*App) SessionHasPermissionToTeam

func (a *App) SessionHasPermissionToTeam(session model.Session, teamId string, permission *model.Permission) bool

func (*App) SessionHasPermissionToUser

func (a *App) SessionHasPermissionToUser(session model.Session, userId string) bool

func (*App) SessionHasPermissionToUserOrBot

func (a *App) SessionHasPermissionToUserOrBot(session model.Session, userId string) bool

func (*App) SessionIsRegistered

func (a *App) SessionIsRegistered(session model.Session) bool

SessionIsRegistered determines if a specific session has been registered

func (*App) SetAcceptLanguage

func (a *App) SetAcceptLanguage(s string)

func (*App) SetActiveChannel

func (a *App) SetActiveChannel(userId string, channelId string) *model.AppError

func (*App) SetAutoResponderStatus

func (a *App) SetAutoResponderStatus(user *model.User, oldNotifyProps model.StringMap)

func (*App) SetBotIconImage

func (a *App) SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError

SetBotIconImage sets LHS icon for a bot.

func (*App) SetBotIconImageFromMultiPartFile

func (a *App) SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError

SetBotIconImageFromMultiPartFile sets LHS icon for a bot.

func (*App) SetContext

func (a *App) SetContext(c context.Context)

func (*App) SetDefaultProfileImage

func (a *App) SetDefaultProfileImage(user *model.User) *model.AppError

func (*App) SetIpAddress

func (a *App) SetIpAddress(s string)

func (*App) SetPath

func (a *App) SetPath(s string)

func (*App) SetPhase2PermissionsMigrationStatus

func (a *App) SetPhase2PermissionsMigrationStatus(isComplete bool) error

func (*App) SetPluginKey

func (a *App) SetPluginKey(pluginId string, key string, value []byte) *model.AppError

func (*App) SetPluginKeyWithExpiry

func (a *App) SetPluginKeyWithExpiry(pluginId string, key string, value []byte, expireInSeconds int64) *model.AppError

func (*App) SetPluginKeyWithOptions

func (a *App) SetPluginKeyWithOptions(pluginId string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)

func (*App) SetPluginsEnvironment

func (a *App) SetPluginsEnvironment(pluginsEnvironment *plugin.Environment)

func (*App) SetProfileImage

func (a *App) SetProfileImage(userId string, imageData *multipart.FileHeader) *model.AppError

func (*App) SetProfileImageFromFile

func (a *App) SetProfileImageFromFile(userId string, file io.Reader) *model.AppError

func (*App) SetProfileImageFromMultiPartFile

func (a *App) SetProfileImageFromMultiPartFile(userId string, file multipart.File) *model.AppError

func (*App) SetRequestId

func (a *App) SetRequestId(s string)

func (*App) SetSamlIdpCertificateFromMetadata

func (a *App) SetSamlIdpCertificateFromMetadata(data []byte) *model.AppError

func (*App) SetSearchEngine

func (a *App) SetSearchEngine(se *searchengine.Broker)

func (*App) SetServer

func (a *App) SetServer(srv *Server)

func (*App) SetSession

func (a *App) SetSession(s *model.Session)

func (*App) SetSessionExpireInDays

func (a *App) SetSessionExpireInDays(session *model.Session, days int)

SetSessionExpireInDays sets the session's expiry the specified number of days relative to either the session creation date or the current time, depending on the `ExtendSessionOnActivity` config setting.

func (*App) SetStatusAwayIfNeeded

func (a *App) SetStatusAwayIfNeeded(userId string, manual bool)

func (*App) SetStatusDoNotDisturb

func (a *App) SetStatusDoNotDisturb(userId string)

func (*App) SetStatusLastActivityAt

func (a *App) SetStatusLastActivityAt(userId string, activityAt int64)

SetStatusLastActivityAt sets the last activity at for a user on the local app server and updates status to away if needed. Used by the WS to set status to away if an 'online' device disconnects while an 'away' device is still connected

func (*App) SetStatusOffline

func (a *App) SetStatusOffline(userId string, manual bool)

func (*App) SetStatusOnline

func (a *App) SetStatusOnline(userId string, manual bool)

func (*App) SetStatusOutOfOffice

func (a *App) SetStatusOutOfOffice(userId string)

func (*App) SetT

func (a *App) SetT(t goi18n.TranslateFunc)

func (*App) SetTeamIcon

func (a *App) SetTeamIcon(teamId string, imageData *multipart.FileHeader) *model.AppError

func (*App) SetTeamIconFromFile

func (a *App) SetTeamIconFromFile(team *model.Team, file io.Reader) *model.AppError

func (*App) SetTeamIconFromMultiPartFile

func (a *App) SetTeamIconFromMultiPartFile(teamId string, file multipart.File) *model.AppError

func (*App) SetUserAgent

func (a *App) SetUserAgent(s string)

func (*App) SlackImport

func (a *App) SlackImport(fileData multipart.File, fileSize int64, teamID string) (*model.AppError, *bytes.Buffer)

func (*App) SoftDeleteTeam

func (a *App) SoftDeleteTeam(teamId string) *model.AppError

func (*App) Srv

func (a *App) Srv() *Server

func (*App) SubmitInteractiveDialog

func (a *App) SubmitInteractiveDialog(request model.SubmitDialogRequest) (*model.SubmitDialogResponse, *model.AppError)

func (*App) SwitchEmailToLdap

func (a *App) SwitchEmailToLdap(email, password, code, ldapLoginId, ldapPassword string) (string, *model.AppError)

func (*App) SwitchEmailToOAuth

func (a *App) SwitchEmailToOAuth(w http.ResponseWriter, r *http.Request, email, password, code, service string) (string, *model.AppError)

func (*App) SwitchLdapToEmail

func (a *App) SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (string, *model.AppError)

func (*App) SwitchOAuthToEmail

func (a *App) SwitchOAuthToEmail(email, password, requesterId string) (string, *model.AppError)

func (*App) SyncLdap

func (a *App) SyncLdap()

func (*App) SyncPlugins

func (a *App) SyncPlugins() *model.AppError

SyncPlugins synchronizes the plugins installed locally with the plugin bundles available in the file store.

func (*App) SyncPluginsActiveState

func (a *App) SyncPluginsActiveState()

func (*App) SyncRolesAndMembership

func (a *App) SyncRolesAndMembership(syncableID string, syncableType model.GroupSyncableType)

SyncRolesAndMembership updates the SchemeAdmin status and membership of all of the members of the given syncable.

func (*App) SyncSyncableRoles

func (a *App) SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError

SyncSyncableRoles updates the SchemeAdmin field value of the given syncable's members based on the configuration of the member's group memberships and the configuration of those groups to the syncable. This method should only be invoked on group-synced (aka group-constrained) syncables.

func (*App) T

func (a *App) T(translationID string, args ...interface{}) string

func (*App) TeamMembersMinusGroupMembers

func (a *App) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)

TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given groups.

The result can be used, for example, to determine the set of users who would be removed from a team if the team were group-constrained with the given groups.

func (*App) TeamMembersToAdd

func (a *App) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError)

func (*App) TeamMembersToRemove

func (a *App) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError)

func (*App) TelemetryId

func (a *App) TelemetryId() string

func (*App) TestElasticsearch

func (a *App) TestElasticsearch(cfg *model.Config) *model.AppError

func (*App) TestEmail

func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError

func (*App) TestLdap

func (a *App) TestLdap() *model.AppError

func (*App) TestSiteURL

func (a *App) TestSiteURL(siteURL string) *model.AppError

func (*App) Timezones

func (a *App) Timezones() *timezones.Timezones

func (*App) ToggleMuteChannel

func (a *App) ToggleMuteChannel(channelId string, userId string) *model.ChannelMember

func (*App) TotalWebsocketConnections

func (a *App) TotalWebsocketConnections() int

func (*App) TriggerWebhook

func (a *App) TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model.OutgoingWebhook, post *model.Post, channel *model.Channel)

func (*App) UnregisterPluginCommand

func (a *App) UnregisterPluginCommand(pluginId, teamId, trigger string)

func (*App) UnregisterPluginCommands

func (a *App) UnregisterPluginCommands(pluginId string)

func (*App) UpdateActive

func (a *App) UpdateActive(user *model.User, active bool) (*model.User, *model.AppError)

func (*App) UpdateBotActive

func (a *App) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)

UpdateBotActive marks a bot as active or inactive, along with its corresponding user.

func (*App) UpdateBotOwner

func (a *App) UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)

UpdateBotOwner changes a bot's owner to the given value.

func (*App) UpdateChannel

func (a *App) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.

func (*App) UpdateChannelLastViewedAt

func (a *App) UpdateChannelLastViewedAt(channelIds []string, userId string) *model.AppError

func (*App) UpdateChannelMemberNotifyProps

func (a *App) UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userId string) (*model.ChannelMember, *model.AppError)

func (*App) UpdateChannelMemberRoles

func (a *App) UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError)

func (*App) UpdateChannelMemberSchemeRoles

func (a *App) UpdateChannelMemberSchemeRoles(channelId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError)

func (*App) UpdateChannelPrivacy

func (a *App) UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError)

func (*App) UpdateChannelScheme

func (a *App) UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)

UpdateChannelScheme saves the new SchemeId of the channel passed.

func (*App) UpdateCommand

func (a *App) UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError)

func (*App) UpdateConfig

func (a *App) UpdateConfig(f func(*model.Config))

func (*App) UpdateEphemeralPost

func (a *App) UpdateEphemeralPost(userId string, post *model.Post) *model.Post

func (*App) UpdateGroup

func (a *App) UpdateGroup(group *model.Group) (*model.Group, *model.AppError)

func (*App) UpdateGroupSyncable

func (a *App) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)

func (*App) UpdateHashedPassword

func (a *App) UpdateHashedPassword(user *model.User, newHashedPassword string) *model.AppError

func (*App) UpdateHashedPasswordByUserId

func (a *App) UpdateHashedPasswordByUserId(userId, newHashedPassword string) *model.AppError

func (*App) UpdateIncomingWebhook

func (a *App) UpdateIncomingWebhook(oldHook, updatedHook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)

func (*App) UpdateLastActivityAtIfNeeded

func (a *App) UpdateLastActivityAtIfNeeded(session model.Session)

func (*App) UpdateMfa

func (a *App) UpdateMfa(activate bool, userId, token string) *model.AppError

func (*App) UpdateMobileAppBadge

func (a *App) UpdateMobileAppBadge(userId string)

func (*App) UpdateOAuthUserAttrs

func (a *App) UpdateOAuthUserAttrs(userData io.Reader, user *model.User, provider einterfaces.OauthProvider, service string) *model.AppError

func (*App) UpdateOauthApp

func (a *App) UpdateOauthApp(oldApp, updatedApp *model.OAuthApp) (*model.OAuthApp, *model.AppError)

func (*App) UpdateOutgoingWebhook

func (a *App) UpdateOutgoingWebhook(oldHook, updatedHook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)

func (*App) UpdatePassword

func (a *App) UpdatePassword(user *model.User, newPassword string) *model.AppError

func (*App) UpdatePasswordAsUser

func (a *App) UpdatePasswordAsUser(userId, currentPassword, newPassword string) *model.AppError

func (*App) UpdatePasswordByUserIdSendEmail

func (a *App) UpdatePasswordByUserIdSendEmail(userId, newPassword, method string) *model.AppError

func (*App) UpdatePasswordSendEmail

func (a *App) UpdatePasswordSendEmail(user *model.User, newPassword, method string) *model.AppError

func (*App) UpdatePost

func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model.AppError)

func (*App) UpdatePreferences

func (a *App) UpdatePreferences(userId string, preferences model.Preferences) *model.AppError

func (*App) UpdateProductNotices

func (a *App) UpdateProductNotices() *model.AppError

UpdateProductNotices is called periodically from a scheduled worker to fetch new notices and update the cache

func (*App) UpdateRole

func (a *App) UpdateRole(role *model.Role) (*model.Role, *model.AppError)

func (*App) UpdateScheme

func (a *App) UpdateScheme(scheme *model.Scheme) (*model.Scheme, *model.AppError)

func (*App) UpdateSessionsIsGuest

func (a *App) UpdateSessionsIsGuest(userId string, isGuest bool)

func (*App) UpdateSidebarCategories

func (a *App) UpdateSidebarCategories(userId, teamId string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)

func (*App) UpdateSidebarCategoryOrder

func (a *App) UpdateSidebarCategoryOrder(userId, teamId string, categoryOrder []string) *model.AppError

func (*App) UpdateTeam

func (a *App) UpdateTeam(team *model.Team) (*model.Team, *model.AppError)

func (*App) UpdateTeamMemberRoles

func (a *App) UpdateTeamMemberRoles(teamId string, userId string, newRoles string) (*model.TeamMember, *model.AppError)

func (*App) UpdateTeamMemberSchemeRoles

func (a *App) UpdateTeamMemberSchemeRoles(teamId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.TeamMember, *model.AppError)

func (*App) UpdateTeamPrivacy

func (a *App) UpdateTeamPrivacy(teamId string, teamType string, allowOpenInvite bool) *model.AppError

func (*App) UpdateTeamScheme

func (a *App) UpdateTeamScheme(team *model.Team) (*model.Team, *model.AppError)

func (*App) UpdateUser

func (a *App) UpdateUser(user *model.User, sendNotifications bool) (*model.User, *model.AppError)

func (*App) UpdateUserActive

func (a *App) UpdateUserActive(userId string, active bool) *model.AppError

func (*App) UpdateUserAsUser

func (a *App) UpdateUserAsUser(user *model.User, asAdmin bool) (*model.User, *model.AppError)

func (*App) UpdateUserAuth

func (a *App) UpdateUserAuth(userId string, userAuth *model.UserAuth) (*model.UserAuth, *model.AppError)

func (*App) UpdateUserNotifyProps

func (a *App) UpdateUserNotifyProps(userId string, props map[string]string) (*model.User, *model.AppError)

func (*App) UpdateUserRoles

func (a *App) UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError)

func (*App) UpdateViewedProductNotices

func (a *App) UpdateViewedProductNotices(userId string, noticeIds []string) *model.AppError

UpdateViewedProductNotices is called from the frontend to mark a set of notices as 'viewed' by user

func (*App) UpdateViewedProductNoticesForNewUser

func (a *App) UpdateViewedProductNoticesForNewUser(userId string)

UpdateViewedProductNoticesForNewUser is called when new user is created to mark all current notices for this user as viewed in order to avoid showing them imminently on first login

func (*App) UpdateWebConnUserActivity

func (a *App) UpdateWebConnUserActivity(session model.Session, activityAt int64)

UpdateWebConnUserActivity sets the LastUserActivityAt of the hub for the given session.

func (*App) UploadData

func (a *App) UploadData(us *model.UploadSession, rd io.Reader) (*model.FileInfo, *model.AppError)

func (*App) UploadEmojiImage

func (a *App) UploadEmojiImage(id string, imageData *multipart.FileHeader) *model.AppError

func (*App) UploadFile

func (a *App) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)

UploadFile uploads a single file in form of a completely constructed byte array for a channel.

func (*App) UploadFileX

func (a *App) UploadFileX(channelId, name string, input io.Reader,
	opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError)

UploadFileX uploads a single file as specified in t. It applies the upload constraints, executes plugins and image processing logic as needed. It returns a filled-out FileInfo and an optional error. A plugin may reject the upload, returning a rejection error. In this case FileInfo would have contained the last "good" FileInfo before the execution of that plugin.

func (*App) UploadFiles

func (a *App) UploadFiles(teamId string, channelId string, userId string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)

Uploads some files to the given team and channel as the given user. files and filenames should have the same length. clientIds should either not be provided or have the same length as files and filenames. The provided files should be closed by the caller so that they are not leaked.

func (*App) UploadMultipartFiles

func (a *App) UploadMultipartFiles(teamId string, channelId string, userId string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)

func (*App) UpsertGroupMember

func (a *App) UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)

func (*App) UpsertGroupSyncable

func (a *App) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)

func (*App) UserAgent

func (a *App) UserAgent() string

func (*App) UserCanSeeOtherUser

func (a *App) UserCanSeeOtherUser(userId string, otherUserId string) (bool, *model.AppError)

func (*App) UserIsInAdminRoleGroup

func (a *App) UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError)

UserIsInAdminRoleGroup returns true at least one of the user's groups are configured to set the members as admins in the given syncable.

func (*App) VerifyEmailFromToken

func (a *App) VerifyEmailFromToken(userSuppliedTokenString string) *model.AppError

func (*App) VerifyPlugin

func (a *App) VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError

VerifyPlugin checks that the given signature corresponds to the given plugin and matches a trusted certificate.

func (*App) VerifyUserEmail

func (a *App) VerifyUserEmail(userId, email string) *model.AppError

func (*App) ViewChannel

func (a *App) ViewChannel(view *model.ChannelView, userId string, currentSessionId string) (map[string]int64, *model.AppError)

func (*App) WaitForChannelMembership

func (a *App) WaitForChannelMembership(channelId string, userId string)

func (*App) WriteFile

func (a *App) WriteFile(fr io.Reader, path string) (int64, *model.AppError)

type AppIface

type AppIface interface {
	// @openTracingParams args
	ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
	// @openTracingParams teamId
	// previous ListCommands now ListAutocompleteCommands
	ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
	// @openTracingParams teamId, skipSlackParsing
	CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError)
	// AddCursorIdsForPostList adds NextPostId and PrevPostId as cursor to the PostList.
	// The conditional blocks ensure that it sets those cursor IDs immediately as afterPost, beforePost or empty,
	// and only query to database whenever necessary.
	AddCursorIdsForPostList(originalList *model.PostList, afterPost, beforePost string, since int64, page, perPage int)
	// AddPublicKey will add plugin public key to the config. Overwrites the previous file
	AddPublicKey(name string, key io.Reader) *model.AppError
	// Caller must close the first return value
	FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError)
	// ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given
	// groups.
	//
	// The result can be used, for example, to determine the set of users who would be removed from a channel if the
	// channel were group-constrained with the given groups.
	ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
	// ClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
	ClientConfigWithComputed() map[string]string
	// ConvertBotToUser converts a bot to user.
	ConvertBotToUser(bot *model.Bot, userPatch *model.UserPatch, sysadmin bool) (*model.User, *model.AppError)
	// ConvertUserToBot converts a user to bot.
	ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)
	// CreateBot creates the given bot and corresponding user.
	CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
	// CreateChannelScheme creates a new Scheme of scope channel and assigns it to the channel.
	CreateChannelScheme(channel *model.Channel) (*model.Scheme, *model.AppError)
	// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
	//
	CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)
	// CreateDefaultMemberships adds users to teams and channels based on their group memberships and how those groups
	// are configured to sync with teams and channels for group members on or after the given timestamp.
	CreateDefaultMemberships(since int64) error
	// CreateGuest creates a guest and sets several fields of the returned User struct to
	// their zero values.
	CreateGuest(user *model.User) (*model.User, *model.AppError)
	// CreateUser creates a user and sets several fields of the returned User struct to
	// their zero values.
	CreateUser(user *model.User) (*model.User, *model.AppError)
	// Creates and stores FileInfos for a post created before the FileInfos table existed.
	MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo
	// DefaultChannelNames returns the list of system-wide default channel names.
	//
	// By default the list will be (not necessarily in this order):
	//	['town-square', 'off-topic']
	// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
	// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
	//	['town-square', 'game-of-thrones', 'wow']
	//
	DefaultChannelNames() []string
	// DeleteBotIconImage deletes LHS icon for a bot.
	DeleteBotIconImage(botUserId string) *model.AppError
	// DeleteChannelScheme deletes a channels scheme and sets its SchemeId to nil.
	DeleteChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
	// DeleteGroupConstrainedMemberships deletes team and channel memberships of users who aren't members of the allowed
	// groups of all group-constrained teams and channels.
	DeleteGroupConstrainedMemberships() error
	// DeletePublicKey will delete plugin public key from the config.
	DeletePublicKey(name string) *model.AppError
	// DemoteUserToGuest Convert user's roles and all his mermbership's roles from
	// regular user roles to guest roles.
	DemoteUserToGuest(user *model.User) *model.AppError
	// DisablePlugin will set the config for an installed plugin to disabled, triggering deactivation if active.
	// Notifies cluster peers through config change.
	DisablePlugin(id string) *model.AppError
	// DoPermissionsMigrations execute all the permissions migrations need by the current version.
	DoPermissionsMigrations() error
	// EnablePlugin will set the config for an installed plugin to enabled, triggering asynchronous
	// activation if inactive anywhere in the cluster.
	// Notifies cluster peers through config change.
	EnablePlugin(id string) *model.AppError
	// Expand announcements in incoming webhooks from Slack. Those announcements
	// can be found in the text attribute, or in the pretext, text, title and value
	// attributes of the attachment structure. The Slack attachment structure is
	// documented here: https://api.slack.com/docs/attachments
	ProcessSlackAttachments(attachments []*model.SlackAttachment) []*model.SlackAttachment
	// ExtendSessionExpiryIfNeeded extends Session.ExpiresAt based on session lengths in config.
	// A new ExpiresAt is only written if enough time has elapsed since last update.
	// Returns true only if the session was extended.
	ExtendSessionExpiryIfNeeded(session *model.Session) bool
	// FillInPostProps should be invoked before saving posts to fill in properties such as
	// channel_mentions.
	//
	// If channel is nil, FillInPostProps will look up the channel corresponding to the post.
	FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError
	// FilterNonGroupChannelMembers returns the subset of the given user IDs of the users who are not members of groups
	// associated to the channel excluding bots
	FilterNonGroupChannelMembers(userIds []string, channel *model.Channel) ([]string, error)
	// FilterNonGroupTeamMembers returns the subset of the given user IDs of the users who are not members of groups
	// associated to the team excluding bots.
	FilterNonGroupTeamMembers(userIds []string, team *model.Team) ([]string, error)
	// GetAllLdapGroupsPage retrieves all LDAP groups under the configured base DN using the default or configured group
	// filter.
	GetAllLdapGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
	// GetBot returns the given bot.
	GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
	// GetBotIconImage retrieves LHS icon for a bot.
	GetBotIconImage(botUserId string) ([]byte, *model.AppError)
	// GetBots returns the requested page of bots.
	GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
	// GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.
	GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)
	// GetChannelModerationsForChannel Gets a channels ChannelModerations from either the higherScoped roles or from the channel scheme roles.
	GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)
	// GetClusterPluginStatuses returns the status for plugins installed anywhere in the cluster.
	GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)
	// GetConfigFile proxies access to the given configuration file to the underlying config store.
	GetConfigFile(name string) ([]byte, error)
	// GetEmojiStaticUrl returns a relative static URL for system default emojis,
	// and the API route for custom ones. Errors if not found or if custom and deleted.
	GetEmojiStaticUrl(emojiName string) (string, *model.AppError)
	// GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable.
	GetEnvironmentConfig() map[string]interface{}
	// GetFilteredUsersStats is used to get a count of users based on the set of filters supported by UserCountOptions.
	GetFilteredUsersStats(options *model.UserCountOptions) (*model.UsersStats, *model.AppError)
	// GetGroupsByTeam returns the paged list and the total count of group associated to the given team.
	GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)
	// GetKnownUsers returns the list of user ids of users with any direct
	// relationship with a user. That means any user sharing any channel, including
	// direct and group channels.
	GetKnownUsers(userID string) ([]string, *model.AppError)
	// GetLdapGroup retrieves a single LDAP group by the given LDAP group id.
	GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError)
	// GetMarketplacePlugins returns a list of plugins from the marketplace-server,
	// and plugins that are installed locally.
	GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*model.MarketplacePlugin, *model.AppError)
	// GetPluginPublicKeyFiles returns all public keys listed in the config.
	GetPluginPublicKeyFiles() ([]string, *model.AppError)
	// GetPluginStatus returns the status for a plugin installed on this server.
	GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
	// GetPluginStatuses returns the status for plugins installed on this server.
	GetPluginStatuses() (model.PluginStatuses, *model.AppError)
	// GetPluginsEnvironment returns the plugin environment for use if plugins are enabled and
	// initialized.
	//
	// To get the plugins environment when the plugins are disabled, manually acquire the plugins
	// lock instead.
	GetPluginsEnvironment() *plugin.Environment
	// GetProductNotices is called from the frontend to fetch the product notices that are relevant to the caller
	GetProductNotices(userId, teamId string, client model.NoticeClientType, clientVersion string, locale string) (model.NoticeMessages, *model.AppError)
	// GetPublicKey will return the actual public key saved in the `name` file.
	GetPublicKey(name string) ([]byte, *model.AppError)
	// GetSanitizedConfig gets the configuration for a system admin without any secrets.
	GetSanitizedConfig() *model.Config
	// GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles.
	GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
	// GetSessionLengthInMillis returns the session length, in milliseconds,
	// based on the type of session (Mobile, SSO, Web/LDAP).
	GetSessionLengthInMillis(session *model.Session) int64
	// GetSuggestions returns suggestions for user input.
	GetSuggestions(commandArgs *model.CommandArgs, commands []*model.Command, roleID string) []model.AutocompleteSuggestion
	// GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.
	GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)
	// GetTeamSchemeChannelRoles Checks if a team has an override scheme and returns the scheme channel role names or default channel role names.
	GetTeamSchemeChannelRoles(teamId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
	// GetTotalUsersStats is used for the DM list total
	GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)
	// HubRegister registers a connection to a hub.
	HubRegister(webConn *WebConn)
	// HubStart starts all the hubs.
	HubStart()
	// HubUnregister unregisters a connection from a hub.
	HubUnregister(webConn *WebConn)
	// InstallMarketplacePlugin installs a plugin listed in the marketplace server. It will get the plugin bundle
	// from the prepackaged folder, if available, or remotely if EnableRemoteMarketplace is true.
	InstallMarketplacePlugin(request *model.InstallMarketplacePluginRequest) (*model.Manifest, *model.AppError)
	// InstallPlugin unpacks and installs a plugin but does not enable or activate it.
	InstallPlugin(pluginFile io.ReadSeeker, replace bool) (*model.Manifest, *model.AppError)
	// InstallPluginWithSignature verifies and installs plugin.
	InstallPluginWithSignature(pluginFile, signature io.ReadSeeker) (*model.Manifest, *model.AppError)
	// IsUsernameTaken checks if the username is already used by another user. Return false if the username is invalid.
	IsUsernameTaken(name string) bool
	// LimitedClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
	LimitedClientConfigWithComputed() map[string]string
	// LogAuditRec logs an audit record using default LvlAuditCLI.
	LogAuditRec(rec *audit.Record, err error)
	// LogAuditRecWithLevel logs an audit record using specified Level.
	LogAuditRecWithLevel(rec *audit.Record, level mlog.LogLevel, err error)
	// MakeAuditRecord creates a audit record pre-populated with defaults.
	MakeAuditRecord(event string, initialStatus string) *audit.Record
	// MarkChanelAsUnreadFromPost will take a post and set the channel as unread from that one.
	MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)
	// MentionsToPublicChannels returns all the mentions to public channels,
	// linking them to their channels
	MentionsToPublicChannels(message, teamId string) model.ChannelMentionMap
	// MentionsToTeamMembers returns all the @ mentions found in message that
	// belong to users in the specified team, linking them to their users
	MentionsToTeamMembers(message, teamId string) model.UserMentionMap
	// MoveChannel method is prone to data races if someone joins to channel during the move process. However this
	// function is only exposed to sysadmins and the possibility of this edge case is realtively small.
	MoveChannel(team *model.Team, channel *model.Channel, user *model.User) *model.AppError
	// NewWebConn returns a new WebConn instance.
	NewWebConn(ws *websocket.Conn, session model.Session, t goi18n.TranslateFunc, locale string) *WebConn
	// NewWebHub creates a new Hub.
	NewWebHub() *Hub
	// NotifySessionsExpired is called periodically from the job server to notify any mobile sessions that have expired.
	NotifySessionsExpired() *model.AppError
	// OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon,
	// so that it points to the URL (relative) of the emoji - static if emoji is default, /api if custom.
	OverrideIconURLIfEmoji(post *model.Post)
	// PatchBot applies the given patch to the bot and corresponding user.
	PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
	// PatchChannelModerationsForChannel Updates a channels scheme roles based on a given ChannelModerationPatch, if the permissions match the higher scoped role the scheme is deleted.
	PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
	// Perform an HTTP POST request to an integration's action endpoint.
	// Caller must consume and close returned http.Response as necessary.
	// For internal requests, requests are routed directly to a plugin ServerHTTP hook
	DoActionRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
	// PermanentDeleteBot permanently deletes a bot and its corresponding user.
	PermanentDeleteBot(botUserId string) *model.AppError
	// PromoteGuestToUser Convert user's roles and all his mermbership's roles from
	// guest roles to regular user roles.
	PromoteGuestToUser(user *model.User, requestorId string) *model.AppError
	// RenameChannel is used to rename the channel Name and the DisplayName fields
	RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError)
	// RenameTeam is used to rename the team Name and the DisplayName fields
	RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError)
	// RevokeSessionsFromAllUsers will go through all the sessions active
	// in the server and revoke them
	RevokeSessionsFromAllUsers() *model.AppError
	// SaveConfig replaces the active configuration, optionally notifying cluster peers.
	SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError
	// SearchAllChannels returns a list of channels, the total count of the results of the search (if the paginate search option is true), and an error.
	SearchAllChannels(term string, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, *model.AppError)
	// SearchAllTeams returns a team list and the total count of the results
	SearchAllTeams(searchOpts *model.TeamSearch) ([]*model.Team, int64, *model.AppError)
	// ServePluginPublicRequest serves public plugin files
	// at the URL http(s)://$SITE_URL/plugins/$PLUGIN_ID/public/{anything}
	ServePluginPublicRequest(w http.ResponseWriter, r *http.Request)
	// ServerBusyStateChanged is called when a CLUSTER_EVENT_BUSY_STATE_CHANGED is received.
	ServerBusyStateChanged(sbs *model.ServerBusyState)
	// SessionHasPermissionToManageBot returns nil if the session has access to manage the given bot.
	// This function deviates from other authorization checks in returning an error instead of just
	// a boolean, allowing the permission failure to be exposed with more granularity.
	SessionHasPermissionToManageBot(session model.Session, botUserId string) *model.AppError
	// SessionIsRegistered determines if a specific session has been registered
	SessionIsRegistered(session model.Session) bool
	// SetBotIconImage sets LHS icon for a bot.
	SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError
	// SetBotIconImageFromMultiPartFile sets LHS icon for a bot.
	SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError
	// SetSessionExpireInDays sets the session's expiry the specified number of days
	// relative to either the session creation date or the current time, depending
	// on the `ExtendSessionOnActivity` config setting.
	SetSessionExpireInDays(session *model.Session, days int)
	// SetStatusLastActivityAt sets the last activity at for a user on the local app server and updates
	// status to away if needed. Used by the WS to set status to away if an 'online' device disconnects
	// while an 'away' device is still connected
	SetStatusLastActivityAt(userId string, activityAt int64)
	// SyncPlugins synchronizes the plugins installed locally
	// with the plugin bundles available in the file store.
	SyncPlugins() *model.AppError
	// SyncRolesAndMembership updates the SchemeAdmin status and membership of all of the members of the given
	// syncable.
	SyncRolesAndMembership(syncableID string, syncableType model.GroupSyncableType)
	// SyncSyncableRoles updates the SchemeAdmin field value of the given syncable's members based on the configuration of
	// the member's group memberships and the configuration of those groups to the syncable. This method should only
	// be invoked on group-synced (aka group-constrained) syncables.
	SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError
	// TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given
	// groups.
	//
	// The result can be used, for example, to determine the set of users who would be removed from a team if the team
	// were group-constrained with the given groups.
	TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
	// This function migrates the default built in roles from code/config to the database.
	DoAdvancedPermissionsMigration()
	// This to be used for places we check the users password when they are already logged in
	DoubleCheckPassword(user *model.User, password string) *model.AppError
	// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
	UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
	// UpdateBotOwner changes a bot's owner to the given value.
	UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)
	// UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.
	UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
	// UpdateChannelScheme saves the new SchemeId of the channel passed.
	UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
	// UpdateProductNotices is called periodically from a scheduled worker to fetch new notices and update the cache
	UpdateProductNotices() *model.AppError
	// UpdateViewedProductNotices is called from the frontend to mark a set of notices as 'viewed' by user
	UpdateViewedProductNotices(userId string, noticeIds []string) *model.AppError
	// UpdateViewedProductNoticesForNewUser is called when new user is created to mark all current notices for this
	// user as viewed in order to avoid showing them imminently on first login
	UpdateViewedProductNoticesForNewUser(userId string)
	// UpdateWebConnUserActivity sets the LastUserActivityAt of the hub for the given session.
	UpdateWebConnUserActivity(session model.Session, activityAt int64)
	// UploadFile uploads a single file in form of a completely constructed byte array for a channel.
	UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
	// UploadFileX uploads a single file as specified in t. It applies the upload
	// constraints, executes plugins and image processing logic as needed. It
	// returns a filled-out FileInfo and an optional error. A plugin may reject the
	// upload, returning a rejection error. In this case FileInfo would have
	// contained the last "good" FileInfo before the execution of that plugin.
	UploadFileX(channelId, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError)
	// Uploads some files to the given team and channel as the given user. files and filenames should have
	// the same length. clientIds should either not be provided or have the same length as files and filenames.
	// The provided files should be closed by the caller so that they are not leaked.
	UploadFiles(teamId string, channelId string, userId string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
	// UserIsInAdminRoleGroup returns true at least one of the user's groups are configured to set the members as
	// admins in the given syncable.
	UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError)
	// VerifyPlugin checks that the given signature corresponds to the given plugin and matches a trusted certificate.
	VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError
	//GetUserStatusesByIds used by apiV4
	GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)
	AcceptLanguage() string
	AccountMigration() einterfaces.AccountMigrationInterface
	ActivateMfa(userId, token string) *model.AppError
	AddChannelMember(userId string, channel *model.Channel, userRequestorId string, postRootId string) (*model.ChannelMember, *model.AppError)
	AddConfigListener(listener func(*model.Config, *model.Config)) string
	AddDirectChannels(teamId string, user *model.User) *model.AppError
	AddLdapPrivateCertificate(fileData *multipart.FileHeader) *model.AppError
	AddLdapPublicCertificate(fileData *multipart.FileHeader) *model.AppError
	AddSamlIdpCertificate(fileData *multipart.FileHeader) *model.AppError
	AddSamlPrivateCertificate(fileData *multipart.FileHeader) *model.AppError
	AddSamlPublicCertificate(fileData *multipart.FileHeader) *model.AppError
	AddSessionToCache(session *model.Session)
	AddStatusCache(status *model.Status)
	AddStatusCacheSkipClusterSend(status *model.Status)
	AddTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
	AddTeamMemberByInviteId(inviteId, userId string) (*model.TeamMember, *model.AppError)
	AddTeamMemberByToken(userId, tokenId string) (*model.TeamMember, *model.AppError)
	AddTeamMembers(teamId string, userIds []string, userRequestorId string, graceful bool) ([]*model.TeamMemberWithError, *model.AppError)
	AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelMember, *model.AppError)
	AddUserToTeam(teamId string, userId string, userRequestorId string) (*model.Team, *model.AppError)
	AddUserToTeamByInviteId(inviteId string, userId string) (*model.Team, *model.AppError)
	AddUserToTeamByTeamId(teamId string, user *model.User) *model.AppError
	AddUserToTeamByToken(userId string, tokenId string) (*model.Team, *model.AppError)
	AdjustImage(file io.Reader) (*bytes.Buffer, *model.AppError)
	AllowOAuthAppAccessToUser(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)
	AppendFile(fr io.Reader, path string) (int64, *model.AppError)
	AsymmetricSigningKey() *ecdsa.PrivateKey
	AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError
	AttachSessionCookies(w http.ResponseWriter, r *http.Request)
	AuthenticateUserForLogin(id, loginId, password, mfaToken, cwsToken string, ldapOnly bool) (user *model.User, err *model.AppError)
	AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (io.ReadCloser, string, map[string]string, *model.AppError)
	AutocompleteChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
	AutocompleteChannelsForSearch(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)
	AutocompleteUsersInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError)
	AutocompleteUsersInTeam(teamId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInTeam, *model.AppError)
	BroadcastStatus(status *model.Status)
	BuildPostReactions(postId string) (*[]ReactionImportData, *model.AppError)
	BuildPushNotificationMessage(contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string, explicitMention bool, channelWideMention bool, replyToThreadType string) (*model.PushNotification, *model.AppError)
	BuildSamlMetadataObject(idpMetadata []byte) (*model.SamlMetadataResponse, *model.AppError)
	BulkExport(writer io.Writer, file string, pathToEmojiDir string, dirNameToExportEmoji string) *model.AppError
	BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model.AppError, int)
	CancelJob(jobId string) *model.AppError
	ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError)
	ChannelMembersToRemove(teamID *string) ([]*model.ChannelMember, *model.AppError)
	CheckForClientSideCert(r *http.Request) (string, string, string)
	CheckPasswordAndAllCriteria(user *model.User, password string, mfaToken string) *model.AppError
	CheckRolesExist(roleNames []string) *model.AppError
	CheckUserAllAuthenticationCriteria(user *model.User, mfaToken string) *model.AppError
	CheckUserMfa(user *model.User, token string) *model.AppError
	CheckUserPostflightAuthenticationCriteria(user *model.User) *model.AppError
	CheckUserPreflightAuthenticationCriteria(user *model.User, mfaToken string) *model.AppError
	CheckValidDomains(team *model.Team) *model.AppError
	ClearChannelMembersCache(channelID string)
	ClearSessionCacheForAllUsers()
	ClearSessionCacheForAllUsersSkipClusterSend()
	ClearSessionCacheForUser(userId string)
	ClearSessionCacheForUserSkipClusterSend(userId string)
	ClearTeamMembersCache(teamID string)
	ClientConfig() map[string]string
	ClientConfigHash() string
	Cloud() einterfaces.CloudInterface
	Cluster() einterfaces.ClusterInterface
	CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError)
	CompareAndSetPluginKey(pluginId string, key string, oldValue, newValue []byte) (bool, *model.AppError)
	CompleteOAuth(service string, body io.ReadCloser, teamId string, props map[string]string) (*model.User, *model.AppError)
	CompleteSwitchWithOAuth(service string, userData io.Reader, email string) (*model.User, *model.AppError)
	Compliance() einterfaces.ComplianceInterface
	Config() *model.Config
	Context() context.Context
	CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)
	CreateChannel(channel *model.Channel, addMember bool) (*model.Channel, *model.AppError)
	CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channel, *model.AppError)
	CreateCommand(cmd *model.Command) (*model.Command, *model.AppError)
	CreateCommandWebhook(commandId string, args *model.CommandArgs) (*model.CommandWebhook, *model.AppError)
	CreateEmoji(sessionUserId string, emoji *model.Emoji, multiPartImageData *multipart.Form) (*model.Emoji, *model.AppError)
	CreateGroup(group *model.Group) (*model.Group, *model.AppError)
	CreateGroupChannel(userIds []string, creatorId string) (*model.Channel, *model.AppError)
	CreateIncomingWebhookForChannel(creatorId string, channel *model.Channel, hook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)
	CreateJob(job *model.Job) (*model.Job, *model.AppError)
	CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
	CreateOAuthStateToken(extra string) (*model.Token, *model.AppError)
	CreateOAuthUser(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)
	CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
	CreatePasswordRecoveryToken(userId, email string) (*model.Token, *model.AppError)
	CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks, setOnline bool) (savedPost *model.Post, err *model.AppError)
	CreatePostAsUser(post *model.Post, currentSessionId string, setOnline bool) (*model.Post, *model.AppError)
	CreatePostMissingChannel(post *model.Post, triggerWebhooks bool) (*model.Post, *model.AppError)
	CreateRole(role *model.Role) (*model.Role, *model.AppError)
	CreateScheme(scheme *model.Scheme) (*model.Scheme, *model.AppError)
	CreateSession(session *model.Session) (*model.Session, *model.AppError)
	CreateSidebarCategory(userId, teamId string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)
	CreateTeam(team *model.Team) (*model.Team, *model.AppError)
	CreateTeamWithUser(team *model.Team, userId string) (*model.Team, *model.AppError)
	CreateTermsOfService(text, userId string) (*model.TermsOfService, *model.AppError)
	CreateUploadSession(us *model.UploadSession) (*model.UploadSession, *model.AppError)
	CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError)
	CreateUserAsAdmin(user *model.User, redirect string) (*model.User, *model.AppError)
	CreateUserFromSignup(user *model.User, redirect string) (*model.User, *model.AppError)
	CreateUserWithInviteId(user *model.User, inviteId, redirect string) (*model.User, *model.AppError)
	CreateUserWithToken(user *model.User, token *model.Token) (*model.User, *model.AppError)
	CreateWebhookPost(userId string, channel *model.Channel, text, overrideUsername, overrideIconUrl, overrideIconEmoji string, props model.StringInterface, postType string, postRootId string) (*model.Post, *model.AppError)
	DBHealthCheckDelete() error
	DBHealthCheckWrite() error
	DataRetention() einterfaces.DataRetentionInterface
	DeactivateGuests() *model.AppError
	DeactivateMfa(userId string) *model.AppError
	DeauthorizeOAuthAppForUser(userId, appId string) *model.AppError
	DeleteAllExpiredPluginKeys() *model.AppError
	DeleteAllKeysForPlugin(pluginId string) *model.AppError
	DeleteBrandImage() *model.AppError
	DeleteChannel(channel *model.Channel, userId string) *model.AppError
	DeleteCommand(commandId string) *model.AppError
	DeleteEmoji(emoji *model.Emoji) *model.AppError
	DeleteEphemeralPost(userId, postId string)
	DeleteFlaggedPosts(postId string)
	DeleteGroup(groupID string) (*model.Group, *model.AppError)
	DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
	DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
	DeleteIncomingWebhook(hookId string) *model.AppError
	DeleteOAuthApp(appId string) *model.AppError
	DeleteOutgoingWebhook(hookId string) *model.AppError
	DeletePluginKey(pluginId string, key string) *model.AppError
	DeletePost(postId, deleteByID string) (*model.Post, *model.AppError)
	DeletePostFiles(post *model.Post)
	DeletePreferences(userId string, preferences model.Preferences) *model.AppError
	DeleteReactionForPost(reaction *model.Reaction) *model.AppError
	DeleteScheme(schemeId string) (*model.Scheme, *model.AppError)
	DeleteSidebarCategory(userId, teamId, categoryId string) *model.AppError
	DeleteToken(token *model.Token) *model.AppError
	DisableAutoResponder(userId string, asAdmin bool) *model.AppError
	DisableUserAccessToken(token *model.UserAccessToken) *model.AppError
	DoAppMigrations()
	DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command, *model.CommandResponse, *model.AppError)
	DoEmojisPermissionsMigration()
	DoGuestRolesCreationMigration()
	DoLocalRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
	DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string, isMobile, isOAuthUser, isSaml bool) *model.AppError
	DoPostAction(postId, actionId, userId, selectedOption string) (string, *model.AppError)
	DoPostActionWithCookie(postId, actionId, userId, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)
	DoSystemConsoleRolesCreationMigration()
	DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, *model.AppError)
	DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)
	DownloadFromURL(downloadURL string) ([]byte, error)
	EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
	EnvironmentConfig() map[string]interface{}
	ExportPermissions(w io.Writer) error
	FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
	FileBackend() (filesstore.FileBackend, *model.AppError)
	FileExists(path string) (bool, *model.AppError)
	FillInChannelProps(channel *model.Channel) *model.AppError
	FillInChannelsProps(channelList *model.ChannelList) *model.AppError
	FilterUsersByVisible(viewer *model.User, otherUsers []*model.User) ([]*model.User, *model.AppError)
	FindTeamByName(name string) bool
	GenerateMfaSecret(userId string) (*model.MfaSecret, *model.AppError)
	GeneratePublicLink(siteURL string, info *model.FileInfo) string
	GetActivePluginManifests() ([]*model.Manifest, *model.AppError)
	GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, *model.AppError)
	GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.AppError)
	GetAllPrivateTeams() ([]*model.Team, *model.AppError)
	GetAllPrivateTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
	GetAllPrivateTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
	GetAllPublicTeams() ([]*model.Team, *model.AppError)
	GetAllPublicTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
	GetAllPublicTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
	GetAllRoles() ([]*model.Role, *model.AppError)
	GetAllStatuses() map[string]*model.Status
	GetAllTeams() ([]*model.Team, *model.AppError)
	GetAllTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
	GetAllTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
	GetAnalytics(name string, teamId string) (model.AnalyticsRows, *model.AppError)
	GetAudits(userId string, limit int) (model.Audits, *model.AppError)
	GetAuditsPage(userId string, page int, perPage int) (model.Audits, *model.AppError)
	GetAuthorizationCode(w http.ResponseWriter, r *http.Request, service string, props map[string]string, loginHint string) (string, *model.AppError)
	GetAuthorizedAppsForUser(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)
	GetBrandImage() ([]byte, *model.AppError)
	GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError)
	GetChannel(channelId string) (*model.Channel, *model.AppError)
	GetChannelByName(channelName, teamId string, includeDeleted bool) (*model.Channel, *model.AppError)
	GetChannelByNameForTeamName(channelName, teamName string, includeDeleted bool) (*model.Channel, *model.AppError)
	GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, *model.AppError)
	GetChannelGuestCount(channelId string) (int64, *model.AppError)
	GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError)
	GetChannelMemberCount(channelId string) (int64, *model.AppError)
	GetChannelMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, *model.AppError)
	GetChannelMembersForUser(teamId string, userId string) (*model.ChannelMembers, *model.AppError)
	GetChannelMembersForUserWithPagination(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)
	GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)
	GetChannelMembersTimezones(channelId string) ([]string, *model.AppError)
	GetChannelPinnedPostCount(channelId string) (int64, *model.AppError)
	GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError)
	GetChannelsByNames(channelNames []string, teamId string) ([]*model.Channel, *model.AppError)
	GetChannelsForScheme(scheme *model.Scheme, offset int, limit int) (model.ChannelList, *model.AppError)
	GetChannelsForSchemePage(scheme *model.Scheme, page int, perPage int) (model.ChannelList, *model.AppError)
	GetChannelsForUser(teamId string, userId string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, *model.AppError)
	GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (*model.ChannelList, *model.AppError)
	GetClusterId() string
	GetClusterStatus() []*model.ClusterInfo
	GetCommand(commandId string) (*model.Command, *model.AppError)
	GetComplianceFile(job *model.Compliance) ([]byte, *model.AppError)
	GetComplianceReport(reportId string) (*model.Compliance, *model.AppError)
	GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError)
	GetCookieDomain() string
	GetDataRetentionPolicy() (*model.DataRetentionPolicy, *model.AppError)
	GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError)
	GetDeletedChannels(teamId string, offset int, limit int, userId string) (*model.ChannelList, *model.AppError)
	GetEmoji(emojiId string) (*model.Emoji, *model.AppError)
	GetEmojiByName(emojiName string) (*model.Emoji, *model.AppError)
	GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)
	GetEmojiList(page, perPage int, sort string) ([]*model.Emoji, *model.AppError)
	GetErrorListForEmailsOverLimit(emailList []string, cloudUserLimit int64) ([]string, []*model.EmailInviteWithError, *model.AppError)
	GetFile(fileId string) ([]byte, *model.AppError)
	GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)
	GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)
	GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError)
	GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo, *model.AppError)
	GetFlaggedPosts(userId string, offset int, limit int) (*model.PostList, *model.AppError)
	GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) (*model.PostList, *model.AppError)
	GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) (*model.PostList, *model.AppError)
	GetGroup(id string) (*model.Group, *model.AppError)
	GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError)
	GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError)
	GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)
	GetGroupMemberCount(groupID string) (int64, *model.AppError)
	GetGroupMemberUsers(groupID string) ([]*model.User, *model.AppError)
	GetGroupMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, int, *model.AppError)
	GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
	GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)
	GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError)
	GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError)
	GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)
	GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError)
	GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError)
	GetGroupsByUserId(userId string) ([]*model.Group, *model.AppError)
	GetHubForUserId(userId string) *Hub
	GetIncomingWebhook(hookId string) (*model.IncomingWebhook, *model.AppError)
	GetIncomingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
	GetIncomingWebhooksForTeamPageByUser(teamId string, userId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
	GetIncomingWebhooksPage(page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
	GetIncomingWebhooksPageByUser(userId string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)
	GetJob(id string) (*model.Job, *model.AppError)
	GetJobs(offset int, limit int) ([]*model.Job, *model.AppError)
	GetJobsByType(jobType string, offset int, limit int) ([]*model.Job, *model.AppError)
	GetJobsByTypePage(jobType string, page int, perPage int) ([]*model.Job, *model.AppError)
	GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError)
	GetLatestTermsOfService() (*model.TermsOfService, *model.AppError)
	GetLogs(page, perPage int) ([]string, *model.AppError)
	GetLogsSkipSend(page, perPage int) ([]string, *model.AppError)
	GetMemberCountsByGroup(channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, *model.AppError)
	GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string
	GetMultipleEmojiByName(names []string) ([]*model.Emoji, *model.AppError)
	GetNewUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetNextPostIdFromPostList(postList *model.PostList) string
	GetNotificationNameFormat(user *model.User) string
	GetNumberOfChannelsOnTeam(teamId string) (int, *model.AppError)
	GetOAuthAccessTokenForCodeFlow(clientId, grantType, redirectUri, code, secret, refreshToken string) (*model.AccessResponse, *model.AppError)
	GetOAuthAccessTokenForImplicitFlow(userId string, authRequest *model.AuthorizeRequest) (*model.Session, *model.AppError)
	GetOAuthApp(appId string) (*model.OAuthApp, *model.AppError)
	GetOAuthApps(page, perPage int) ([]*model.OAuthApp, *model.AppError)
	GetOAuthAppsByCreator(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)
	GetOAuthCodeRedirect(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)
	GetOAuthImplicitRedirect(userId string, authRequest *model.AuthorizeRequest) (string, *model.AppError)
	GetOAuthLoginEndpoint(w http.ResponseWriter, r *http.Request, service, teamId, action, redirectTo, loginHint string, isMobile bool) (string, *model.AppError)
	GetOAuthSignupEndpoint(w http.ResponseWriter, r *http.Request, service, teamId string) (string, *model.AppError)
	GetOAuthStateToken(token string) (*model.Token, *model.AppError)
	GetOpenGraphMetadata(requestURL string) *opengraph.OpenGraph
	GetOrCreateDirectChannel(userId, otherUserId string) (*model.Channel, *model.AppError)
	GetOutgoingWebhook(hookId string) (*model.OutgoingWebhook, *model.AppError)
	GetOutgoingWebhooksForChannelPageByUser(channelId string, userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
	GetOutgoingWebhooksForTeamPage(teamId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
	GetOutgoingWebhooksForTeamPageByUser(teamId string, userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
	GetOutgoingWebhooksPage(page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
	GetOutgoingWebhooksPageByUser(userId string, page, perPage int) ([]*model.OutgoingWebhook, *model.AppError)
	GetPasswordRecoveryToken(token string) (*model.Token, *model.AppError)
	GetPermalinkPost(postId string, userId string) (*model.PostList, *model.AppError)
	GetPinnedPosts(channelId string) (*model.PostList, *model.AppError)
	GetPluginKey(pluginId string, key string) ([]byte, *model.AppError)
	GetPlugins() (*model.PluginsResponse, *model.AppError)
	GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError)
	GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError)
	GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError)
	GetPostThread(postId string, skipFetchThreads bool) (*model.PostList, *model.AppError)
	GetPosts(channelId string, offset int, limit int) (*model.PostList, *model.AppError)
	GetPostsAfterPost(options model.GetPostsOptions) (*model.PostList, *model.AppError)
	GetPostsAroundPost(before bool, options model.GetPostsOptions) (*model.PostList, *model.AppError)
	GetPostsBeforePost(options model.GetPostsOptions) (*model.PostList, *model.AppError)
	GetPostsEtag(channelId string) string
	GetPostsForChannelAroundLastUnread(channelId, userId string, limitBefore, limitAfter int, skipFetchThreads bool) (*model.PostList, *model.AppError)
	GetPostsPage(options model.GetPostsOptions) (*model.PostList, *model.AppError)
	GetPostsSince(options model.GetPostsSinceOptions) (*model.PostList, *model.AppError)
	GetPreferenceByCategoryAndNameForUser(userId string, category string, preferenceName string) (*model.Preference, *model.AppError)
	GetPreferenceByCategoryForUser(userId string, category string) (model.Preferences, *model.AppError)
	GetPreferencesForUser(userId string) (model.Preferences, *model.AppError)
	GetPrevPostIdFromPostList(postList *model.PostList) string
	GetPrivateChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)
	GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
	GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*model.ChannelList, *model.AppError)
	GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)
	GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError)
	GetRecentlyActiveUsersForTeam(teamId string) (map[string]*model.User, *model.AppError)
	GetRecentlyActiveUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetRole(id string) (*model.Role, *model.AppError)
	GetRoleByName(name string) (*model.Role, *model.AppError)
	GetRolesByNames(names []string) ([]*model.Role, *model.AppError)
	GetSamlCertificateStatus() *model.SamlCertificateStatus
	GetSamlMetadata() (string, *model.AppError)
	GetSamlMetadataFromIdp(idpMetadataUrl string) (*model.SamlMetadataResponse, *model.AppError)
	GetSanitizeOptions(asAdmin bool) map[string]bool
	GetScheme(id string) (*model.Scheme, *model.AppError)
	GetSchemeByName(name string) (*model.Scheme, *model.AppError)
	GetSchemeRolesForTeam(teamId string) (string, string, string, *model.AppError)
	GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError)
	GetSchemesPage(scope string, page int, perPage int) ([]*model.Scheme, *model.AppError)
	GetSession(token string) (*model.Session, *model.AppError)
	GetSessionById(sessionId string) (*model.Session, *model.AppError)
	GetSessions(userId string) ([]*model.Session, *model.AppError)
	GetSidebarCategories(userId, teamId string) (*model.OrderedSidebarCategories, *model.AppError)
	GetSidebarCategory(categoryId string) (*model.SidebarCategoryWithChannels, *model.AppError)
	GetSidebarCategoryOrder(userId, teamId string) ([]string, *model.AppError)
	GetSinglePost(postId string) (*model.Post, *model.AppError)
	GetSiteURL() string
	GetStatus(userId string) (*model.Status, *model.AppError)
	GetStatusFromCache(userId string) *model.Status
	GetStatusesByIds(userIds []string) (map[string]interface{}, *model.AppError)
	GetT() goi18n.TranslateFunc
	GetTeam(teamId string) (*model.Team, *model.AppError)
	GetTeamByInviteId(inviteId string) (*model.Team, *model.AppError)
	GetTeamByName(name string) (*model.Team, *model.AppError)
	GetTeamIcon(team *model.Team) ([]byte, *model.AppError)
	GetTeamIdFromQuery(query url.Values) (string, *model.AppError)
	GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
	GetTeamMembers(teamId string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, *model.AppError)
	GetTeamMembersByIds(teamId string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, *model.AppError)
	GetTeamMembersForUser(userId string) ([]*model.TeamMember, *model.AppError)
	GetTeamMembersForUserWithPagination(userId string, page, perPage int) ([]*model.TeamMember, *model.AppError)
	GetTeamStats(teamId string, restrictions *model.ViewUsersRestrictions) (*model.TeamStats, *model.AppError)
	GetTeamUnread(teamId, userId string) (*model.TeamUnread, *model.AppError)
	GetTeamsForScheme(scheme *model.Scheme, offset int, limit int) ([]*model.Team, *model.AppError)
	GetTeamsForSchemePage(scheme *model.Scheme, page int, perPage int) ([]*model.Team, *model.AppError)
	GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)
	GetTeamsUnreadForUser(excludeTeamId string, userId string) ([]*model.TeamUnread, *model.AppError)
	GetTermsOfService(id string) (*model.TermsOfService, *model.AppError)
	GetUploadSession(uploadId string) (*model.UploadSession, *model.AppError)
	GetUploadSessionsForUser(userId string) ([]*model.UploadSession, *model.AppError)
	GetUser(userId string) (*model.User, *model.AppError)
	GetUserAccessToken(tokenId string, sanitize bool) (*model.UserAccessToken, *model.AppError)
	GetUserAccessTokens(page, perPage int) ([]*model.UserAccessToken, *model.AppError)
	GetUserAccessTokensForUser(userId string, page, perPage int) ([]*model.UserAccessToken, *model.AppError)
	GetUserByAuth(authData *string, authService string) (*model.User, *model.AppError)
	GetUserByEmail(email string) (*model.User, *model.AppError)
	GetUserByUsername(username string) (*model.User, *model.AppError)
	GetUserForLogin(id, loginId string) (*model.User, *model.AppError)
	GetUserTermsOfService(userId string) (*model.UserTermsOfService, *model.AppError)
	GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)
	GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError)
	GetUsersByIds(userIds []string, options *store.UserGetByIdsOpts) ([]*model.User, *model.AppError)
	GetUsersByUsernames(usernames []string, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetUsersEtag(restrictionsHash string) string
	GetUsersInChannel(options *model.UserGetOptions) ([]*model.User, *model.AppError)
	GetUsersInChannelByStatus(options *model.UserGetOptions) ([]*model.User, *model.AppError)
	GetUsersInChannelMap(options *model.UserGetOptions, asAdmin bool) (map[string]*model.User, *model.AppError)
	GetUsersInChannelPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
	GetUsersInChannelPageByStatus(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
	GetUsersInTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError)
	GetUsersInTeamEtag(teamId string, restrictionsHash string) string
	GetUsersInTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
	GetUsersNotInChannel(teamId string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetUsersNotInChannelMap(teamId string, channelId string, groupConstrained bool, offset int, limit int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) (map[string]*model.User, *model.AppError)
	GetUsersNotInChannelPage(teamId string, channelId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetUsersNotInTeam(teamId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetUsersNotInTeamEtag(teamId string, restrictionsHash string) string
	GetUsersNotInTeamPage(teamId string, groupConstrained bool, page int, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
	GetUsersPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
	GetUsersWithoutTeam(options *model.UserGetOptions) ([]*model.User, *model.AppError)
	GetUsersWithoutTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
	GetVerifyEmailToken(token string) (*model.Token, *model.AppError)
	GetViewUsersRestrictions(userId string) (*model.ViewUsersRestrictions, *model.AppError)
	GetWarnMetricsStatus() (map[string]*model.WarnMetricStatus, *model.AppError)
	HTTPService() httpservice.HTTPService
	Handle404(w http.ResponseWriter, r *http.Request)
	HandleCommandResponse(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError)
	HandleCommandResponsePost(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.Post, *model.AppError)
	HandleCommandWebhook(hookId string, response *model.CommandResponse) *model.AppError
	HandleImages(previewPathList []string, thumbnailPathList []string, fileData [][]byte)
	HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest) *model.AppError
	HandleMessageExportConfig(cfg *model.Config, appCfg *model.Config)
	HasPermissionTo(askingUserId string, permission *model.Permission) bool
	HasPermissionToChannel(askingUserId string, channelId string, permission *model.Permission) bool
	HasPermissionToChannelByPost(askingUserId string, postId string, permission *model.Permission) bool
	HasPermissionToTeam(askingUserId string, teamId string, permission *model.Permission) bool
	HasPermissionToUser(askingUserId string, userId string) bool
	HubStop()
	ImageProxy() *imageproxy.ImageProxy
	ImageProxyAdder() func(string) string
	ImageProxyRemover() (f func(string) string)
	ImportPermissions(jsonl io.Reader) error
	InitPlugins(pluginDir, webappPluginDir string)
	InitPostMetadata()
	InitServer()
	InstallPluginFromData(data model.PluginEventData)
	InvalidateAllEmailInvites() *model.AppError
	InvalidateCacheForUser(userId string)
	InvalidateWebConnSessionCacheForUser(userId string)
	InviteGuestsToChannels(teamId string, guestsInvite *model.GuestsInvite, senderId string) *model.AppError
	InviteGuestsToChannelsGracefully(teamId string, guestsInvite *model.GuestsInvite, senderId string) ([]*model.EmailInviteWithError, *model.AppError)
	InviteNewUsersToTeam(emailList []string, teamId, senderId string) *model.AppError
	InviteNewUsersToTeamGracefully(emailList []string, teamId, senderId string) ([]*model.EmailInviteWithError, *model.AppError)
	IpAddress() string
	IsFirstUserAccount() bool
	IsLeader() bool
	IsPasswordValid(password string) *model.AppError
	IsPhase2MigrationCompleted() *model.AppError
	IsUserAway(lastActivityAt int64) bool
	IsUserSignUpAllowed() *model.AppError
	JoinChannel(channel *model.Channel, userId string) *model.AppError
	JoinDefaultChannels(teamId string, user *model.User, shouldBeAdmin bool, userRequestorId string) *model.AppError
	JoinUserToTeam(team *model.Team, user *model.User, userRequestorId string) *model.AppError
	Ldap() einterfaces.LdapInterface
	LeaveChannel(channelId string, userId string) *model.AppError
	LeaveTeam(team *model.Team, user *model.User, requestorId string) *model.AppError
	LimitedClientConfig() map[string]string
	ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
	ListDirectory(path string) ([]string, *model.AppError)
	ListPluginKeys(pluginId string, page, perPage int) ([]string, *model.AppError)
	ListTeamCommands(teamId string) ([]*model.Command, *model.AppError)
	Log() *mlog.Logger
	LoginByOAuth(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)
	MakePermissionError(permissions []*model.Permission) *model.AppError
	MarkChannelsAsViewed(channelIds []string, userId string, currentSessionId string) (map[string]int64, *model.AppError)
	MaxPostSize() int
	MessageExport() einterfaces.MessageExportInterface
	Metrics() einterfaces.MetricsInterface
	MigrateIdLDAP(toAttribute string) *model.AppError
	MoveCommand(team *model.Team, command *model.Command) *model.AppError
	MoveFile(oldPath, newPath string) *model.AppError
	NewClusterDiscoveryService() *ClusterDiscoveryService
	NewPluginAPI(manifest *model.Manifest) plugin.API
	Notification() einterfaces.NotificationInterface
	NotificationsLog() *mlog.Logger
	NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User, forceAck bool, isBot bool) *model.AppError
	OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError
	OriginChecker() func(*http.Request) bool
	PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userId string) (*model.Channel, *model.AppError)
	PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError)
	PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError)
	PatchScheme(scheme *model.Scheme, patch *model.SchemePatch) (*model.Scheme, *model.AppError)
	PatchTeam(teamId string, patch *model.TeamPatch) (*model.Team, *model.AppError)
	PatchUser(userId string, patch *model.UserPatch, asAdmin bool) (*model.User, *model.AppError)
	Path() string
	PermanentDeleteAllUsers() *model.AppError
	PermanentDeleteChannel(channel *model.Channel) *model.AppError
	PermanentDeleteTeam(team *model.Team) *model.AppError
	PermanentDeleteTeamId(teamId string) *model.AppError
	PermanentDeleteUser(user *model.User) *model.AppError
	PluginCommandsForTeam(teamId string) []*model.Command
	PluginContext() *plugin.Context
	PostActionCookieSecret() []byte
	PostAddToChannelMessage(user *model.User, addedUser *model.User, channel *model.Channel, postRootId string) *model.AppError
	PostPatchWithProxyRemovedFromImageURLs(patch *model.PostPatch) *model.PostPatch
	PostUpdateChannelDisplayNameMessage(userId string, channel *model.Channel, oldChannelDisplayName, newChannelDisplayName string) *model.AppError
	PostUpdateChannelHeaderMessage(userId string, channel *model.Channel, oldChannelHeader, newChannelHeader string) *model.AppError
	PostUpdateChannelPurposeMessage(userId string, channel *model.Channel, oldChannelPurpose string, newChannelPurpose string) *model.AppError
	PostWithProxyAddedToImageURLs(post *model.Post) *model.Post
	PostWithProxyRemovedFromImageURLs(post *model.Post) *model.Post
	PreparePostForClient(originalPost *model.Post, isNewPost bool, isEditPost bool) *model.Post
	PreparePostListForClient(originalList *model.PostList) *model.PostList
	ProcessSlackText(text string) string
	Publish(message *model.WebSocketEvent)
	PublishSkipClusterSend(message *model.WebSocketEvent)
	PublishUserTyping(userId, channelId, parentId string) *model.AppError
	PurgeBleveIndexes() *model.AppError
	PurgeElasticsearchIndexes() *model.AppError
	ReadFile(path string) ([]byte, *model.AppError)
	RecycleDatabaseConnection()
	RegenCommandToken(cmd *model.Command) (*model.Command, *model.AppError)
	RegenOutgoingWebhookToken(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
	RegenerateOAuthAppSecret(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
	RegenerateTeamInviteId(teamId string) (*model.Team, *model.AppError)
	RegisterPluginCommand(pluginId string, command *model.Command) error
	ReloadConfig() error
	RemoveAllDeactivatedMembersFromChannel(channel *model.Channel) *model.AppError
	RemoveConfigListener(id string)
	RemoveFile(path string) *model.AppError
	RemoveLdapPrivateCertificate() *model.AppError
	RemoveLdapPublicCertificate() *model.AppError
	RemovePlugin(id string) *model.AppError
	RemovePluginFromData(data model.PluginEventData)
	RemoveSamlIdpCertificate() *model.AppError
	RemoveSamlPrivateCertificate() *model.AppError
	RemoveSamlPublicCertificate() *model.AppError
	RemoveTeamIcon(teamId string) *model.AppError
	RemoveTeamMemberFromTeam(teamMember *model.TeamMember, requestorId string) *model.AppError
	RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError
	RemoveUserFromTeam(teamId string, userId string, requestorId string) *model.AppError
	RemoveUsersFromChannelNotMemberOfTeam(remover *model.User, channel *model.Channel, team *model.Team) *model.AppError
	RequestId() string
	RequestLicenseAndAckWarnMetric(warnMetricId string, isBot bool) *model.AppError
	ResetPasswordFromToken(userSuppliedTokenString, newPassword string) *model.AppError
	ResetPermissionsSystem() *model.AppError
	RestoreChannel(channel *model.Channel, userId string) (*model.Channel, *model.AppError)
	RestoreTeam(teamId string) *model.AppError
	RestrictUsersGetByPermissions(userId string, options *model.UserGetOptions) (*model.UserGetOptions, *model.AppError)
	RestrictUsersSearchByPermissions(userId string, options *model.UserSearchOptions) (*model.UserSearchOptions, *model.AppError)
	RevokeAccessToken(token string) *model.AppError
	RevokeAllSessions(userId string) *model.AppError
	RevokeSession(session *model.Session) *model.AppError
	RevokeSessionById(sessionId string) *model.AppError
	RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError
	RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError
	RolesGrantPermission(roleNames []string, permissionId string) bool
	Saml() einterfaces.SamlInterface
	SanitizeProfile(user *model.User, asAdmin bool)
	SanitizeTeam(session model.Session, team *model.Team) *model.Team
	SanitizeTeams(session model.Session, teams []*model.Team) []*model.Team
	SaveAndBroadcastStatus(status *model.Status)
	SaveBrandImage(imageData *multipart.FileHeader) *model.AppError
	SaveComplianceReport(job *model.Compliance) (*model.Compliance, *model.AppError)
	SaveReactionForPost(reaction *model.Reaction) (*model.Reaction, *model.AppError)
	SaveUserTermsOfService(userId, termsOfServiceId string, accepted bool) *model.AppError
	SchemesIterator(scope string, batchSize int) func() []*model.Scheme
	SearchArchivedChannels(teamId string, term string, userId string) (*model.ChannelList, *model.AppError)
	SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
	SearchChannelsForUser(userId, teamId, term string) (*model.ChannelList, *model.AppError)
	SearchChannelsUserNotIn(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)
	SearchEmoji(name string, prefixOnly bool, limit int) ([]*model.Emoji, *model.AppError)
	SearchEngine() *searchengine.Broker
	SearchGroupChannels(userId, term string) (*model.ChannelList, *model.AppError)
	SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) (*model.PostList, *model.AppError)
	SearchPostsInTeamForUser(terms string, userId string, teamId string, isOrSearch bool, includeDeletedChannels bool, timeZoneOffset int, page, perPage int) (*model.PostSearchResults, *model.AppError)
	SearchPrivateTeams(term string) ([]*model.Team, *model.AppError)
	SearchPublicTeams(term string) ([]*model.Team, *model.AppError)
	SearchUserAccessTokens(term string) ([]*model.UserAccessToken, *model.AppError)
	SearchUsers(props *model.UserSearch, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SearchUsersInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SearchUsersInTeam(teamId, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SearchUsersNotInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SearchUsersNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SearchUsersWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError)
	SendAckToPushProxy(ack *model.PushNotificationAck) error
	SendAutoResponse(channel *model.Channel, receiver *model.User) (bool, *model.AppError)
	SendAutoResponseIfNecessary(channel *model.Channel, sender *model.User) (bool, *model.AppError)
	SendEmailVerification(user *model.User, newEmail, redirect string) *model.AppError
	SendEphemeralPost(userId string, post *model.Post) *model.Post
	SendNotifications(post *model.Post, team *model.Team, channel *model.Channel, sender *model.User, parentPostList *model.PostList, setOnline bool) ([]string, error)
	SendPasswordReset(email string, siteURL string) (bool, *model.AppError)
	ServeInterPluginRequest(w http.ResponseWriter, r *http.Request, sourcePluginId, destinationPluginId string)
	ServePluginRequest(w http.ResponseWriter, r *http.Request)
	Session() *model.Session
	SessionCacheLength() int
	SessionHasPermissionTo(session model.Session, permission *model.Permission) bool
	SessionHasPermissionToAny(session model.Session, permissions []*model.Permission) bool
	SessionHasPermissionToCategory(session model.Session, userId, teamId, categoryId string) bool
	SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool
	SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool
	SessionHasPermissionToTeam(session model.Session, teamId string, permission *model.Permission) bool
	SessionHasPermissionToUser(session model.Session, userId string) bool
	SessionHasPermissionToUserOrBot(session model.Session, userId string) bool
	SetAcceptLanguage(s string)
	SetActiveChannel(userId string, channelId string) *model.AppError
	SetAutoResponderStatus(user *model.User, oldNotifyProps model.StringMap)
	SetContext(c context.Context)
	SetDefaultProfileImage(user *model.User) *model.AppError
	SetIpAddress(s string)
	SetPath(s string)
	SetPhase2PermissionsMigrationStatus(isComplete bool) error
	SetPluginKey(pluginId string, key string, value []byte) *model.AppError
	SetPluginKeyWithExpiry(pluginId string, key string, value []byte, expireInSeconds int64) *model.AppError
	SetPluginKeyWithOptions(pluginId string, key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
	SetPluginsEnvironment(pluginsEnvironment *plugin.Environment)
	SetProfileImage(userId string, imageData *multipart.FileHeader) *model.AppError
	SetProfileImageFromFile(userId string, file io.Reader) *model.AppError
	SetProfileImageFromMultiPartFile(userId string, file multipart.File) *model.AppError
	SetRequestId(s string)
	SetSamlIdpCertificateFromMetadata(data []byte) *model.AppError
	SetSearchEngine(se *searchengine.Broker)
	SetServer(srv *Server)
	SetSession(s *model.Session)
	SetStatusAwayIfNeeded(userId string, manual bool)
	SetStatusDoNotDisturb(userId string)
	SetStatusOffline(userId string, manual bool)
	SetStatusOnline(userId string, manual bool)
	SetStatusOutOfOffice(userId string)
	SetT(t goi18n.TranslateFunc)
	SetTeamIcon(teamId string, imageData *multipart.FileHeader) *model.AppError
	SetTeamIconFromFile(team *model.Team, file io.Reader) *model.AppError
	SetTeamIconFromMultiPartFile(teamId string, file multipart.File) *model.AppError
	SetUserAgent(s string)
	SlackImport(fileData multipart.File, fileSize int64, teamID string) (*model.AppError, *bytes.Buffer)
	SoftDeleteTeam(teamId string) *model.AppError
	Srv() *Server
	SubmitInteractiveDialog(request model.SubmitDialogRequest) (*model.SubmitDialogResponse, *model.AppError)
	SwitchEmailToLdap(email, password, code, ldapLoginId, ldapPassword string) (string, *model.AppError)
	SwitchEmailToOAuth(w http.ResponseWriter, r *http.Request, email, password, code, service string) (string, *model.AppError)
	SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (string, *model.AppError)
	SwitchOAuthToEmail(email, password, requesterId string) (string, *model.AppError)
	SyncLdap()
	SyncPluginsActiveState()
	T(translationID string, args ...interface{}) string
	TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError)
	TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError)
	TelemetryId() string
	TestElasticsearch(cfg *model.Config) *model.AppError
	TestEmail(userId string, cfg *model.Config) *model.AppError
	TestLdap() *model.AppError
	TestSiteURL(siteURL string) *model.AppError
	Timezones() *timezones.Timezones
	ToggleMuteChannel(channelId string, userId string) *model.ChannelMember
	TotalWebsocketConnections() int
	TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model.OutgoingWebhook, post *model.Post, channel *model.Channel)
	UnregisterPluginCommand(pluginId, teamId, trigger string)
	UnregisterPluginCommands(pluginId string)
	UpdateActive(user *model.User, active bool) (*model.User, *model.AppError)
	UpdateChannelLastViewedAt(channelIds []string, userId string) *model.AppError
	UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userId string) (*model.ChannelMember, *model.AppError)
	UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError)
	UpdateChannelMemberSchemeRoles(channelId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError)
	UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError)
	UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError)
	UpdateConfig(f func(*model.Config))
	UpdateEphemeralPost(userId string, post *model.Post) *model.Post
	UpdateGroup(group *model.Group) (*model.Group, *model.AppError)
	UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
	UpdateHashedPassword(user *model.User, newHashedPassword string) *model.AppError
	UpdateHashedPasswordByUserId(userId, newHashedPassword string) *model.AppError
	UpdateIncomingWebhook(oldHook, updatedHook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)
	UpdateLastActivityAtIfNeeded(session model.Session)
	UpdateMfa(activate bool, userId, token string) *model.AppError
	UpdateMobileAppBadge(userId string)
	UpdateOAuthUserAttrs(userData io.Reader, user *model.User, provider einterfaces.OauthProvider, service string) *model.AppError
	UpdateOauthApp(oldApp, updatedApp *model.OAuthApp) (*model.OAuthApp, *model.AppError)
	UpdateOutgoingWebhook(oldHook, updatedHook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
	UpdatePassword(user *model.User, newPassword string) *model.AppError
	UpdatePasswordAsUser(userId, currentPassword, newPassword string) *model.AppError
	UpdatePasswordByUserIdSendEmail(userId, newPassword, method string) *model.AppError
	UpdatePasswordSendEmail(user *model.User, newPassword, method string) *model.AppError
	UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model.AppError)
	UpdatePreferences(userId string, preferences model.Preferences) *model.AppError
	UpdateRole(role *model.Role) (*model.Role, *model.AppError)
	UpdateScheme(scheme *model.Scheme) (*model.Scheme, *model.AppError)
	UpdateSessionsIsGuest(userId string, isGuest bool)
	UpdateSidebarCategories(userId, teamId string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)
	UpdateSidebarCategoryOrder(userId, teamId string, categoryOrder []string) *model.AppError
	UpdateTeam(team *model.Team) (*model.Team, *model.AppError)
	UpdateTeamMemberRoles(teamId string, userId string, newRoles string) (*model.TeamMember, *model.AppError)
	UpdateTeamMemberSchemeRoles(teamId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.TeamMember, *model.AppError)
	UpdateTeamPrivacy(teamId string, teamType string, allowOpenInvite bool) *model.AppError
	UpdateTeamScheme(team *model.Team) (*model.Team, *model.AppError)
	UpdateUser(user *model.User, sendNotifications bool) (*model.User, *model.AppError)
	UpdateUserActive(userId string, active bool) *model.AppError
	UpdateUserAsUser(user *model.User, asAdmin bool) (*model.User, *model.AppError)
	UpdateUserAuth(userId string, userAuth *model.UserAuth) (*model.UserAuth, *model.AppError)
	UpdateUserNotifyProps(userId string, props map[string]string) (*model.User, *model.AppError)
	UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError)
	UploadData(us *model.UploadSession, rd io.Reader) (*model.FileInfo, *model.AppError)
	UploadEmojiImage(id string, imageData *multipart.FileHeader) *model.AppError
	UploadMultipartFiles(teamId string, channelId string, userId string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
	UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
	UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
	UserAgent() string
	UserCanSeeOtherUser(userId string, otherUserId string) (bool, *model.AppError)
	VerifyEmailFromToken(userSuppliedTokenString string) *model.AppError
	VerifyUserEmail(userId, email string) *model.AppError
	ViewChannel(view *model.ChannelView, userId string, currentSessionId string) (map[string]int64, *model.AppError)
	WaitForChannelMembership(channelId string, userId string)
	WriteFile(fr io.Reader, path string) (int64, *model.AppError)
}

AppIface is extracted from App struct and contains all it's exported methods. It's provided to allow partial interface passing and app layers creation.

type AppOption

type AppOption func(a *App)

func ServerConnector

func ServerConnector(s *Server) AppOption

type AppOptionCreator

type AppOptionCreator func() []AppOption

type AttachmentImportData

type AttachmentImportData struct {
	Path *string `json:"path"`
}

type Busy

type Busy struct {
	// contains filtered or unexported fields
}

Busy represents the busy state of the server. A server marked busy will have non-critical services disabled. If a Cluster is provided any changes will be propagated to each node.

func NewBusy

func NewBusy(cluster einterfaces.ClusterInterface) *Busy

NewBusy creates a new Busy instance with optional cluster which will be notified of busy state changes.

func (*Busy) Clear

func (b *Busy) Clear()

ClearBusy marks the server as not busy and notifies cluster nodes.

func (*Busy) ClusterEventChanged

func (b *Busy) ClusterEventChanged(sbs *model.ServerBusyState)

ClusterEventChanged is called when a CLUSTER_EVENT_BUSY_STATE_CHANGED is received.

func (*Busy) Expires

func (b *Busy) Expires() time.Time

Expires returns the expected time that the server will be marked not busy. This expiry can be extended via additional calls to SetBusy.

func (*Busy) IsBusy

func (b *Busy) IsBusy() bool

IsBusy returns true if the server has been marked as busy.

func (*Busy) Set

func (b *Busy) Set(dur time.Duration)

Set marks the server as busy for dur duration and notifies cluster nodes.

func (*Busy) ToJson

func (b *Busy) ToJson() string

type ChannelImportData

type ChannelImportData struct {
	Team        *string `json:"team"`
	Name        *string `json:"name"`
	DisplayName *string `json:"display_name"`
	Type        *string `json:"type"`
	Header      *string `json:"header,omitempty"`
	Purpose     *string `json:"purpose,omitempty"`
	Scheme      *string `json:"scheme,omitempty"`
}

type ClusterDiscoveryService

type ClusterDiscoveryService struct {
	model.ClusterDiscovery
	// contains filtered or unexported fields
}

func (*ClusterDiscoveryService) Start

func (me *ClusterDiscoveryService) Start()

func (*ClusterDiscoveryService) Stop

func (me *ClusterDiscoveryService) Stop()

type CommandProvider

type CommandProvider interface {
	GetTrigger() string
	GetCommand(a *App, T goi18n.TranslateFunc) *model.Command
	DoCommand(a *App, args *model.CommandArgs, message string) *model.CommandResponse
}

func GetCommandProvider

func GetCommandProvider(name string) CommandProvider

type ComparablePreference

type ComparablePreference struct {
	Category string
	Name     string
}

type DirectChannelImportData

type DirectChannelImportData struct {
	Members     *[]string `json:"members"`
	FavoritedBy *[]string `json:"favorited_by"`

	Header *string `json:"header"`
}

type DirectPostImportData

type DirectPostImportData struct {
	ChannelMembers *[]string `json:"channel_members"`
	User           *string   `json:"user"`

	Message  *string                `json:"message"`
	Props    *model.StringInterface `json:"props"`
	CreateAt *int64                 `json:"create_at"`

	FlaggedBy   *[]string               `json:"flagged_by"`
	Reactions   *[]ReactionImportData   `json:"reactions"`
	Replies     *[]ReplyImportData      `json:"replies"`
	Attachments *[]AttachmentImportData `json:"attachments"`
}

type EmailBatchingJob

type EmailBatchingJob struct {
	// contains filtered or unexported fields
}

func NewEmailBatchingJob

func NewEmailBatchingJob(es *EmailService, bufferSize int) *EmailBatchingJob

func (*EmailBatchingJob) Add

func (job *EmailBatchingJob) Add(user *model.User, post *model.Post, team *model.Team) bool

func (*EmailBatchingJob) CheckPendingEmails

func (job *EmailBatchingJob) CheckPendingEmails()

func (*EmailBatchingJob) Start

func (job *EmailBatchingJob) Start()

type EmailService

type EmailService struct {
	EmailRateLimiter *throttled.GCRARateLimiter
	EmailBatching    *EmailBatchingJob
	// contains filtered or unexported fields
}

func NewEmailService

func NewEmailService(srv *Server) (*EmailService, error)

func (*EmailService) AddNotificationEmailToBatch

func (es *EmailService) AddNotificationEmailToBatch(user *model.User, post *model.Post, team *model.Team) *model.AppError

func (*EmailService) CreateVerifyEmailToken

func (es *EmailService) CreateVerifyEmailToken(userId string, newEmail string) (*model.Token, *model.AppError)

func (*EmailService) InitEmailBatching

func (es *EmailService) InitEmailBatching()

func (*EmailService) SendDeactivateAccountEmail

func (es *EmailService) SendDeactivateAccountEmail(email string, locale, siteURL string) *model.AppError

func (*EmailService) SendInviteEmails

func (es *EmailService) SendInviteEmails(team *model.Team, senderName string, senderUserId string, invites []string, siteURL string) *model.AppError

func (*EmailService) SendPasswordResetEmail

func (es *EmailService) SendPasswordResetEmail(email string, token *model.Token, locale, siteURL string) (bool, *model.AppError)

func (*EmailService) SendRemoveExpiredLicenseEmail

func (es *EmailService) SendRemoveExpiredLicenseEmail(email string, locale, siteURL string, licenseId string) *model.AppError

func (*EmailService) SendSignInChangeEmail

func (es *EmailService) SendSignInChangeEmail(email, method, locale, siteURL string) *model.AppError

type EmojiImportData

type EmojiImportData struct {
	Name  *string `json:"name"`
	Image *string `json:"image"`
}

type ExplicitMentions

type ExplicitMentions struct {
	// Mentions contains the ID of each user that was mentioned and how they were mentioned.
	Mentions map[string]MentionType

	// Contains a map of groups that were mentioned
	GroupMentions map[string]*model.Group

	// OtherPotentialMentions contains a list of strings that looked like mentions, but didn't have
	// a corresponding keyword.
	OtherPotentialMentions []string

	// HereMentioned is true if the message contained @here.
	HereMentioned bool

	// AllMentioned is true if the message contained @all.
	AllMentioned bool

	// ChannelMentioned is true if the message contained @channel.
	ChannelMentioned bool
}

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub is the central place to manage all websocket connections in the server. It handles different websocket events and sending messages to individual user connections.

func (*Hub) Broadcast

func (h *Hub) Broadcast(message *model.WebSocketEvent)

Broadcast broadcasts the message to all connections in the hub.

func (*Hub) InvalidateUser

func (h *Hub) InvalidateUser(userId string)

InvalidateUser invalidates the cache for the given user.

func (*Hub) IsRegistered

func (h *Hub) IsRegistered(userId, sessionToken string) bool

Determines if a user's session is registered a connection from the hub.

func (*Hub) Register

func (h *Hub) Register(webConn *WebConn)

Register registers a connection to the hub.

func (*Hub) SendMessage

func (h *Hub) SendMessage(conn *WebConn, msg model.WebSocketMessage)

SendMessage sends the given message to the given connection.

func (*Hub) Start

func (h *Hub) Start()

Start starts the hub.

func (*Hub) Stop

func (h *Hub) Stop()

Stop stops the hub.

func (*Hub) Unregister

func (h *Hub) Unregister(webConn *WebConn)

Unregister unregisters a connection from the hub.

func (*Hub) UpdateActivity

func (h *Hub) UpdateActivity(userId, sessionToken string, activityAt int64)

UpdateActivity sets the LastUserActivityAt field for the connection of the user.

type LineImportData

type LineImportData struct {
	Type          string                   `json:"type"`
	Scheme        *SchemeImportData        `json:"scheme,omitempty"`
	Team          *TeamImportData          `json:"team,omitempty"`
	Channel       *ChannelImportData       `json:"channel,omitempty"`
	User          *UserImportData          `json:"user,omitempty"`
	Post          *PostImportData          `json:"post,omitempty"`
	DirectChannel *DirectChannelImportData `json:"direct_channel,omitempty"`
	DirectPost    *DirectPostImportData    `json:"direct_post,omitempty"`
	Emoji         *EmojiImportData         `json:"emoji,omitempty"`
	Version       *int                     `json:"version,omitempty"`
}

func ImportLineForDirectPost

func ImportLineForDirectPost(post *model.DirectPostForExport) *LineImportData

func ImportLineForPost

func ImportLineForPost(post *model.PostForExport) *LineImportData

func ImportLineFromChannel

func ImportLineFromChannel(channel *model.ChannelForExport) *LineImportData

func ImportLineFromDirectChannel

func ImportLineFromDirectChannel(channel *model.DirectChannelForExport) *LineImportData

func ImportLineFromEmoji

func ImportLineFromEmoji(emoji *model.Emoji, filePath string) *LineImportData

func ImportLineFromTeam

func ImportLineFromTeam(team *model.TeamForExport) *LineImportData

func ImportLineFromUser

func ImportLineFromUser(user *model.User, exportedPrefs map[string]*string) *LineImportData

type LineImportWorkerData

type LineImportWorkerData struct {
	LineImportData
	LineNumber int
}

type LineImportWorkerError

type LineImportWorkerError struct {
	Error      *model.AppError
	LineNumber int
}

type LocalResponseWriter

type LocalResponseWriter struct {
	// contains filtered or unexported fields
}

func (*LocalResponseWriter) Header

func (w *LocalResponseWriter) Header() http.Header

func (*LocalResponseWriter) Write

func (w *LocalResponseWriter) Write(bytes []byte) (int, error)

func (*LocalResponseWriter) WriteHeader

func (w *LocalResponseWriter) WriteHeader(statusCode int)

type MailToLinkContent

type MailToLinkContent struct {
	MetricId      string `json:"metric_id"`
	MailRecipient string `json:"mail_recipient"`
	MailCC        string `json:"mail_cc"`
	MailSubject   string `json:"mail_subject"`
	MailBody      string `json:"mail_body"`
}

func (*MailToLinkContent) ToJson

func (mlc *MailToLinkContent) ToJson() string

type MentionType

type MentionType int
const (

	// A placeholder that should never be used in practice
	NoMention MentionType = iota

	// The post is in a thread that the user has commented on
	ThreadMention

	// The post is a comment on a thread started by the user
	CommentMention

	// The post contains an at-channel, at-all, or at-here
	ChannelMention

	// The post is a DM
	DMMention

	// The post contains an at-mention for the user
	KeywordMention

	// The post contains a group mention for the user
	GroupMention
)

type Option

type Option func(s *Server) error

func Config

func Config(dsn string, watch bool) Option

Config applies the given config dsn, whether a path to config.json or a database connection string.

func ConfigStore

func ConfigStore(configStore config.Store) Option

ConfigStore applies the given config store, typically to replace the traditional sources with a memory store for testing.

func SetLogger

func SetLogger(logger *mlog.Logger) Option

func StoreOverride

func StoreOverride(override interface{}) Option

By default, the app will use the store specified by the configuration. This allows you to construct an app with a different store.

The override parameter must be either a store.Store or func(App) store.Store().

type PluginAPI

type PluginAPI struct {
	// contains filtered or unexported fields
}

func NewPluginAPI

func NewPluginAPI(a *App, manifest *model.Manifest) *PluginAPI

func (*PluginAPI) AddChannelMember

func (api *PluginAPI) AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)

func (*PluginAPI) AddReaction

func (api *PluginAPI) AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError)

func (*PluginAPI) AddUserToChannel

func (api *PluginAPI) AddUserToChannel(channelId, userId, asUserId string) (*model.ChannelMember, *model.AppError)

func (*PluginAPI) CopyFileInfos

func (api *PluginAPI) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)

func (*PluginAPI) CreateBot

func (api *PluginAPI) CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)

func (*PluginAPI) CreateChannel

func (api *PluginAPI) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

func (*PluginAPI) CreateCommand

func (api *PluginAPI) CreateCommand(cmd *model.Command) (*model.Command, error)

func (*PluginAPI) CreatePost

func (api *PluginAPI) CreatePost(post *model.Post) (*model.Post, *model.AppError)

func (*PluginAPI) CreateTeam

func (api *PluginAPI) CreateTeam(team *model.Team) (*model.Team, *model.AppError)

func (*PluginAPI) CreateTeamMember

func (api *PluginAPI) CreateTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

func (*PluginAPI) CreateTeamMembers

func (api *PluginAPI) CreateTeamMembers(teamId string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)

func (*PluginAPI) CreateTeamMembersGracefully

func (api *PluginAPI) CreateTeamMembersGracefully(teamId string, userIds []string, requestorId string) ([]*model.TeamMemberWithError, *model.AppError)

func (*PluginAPI) CreateUser

func (api *PluginAPI) CreateUser(user *model.User) (*model.User, *model.AppError)

func (*PluginAPI) DeleteBotIconImage

func (api *PluginAPI) DeleteBotIconImage(userId string) *model.AppError

func (*PluginAPI) DeleteChannel

func (api *PluginAPI) DeleteChannel(channelId string) *model.AppError

func (*PluginAPI) DeleteChannelMember

func (api *PluginAPI) DeleteChannelMember(channelId, userId string) *model.AppError

func (*PluginAPI) DeleteCommand

func (api *PluginAPI) DeleteCommand(commandID string) error

func (*PluginAPI) DeleteEphemeralPost

func (api *PluginAPI) DeleteEphemeralPost(userId, postId string)

func (*PluginAPI) DeletePost

func (api *PluginAPI) DeletePost(postId string) *model.AppError

func (*PluginAPI) DeletePreferencesForUser

func (api *PluginAPI) DeletePreferencesForUser(userId string, preferences []model.Preference) *model.AppError

func (*PluginAPI) DeleteTeam

func (api *PluginAPI) DeleteTeam(teamId string) *model.AppError

func (*PluginAPI) DeleteTeamMember

func (api *PluginAPI) DeleteTeamMember(teamId, userId, requestorId string) *model.AppError

func (*PluginAPI) DeleteUser

func (api *PluginAPI) DeleteUser(userId string) *model.AppError

func (*PluginAPI) DisablePlugin

func (api *PluginAPI) DisablePlugin(id string) *model.AppError

func (*PluginAPI) EnablePlugin

func (api *PluginAPI) EnablePlugin(id string) *model.AppError

func (*PluginAPI) ExecuteSlashCommand

func (api *PluginAPI) ExecuteSlashCommand(commandArgs *model.CommandArgs) (*model.CommandResponse, error)

func (*PluginAPI) GetBot

func (api *PluginAPI) GetBot(userId string, includeDeleted bool) (*model.Bot, *model.AppError)

func (*PluginAPI) GetBotIconImage

func (api *PluginAPI) GetBotIconImage(userId string) ([]byte, *model.AppError)

func (*PluginAPI) GetBots

func (api *PluginAPI) GetBots(options *model.BotGetOptions) ([]*model.Bot, *model.AppError)

func (*PluginAPI) GetBundlePath

func (api *PluginAPI) GetBundlePath() (string, error)

func (*PluginAPI) GetChannel

func (api *PluginAPI) GetChannel(channelId string) (*model.Channel, *model.AppError)

func (*PluginAPI) GetChannelByName

func (api *PluginAPI) GetChannelByName(teamId, name string, includeDeleted bool) (*model.Channel, *model.AppError)

func (*PluginAPI) GetChannelByNameForTeamName

func (api *PluginAPI) GetChannelByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)

func (*PluginAPI) GetChannelMember

func (api *PluginAPI) GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)

func (*PluginAPI) GetChannelMembers

func (api *PluginAPI) GetChannelMembers(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)

func (*PluginAPI) GetChannelMembersByIds

func (api *PluginAPI) GetChannelMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, *model.AppError)

func (*PluginAPI) GetChannelMembersForUser

func (api *PluginAPI) GetChannelMembersForUser(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)

func (*PluginAPI) GetChannelStats

func (api *PluginAPI) GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError)

func (*PluginAPI) GetChannelsForTeamForUser

func (api *PluginAPI) GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError)

func (*PluginAPI) GetCommand

func (api *PluginAPI) GetCommand(commandID string) (*model.Command, error)

func (*PluginAPI) GetConfig

func (api *PluginAPI) GetConfig() *model.Config

func (*PluginAPI) GetDiagnosticId

func (api *PluginAPI) GetDiagnosticId() string

func (*PluginAPI) GetDirectChannel

func (api *PluginAPI) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)

func (*PluginAPI) GetEmoji

func (api *PluginAPI) GetEmoji(emojiId string) (*model.Emoji, *model.AppError)

func (*PluginAPI) GetEmojiByName

func (api *PluginAPI) GetEmojiByName(name string) (*model.Emoji, *model.AppError)

func (*PluginAPI) GetEmojiImage

func (api *PluginAPI) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)

func (*PluginAPI) GetEmojiList

func (api *PluginAPI) GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError)

func (*PluginAPI) GetFile

func (api *PluginAPI) GetFile(fileId string) ([]byte, *model.AppError)

func (*PluginAPI) GetFileInfo

func (api *PluginAPI) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)

func (*PluginAPI) GetFileInfos

func (api *PluginAPI) GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)
func (api *PluginAPI) GetFileLink(fileId string) (string, *model.AppError)

func (*PluginAPI) GetGroup

func (api *PluginAPI) GetGroup(groupId string) (*model.Group, *model.AppError)

func (*PluginAPI) GetGroupByName

func (api *PluginAPI) GetGroupByName(name string) (*model.Group, *model.AppError)

func (*PluginAPI) GetGroupChannel

func (api *PluginAPI) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)

func (*PluginAPI) GetGroupsForUser

func (api *PluginAPI) GetGroupsForUser(userId string) ([]*model.Group, *model.AppError)

func (*PluginAPI) GetLDAPUserAttributes

func (api *PluginAPI) GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError)

func (*PluginAPI) GetLicense

func (api *PluginAPI) GetLicense() *model.License

func (*PluginAPI) GetPluginConfig

func (api *PluginAPI) GetPluginConfig() map[string]interface{}

func (*PluginAPI) GetPluginStatus

func (api *PluginAPI) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)

func (*PluginAPI) GetPlugins

func (api *PluginAPI) GetPlugins() ([]*model.Manifest, *model.AppError)

func (*PluginAPI) GetPost

func (api *PluginAPI) GetPost(postId string) (*model.Post, *model.AppError)

func (*PluginAPI) GetPostThread

func (api *PluginAPI) GetPostThread(postId string) (*model.PostList, *model.AppError)

func (*PluginAPI) GetPostsAfter

func (api *PluginAPI) GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)

func (*PluginAPI) GetPostsBefore

func (api *PluginAPI) GetPostsBefore(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)

func (*PluginAPI) GetPostsForChannel

func (api *PluginAPI) GetPostsForChannel(channelId string, page, perPage int) (*model.PostList, *model.AppError)

func (*PluginAPI) GetPostsSince

func (api *PluginAPI) GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)

func (*PluginAPI) GetPreferencesForUser

func (api *PluginAPI) GetPreferencesForUser(userId string) ([]model.Preference, *model.AppError)

func (*PluginAPI) GetProfileImage

func (api *PluginAPI) GetProfileImage(userId string) ([]byte, *model.AppError)

func (*PluginAPI) GetPublicChannelsForTeam

func (api *PluginAPI) GetPublicChannelsForTeam(teamId string, page, perPage int) ([]*model.Channel, *model.AppError)

func (*PluginAPI) GetReactions

func (api *PluginAPI) GetReactions(postId string) ([]*model.Reaction, *model.AppError)

func (*PluginAPI) GetServerVersion

func (api *PluginAPI) GetServerVersion() string

func (*PluginAPI) GetSession

func (api *PluginAPI) GetSession(sessionId string) (*model.Session, *model.AppError)

func (*PluginAPI) GetSystemInstallDate

func (api *PluginAPI) GetSystemInstallDate() (int64, *model.AppError)

func (*PluginAPI) GetTeam

func (api *PluginAPI) GetTeam(teamId string) (*model.Team, *model.AppError)

func (*PluginAPI) GetTeamByName

func (api *PluginAPI) GetTeamByName(name string) (*model.Team, *model.AppError)

func (*PluginAPI) GetTeamIcon

func (api *PluginAPI) GetTeamIcon(teamId string) ([]byte, *model.AppError)

func (*PluginAPI) GetTeamMember

func (api *PluginAPI) GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

func (*PluginAPI) GetTeamMembers

func (api *PluginAPI) GetTeamMembers(teamId string, page, perPage int) ([]*model.TeamMember, *model.AppError)

func (*PluginAPI) GetTeamMembersForUser

func (api *PluginAPI) GetTeamMembersForUser(userId string, page int, perPage int) ([]*model.TeamMember, *model.AppError)

func (*PluginAPI) GetTeamStats

func (api *PluginAPI) GetTeamStats(teamId string) (*model.TeamStats, *model.AppError)

func (*PluginAPI) GetTeams

func (api *PluginAPI) GetTeams() ([]*model.Team, *model.AppError)

func (*PluginAPI) GetTeamsForUser

func (api *PluginAPI) GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)

func (*PluginAPI) GetTeamsUnreadForUser

func (api *PluginAPI) GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError)

func (*PluginAPI) GetTelemetryId

func (api *PluginAPI) GetTelemetryId() string

func (*PluginAPI) GetUnsanitizedConfig

func (api *PluginAPI) GetUnsanitizedConfig() *model.Config

GetUnsanitizedConfig gets the configuration for a system admin without removing secrets.

func (*PluginAPI) GetUser

func (api *PluginAPI) GetUser(userId string) (*model.User, *model.AppError)

func (*PluginAPI) GetUserByEmail

func (api *PluginAPI) GetUserByEmail(email string) (*model.User, *model.AppError)

func (*PluginAPI) GetUserByUsername

func (api *PluginAPI) GetUserByUsername(name string) (*model.User, *model.AppError)

func (*PluginAPI) GetUserStatus

func (api *PluginAPI) GetUserStatus(userId string) (*model.Status, *model.AppError)

func (*PluginAPI) GetUserStatusesByIds

func (api *PluginAPI) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)

func (*PluginAPI) GetUsers

func (api *PluginAPI) GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)

func (*PluginAPI) GetUsersByUsernames

func (api *PluginAPI) GetUsersByUsernames(usernames []string) ([]*model.User, *model.AppError)

func (*PluginAPI) GetUsersInChannel

func (api *PluginAPI) GetUsersInChannel(channelId, sortBy string, page, perPage int) ([]*model.User, *model.AppError)

func (*PluginAPI) GetUsersInTeam

func (api *PluginAPI) GetUsersInTeam(teamId string, page int, perPage int) ([]*model.User, *model.AppError)

func (*PluginAPI) HasPermissionTo

func (api *PluginAPI) HasPermissionTo(userId string, permission *model.Permission) bool

func (*PluginAPI) HasPermissionToChannel

func (api *PluginAPI) HasPermissionToChannel(userId, channelId string, permission *model.Permission) bool

func (*PluginAPI) HasPermissionToTeam

func (api *PluginAPI) HasPermissionToTeam(userId, teamId string, permission *model.Permission) bool

func (*PluginAPI) InstallPlugin

func (api *PluginAPI) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)

func (*PluginAPI) KVCompareAndDelete

func (api *PluginAPI) KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError)

func (*PluginAPI) KVCompareAndSet

func (api *PluginAPI) KVCompareAndSet(key string, oldValue, newValue []byte) (bool, *model.AppError)

func (*PluginAPI) KVDelete

func (api *PluginAPI) KVDelete(key string) *model.AppError

func (*PluginAPI) KVDeleteAll

func (api *PluginAPI) KVDeleteAll() *model.AppError

func (*PluginAPI) KVGet

func (api *PluginAPI) KVGet(key string) ([]byte, *model.AppError)

func (*PluginAPI) KVList

func (api *PluginAPI) KVList(page, perPage int) ([]string, *model.AppError)

func (*PluginAPI) KVSet

func (api *PluginAPI) KVSet(key string, value []byte) *model.AppError

func (*PluginAPI) KVSetWithExpiry

func (api *PluginAPI) KVSetWithExpiry(key string, value []byte, expireInSeconds int64) *model.AppError

func (*PluginAPI) KVSetWithOptions

func (api *PluginAPI) KVSetWithOptions(key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)

func (*PluginAPI) ListBuiltInCommands

func (api *PluginAPI) ListBuiltInCommands() ([]*model.Command, error)

func (*PluginAPI) ListCommands

func (api *PluginAPI) ListCommands(teamID string) ([]*model.Command, error)

func (*PluginAPI) ListCustomCommands

func (api *PluginAPI) ListCustomCommands(teamID string) ([]*model.Command, error)

func (*PluginAPI) ListPluginCommands

func (api *PluginAPI) ListPluginCommands(teamID string) ([]*model.Command, error)

func (*PluginAPI) LoadPluginConfiguration

func (api *PluginAPI) LoadPluginConfiguration(dest interface{}) error

func (*PluginAPI) LogDebug

func (api *PluginAPI) LogDebug(msg string, keyValuePairs ...interface{})

func (*PluginAPI) LogError

func (api *PluginAPI) LogError(msg string, keyValuePairs ...interface{})

func (*PluginAPI) LogInfo

func (api *PluginAPI) LogInfo(msg string, keyValuePairs ...interface{})

func (*PluginAPI) LogWarn

func (api *PluginAPI) LogWarn(msg string, keyValuePairs ...interface{})

func (*PluginAPI) OpenInteractiveDialog

func (api *PluginAPI) OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError

func (*PluginAPI) PatchBot

func (api *PluginAPI) PatchBot(userId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)

func (*PluginAPI) PermanentDeleteBot

func (api *PluginAPI) PermanentDeleteBot(userId string) *model.AppError

func (*PluginAPI) PluginHTTP

func (api *PluginAPI) PluginHTTP(request *http.Request) *http.Response

func (*PluginAPI) PublishUserTyping

func (api *PluginAPI) PublishUserTyping(userId, channelId, parentId string) *model.AppError

func (*PluginAPI) PublishWebSocketEvent

func (api *PluginAPI) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)

func (*PluginAPI) ReadFile

func (api *PluginAPI) ReadFile(path string) ([]byte, *model.AppError)

func (*PluginAPI) RegisterCommand

func (api *PluginAPI) RegisterCommand(command *model.Command) error

func (*PluginAPI) RemovePlugin

func (api *PluginAPI) RemovePlugin(id string) *model.AppError

func (*PluginAPI) RemoveReaction

func (api *PluginAPI) RemoveReaction(reaction *model.Reaction) *model.AppError

func (*PluginAPI) RemoveTeamIcon

func (api *PluginAPI) RemoveTeamIcon(teamId string) *model.AppError

func (*PluginAPI) SaveConfig

func (api *PluginAPI) SaveConfig(config *model.Config) *model.AppError

func (*PluginAPI) SavePluginConfig

func (api *PluginAPI) SavePluginConfig(pluginConfig map[string]interface{}) *model.AppError

func (*PluginAPI) SearchChannels

func (api *PluginAPI) SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError)

func (*PluginAPI) SearchPostsInTeam

func (api *PluginAPI) SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)

func (*PluginAPI) SearchPostsInTeamForUser

func (api *PluginAPI) SearchPostsInTeamForUser(teamId string, userId string, searchParams model.SearchParameter) (*model.PostSearchResults, *model.AppError)

func (*PluginAPI) SearchTeams

func (api *PluginAPI) SearchTeams(term string) ([]*model.Team, *model.AppError)

func (*PluginAPI) SearchUsers

func (api *PluginAPI) SearchUsers(search *model.UserSearch) ([]*model.User, *model.AppError)

func (*PluginAPI) SendEphemeralPost

func (api *PluginAPI) SendEphemeralPost(userId string, post *model.Post) *model.Post

func (*PluginAPI) SendMail

func (api *PluginAPI) SendMail(to, subject, htmlBody string) *model.AppError

func (*PluginAPI) SetBotIconImage

func (api *PluginAPI) SetBotIconImage(userId string, data []byte) *model.AppError

func (*PluginAPI) SetProfileImage

func (api *PluginAPI) SetProfileImage(userId string, data []byte) *model.AppError

func (*PluginAPI) SetTeamIcon

func (api *PluginAPI) SetTeamIcon(teamId string, data []byte) *model.AppError

func (*PluginAPI) UnregisterCommand

func (api *PluginAPI) UnregisterCommand(teamId, trigger string) error

func (*PluginAPI) UpdateBotActive

func (api *PluginAPI) UpdateBotActive(userId string, active bool) (*model.Bot, *model.AppError)

func (*PluginAPI) UpdateChannel

func (api *PluginAPI) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

func (*PluginAPI) UpdateChannelMemberNotifications

func (api *PluginAPI) UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError)

func (*PluginAPI) UpdateChannelMemberRoles

func (api *PluginAPI) UpdateChannelMemberRoles(channelId, userId, newRoles string) (*model.ChannelMember, *model.AppError)

func (*PluginAPI) UpdateCommand

func (api *PluginAPI) UpdateCommand(commandID string, updatedCmd *model.Command) (*model.Command, error)

func (*PluginAPI) UpdateEphemeralPost

func (api *PluginAPI) UpdateEphemeralPost(userId string, post *model.Post) *model.Post

func (*PluginAPI) UpdatePost

func (api *PluginAPI) UpdatePost(post *model.Post) (*model.Post, *model.AppError)

func (*PluginAPI) UpdatePreferencesForUser

func (api *PluginAPI) UpdatePreferencesForUser(userId string, preferences []model.Preference) *model.AppError

func (*PluginAPI) UpdateTeam

func (api *PluginAPI) UpdateTeam(team *model.Team) (*model.Team, *model.AppError)

func (*PluginAPI) UpdateTeamMemberRoles

func (api *PluginAPI) UpdateTeamMemberRoles(teamId, userId, newRoles string) (*model.TeamMember, *model.AppError)

func (*PluginAPI) UpdateUser

func (api *PluginAPI) UpdateUser(user *model.User) (*model.User, *model.AppError)

func (*PluginAPI) UpdateUserActive

func (api *PluginAPI) UpdateUserActive(userId string, active bool) *model.AppError

func (*PluginAPI) UpdateUserStatus

func (api *PluginAPI) UpdateUserStatus(userId, status string) (*model.Status, *model.AppError)

func (*PluginAPI) UploadFile

func (api *PluginAPI) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)

type PluginCommand

type PluginCommand struct {
	Command  *model.Command
	PluginId string
}

type PluginResponseWriter

type PluginResponseWriter struct {
	bytes.Buffer
	// contains filtered or unexported fields
}

func (*PluginResponseWriter) GenerateResponse

func (rt *PluginResponseWriter) GenerateResponse() *http.Response

func (*PluginResponseWriter) Header

func (rt *PluginResponseWriter) Header() http.Header

func (*PluginResponseWriter) WriteHeader

func (rt *PluginResponseWriter) WriteHeader(statusCode int)

type PostImportData

type PostImportData struct {
	Team    *string `json:"team"`
	Channel *string `json:"channel"`
	User    *string `json:"user"`

	Message  *string                `json:"message"`
	Props    *model.StringInterface `json:"props"`
	CreateAt *int64                 `json:"create_at"`

	FlaggedBy   *[]string               `json:"flagged_by,omitempty"`
	Reactions   *[]ReactionImportData   `json:"reactions,omitempty"`
	Replies     *[]ReplyImportData      `json:"replies,omitempty"`
	Attachments *[]AttachmentImportData `json:"attachments,omitempty"`
}

type PostNotification

type PostNotification struct {
	Channel    *model.Channel
	Post       *model.Post
	ProfileMap map[string]*model.User
	Sender     *model.User
}

Represents either an email or push notification and contains the fields required to send it to any user.

func (*PostNotification) GetChannelName

func (n *PostNotification) GetChannelName(userNameFormat, excludeId string) string

Returns the name of the channel for this notification. For direct messages, this is the sender's name preceded by an at sign. For group messages, this is a comma-separated list of the members of the channel, with an option to exclude the recipient of the message from that list.

func (*PostNotification) GetSenderName

func (n *PostNotification) GetSenderName(userNameFormat string, overridesAllowed bool) string

Returns the name of the sender of this notification, accounting for things like system messages and whether or not the username has been overridden by an integration.

type PushNotification

type PushNotification struct {
	// contains filtered or unexported fields
}

type PushNotificationsHub

type PushNotificationsHub struct {
	// contains filtered or unexported fields
}

type RateLimiter

type RateLimiter struct {
	// contains filtered or unexported fields
}

func NewRateLimiter

func NewRateLimiter(settings *model.RateLimitSettings, trustedProxyIPHeader []string) (*RateLimiter, error)

func (*RateLimiter) GenerateKey

func (rl *RateLimiter) GenerateKey(r *http.Request) string

func (*RateLimiter) RateLimitHandler

func (rl *RateLimiter) RateLimitHandler(wrappedHandler http.Handler) http.Handler

func (*RateLimiter) RateLimitWriter

func (rl *RateLimiter) RateLimitWriter(key string, w http.ResponseWriter) bool

func (*RateLimiter) UserIdRateLimit

func (rl *RateLimiter) UserIdRateLimit(userId string, w http.ResponseWriter) bool

type ReactionImportData

type ReactionImportData struct {
	User      *string `json:"user"`
	CreateAt  *int64  `json:"create_at"`
	EmojiName *string `json:"emoji_name"`
}

func ImportReactionFromPost

func ImportReactionFromPost(user *model.User, reaction *model.Reaction) *ReactionImportData

type ReplyImportData

type ReplyImportData struct {
	User *string `json:"user"`

	Message  *string `json:"message"`
	CreateAt *int64  `json:"create_at"`

	FlaggedBy   *[]string               `json:"flagged_by,omitempty"`
	Reactions   *[]ReactionImportData   `json:"reactions,omitempty"`
	Attachments *[]AttachmentImportData `json:"attachments,omitempty"`
}

func ImportReplyFromPost

func ImportReplyFromPost(post *model.ReplyForExport) *ReplyImportData

type RoleImportData

type RoleImportData struct {
	Name        *string   `json:"name"`
	DisplayName *string   `json:"display_name"`
	Description *string   `json:"description"`
	Permissions *[]string `json:"permissions"`
}

type SVGInfo

type SVGInfo struct {
	Width  int
	Height int
}

type SchemeImportData

type SchemeImportData struct {
	Name                    *string         `json:"name"`
	DisplayName             *string         `json:"display_name"`
	Description             *string         `json:"description"`
	Scope                   *string         `json:"scope"`
	DefaultTeamAdminRole    *RoleImportData `json:"default_team_admin_role"`
	DefaultTeamUserRole     *RoleImportData `json:"default_team_user_role"`
	DefaultChannelAdminRole *RoleImportData `json:"default_channel_admin_role"`
	DefaultChannelUserRole  *RoleImportData `json:"default_channel_user_role"`
	DefaultTeamGuestRole    *RoleImportData `json:"default_team_guest_role"`
	DefaultChannelGuestRole *RoleImportData `json:"default_channel_guest_role"`
}

type Server

type Server struct {
	Store              store.Store
	WebSocketRouter    *WebSocketRouter
	AppInitializedOnce sync.Once

	// RootRouter is the starting point for all HTTP requests to the server.
	RootRouter *mux.Router

	// LocalRouter is the starting point for all the local UNIX socket
	// requests to the server
	LocalRouter *mux.Router

	// Router is the starting point for all web, api4 and ws requests to the server. It differs
	// from RootRouter only if the SiteURL contains a /subpath.
	Router *mux.Router

	Server      *http.Server
	ListenAddr  *net.TCPAddr
	RateLimiter *RateLimiter
	Busy        *Busy

	PluginsEnvironment     *plugin.Environment
	PluginConfigListenerId string
	PluginsLock            sync.RWMutex

	EmailService *EmailService

	PushNotificationsHub PushNotificationsHub

	Jobs *jobs.JobServer

	HTTPService httpservice.HTTPService

	ImageProxy *imageproxy.ImageProxy

	Audit            *audit.Audit
	Log              *mlog.Logger
	NotificationsLog *mlog.Logger

	SearchEngine *searchengine.Broker

	AccountMigration einterfaces.AccountMigrationInterface
	Cluster          einterfaces.ClusterInterface
	Compliance       einterfaces.ComplianceInterface
	DataRetention    einterfaces.DataRetentionInterface
	Ldap             einterfaces.LdapInterface
	MessageExport    einterfaces.MessageExportInterface
	Cloud            einterfaces.CloudInterface
	Metrics          einterfaces.MetricsInterface
	Notification     einterfaces.NotificationInterface
	Saml             einterfaces.SamlInterface

	CacheProvider cache.Provider
	// contains filtered or unexported fields
}

func NewServer

func NewServer(options ...Option) (*Server, error)

func (*Server) AddClusterLeaderChangedListener

func (s *Server) AddClusterLeaderChangedListener(listener func()) string

Registers a given function to be called when the cluster leader may have changed. Returns a unique ID for the listener which can later be used to remove it. If clustering is not enabled in this build, the callback will never be called.

func (*Server) AddConfigListener

func (s *Server) AddConfigListener(listener func(*model.Config, *model.Config)) string

Registers a function with a given listener to be called when the config is reloaded and may have changed. The function will be called with two arguments: the old config and the new config. AddConfigListener returns a unique ID for the listener that can later be used to remove it.

func (*Server) AddLicenseListener

func (s *Server) AddLicenseListener(listener func(oldLicense, newLicense *model.License)) string

func (*Server) AppOptions

func (s *Server) AppOptions() []AppOption

Global app options that should be applied to apps created by this server

func (*Server) AsymmetricSigningKey

func (s *Server) AsymmetricSigningKey() *ecdsa.PrivateKey

AsymmetricSigningKey will return a private key that can be used for asymmetric signing.

func (*Server) CanIUpgradeToE0

func (s *Server) CanIUpgradeToE0() error

func (*Server) ClientConfigHash

func (s *Server) ClientConfigHash() string

func (*Server) ClientConfigWithComputed

func (s *Server) ClientConfigWithComputed() map[string]string

ClientConfigWithComputed gets the configuration in a format suitable for sending to the client.

func (*Server) ClientLicense

func (s *Server) ClientLicense() map[string]string

func (*Server) ClusterHealthScore

func (s *Server) ClusterHealthScore() int

func (*Server) Config

func (s *Server) Config() *model.Config

func (*Server) DoSecurityUpdateCheck

func (s *Server) DoSecurityUpdateCheck()

func (*Server) EnvironmentConfig

func (s *Server) EnvironmentConfig() map[string]interface{}

func (*Server) FileBackend

func (s *Server) FileBackend() (filesstore.FileBackend, *model.AppError)

func (*Server) GetHubForUserId

func (s *Server) GetHubForUserId(userId string) *Hub

GetHubForUserId returns the hub for a given user id.

func (*Server) GetLogs

func (s *Server) GetLogs(page, perPage int) ([]string, *model.AppError)

func (*Server) GetLogsSkipSend

func (s *Server) GetLogsSkipSend(page, perPage int) ([]string, *model.AppError)

func (*Server) GetMessageForNotification

func (s *Server) GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string

func (*Server) GetPluginStatus

func (s *Server) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)

GetPluginStatus returns the status for a plugin installed on this server.

func (*Server) GetPluginStatuses

func (s *Server) GetPluginStatuses() (model.PluginStatuses, *model.AppError)

GetPluginStatuses returns the status for plugins installed on this server.

func (*Server) GetPluginsEnvironment

func (s *Server) GetPluginsEnvironment() *plugin.Environment

GetPluginsEnvironment returns the plugin environment for use if plugins are enabled and initialized.

To get the plugins environment when the plugins are disabled, manually acquire the plugins lock instead.

func (*Server) GetRoleByName

func (s *Server) GetRoleByName(name string) (*model.Role, *model.AppError)

func (*Server) GetSanitizedClientLicense

func (s *Server) GetSanitizedClientLicense() map[string]string

func (*Server) GetSchemes

func (s *Server) GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError)

func (*Server) Go

func (s *Server) Go(f func())

Go creates a goroutine, but maintains a record of it to ensure that execution completes before the server is shutdown.

func (*Server) HTMLTemplates

func (s *Server) HTMLTemplates() *template.Template

func (*Server) HttpService

func (s *Server) HttpService() httpservice.HTTPService

func (*Server) HubStop

func (s *Server) HubStop()

HubStop stops all the hubs.

func (*Server) InvalidateAllCaches

func (s *Server) InvalidateAllCaches() *model.AppError

func (*Server) InvalidateAllCachesSkipSend

func (s *Server) InvalidateAllCachesSkipSend()

func (*Server) InvokeClusterLeaderChangedListeners

func (s *Server) InvokeClusterLeaderChangedListeners()

func (*Server) IsFirstUserAccount

func (s *Server) IsFirstUserAccount() bool

func (*Server) IsLeader

func (s *Server) IsLeader() bool

func (*Server) IsPhase2MigrationCompleted

func (s *Server) IsPhase2MigrationCompleted() *model.AppError

func (*Server) License

func (s *Server) License() *model.License

func (*Server) LoadLicense

func (s *Server) LoadLicense()

func (*Server) MaxPostSize

func (s *Server) MaxPostSize() int

func (*Server) NewClusterDiscoveryService

func (s *Server) NewClusterDiscoveryService() *ClusterDiscoveryService

func (*Server) PostActionCookieSecret

func (s *Server) PostActionCookieSecret() []byte

func (*Server) Publish

func (s *Server) Publish(message *model.WebSocketEvent)

func (*Server) PublishSkipClusterSend

func (s *Server) PublishSkipClusterSend(message *model.WebSocketEvent)

func (*Server) ReloadConfig

func (s *Server) ReloadConfig() error

func (*Server) RemoveClusterLeaderChangedListener

func (s *Server) RemoveClusterLeaderChangedListener(id string)

Removes a listener function by the unique ID returned when AddConfigListener was called

func (*Server) RemoveConfigListener

func (s *Server) RemoveConfigListener(id string)

Removes a listener function by the unique ID returned when AddConfigListener was called

func (*Server) RemoveLicense

func (s *Server) RemoveLicense() *model.AppError

func (*Server) RemoveLicenseListener

func (s *Server) RemoveLicenseListener(id string)

func (*Server) RequestTrialLicense

func (s *Server) RequestTrialLicense(trialRequest *model.TrialLicenseRequest) *model.AppError

RequestTrialLicense request a trial license from the mattermost offical license server

func (*Server) Restart

func (s *Server) Restart() error

func (*Server) RunJobs

func (s *Server) RunJobs()

func (*Server) SaveConfig

func (s *Server) SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError

SaveConfig replaces the active configuration, optionally notifying cluster peers.

func (*Server) SaveLicense

func (s *Server) SaveLicense(licenseBytes []byte) (*model.License, *model.AppError)

func (*Server) SetClientLicense

func (s *Server) SetClientLicense(m map[string]string)

func (*Server) SetLicense

func (s *Server) SetLicense(license *model.License) bool

func (*Server) SetLog

func (s *Server) SetLog(l *mlog.Logger)

func (*Server) ShutDownPlugins

func (s *Server) ShutDownPlugins()

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start() error

func (*Server) StartSearchEngine

func (s *Server) StartSearchEngine() (string, string)

func (*Server) StopHTTPServer

func (s *Server) StopHTTPServer()

func (*Server) StopPushNotificationsHubWorkers

func (s *Server) StopPushNotificationsHubWorkers()

func (*Server) TelemetryId

func (s *Server) TelemetryId() string

func (*Server) TotalWebsocketConnections

func (s *Server) TotalWebsocketConnections() int

func (*Server) UpdateConfig

func (s *Server) UpdateConfig(f func(*model.Config))

func (*Server) UpgradeToE0

func (s *Server) UpgradeToE0() error

func (*Server) UpgradeToE0Status

func (s *Server) UpgradeToE0Status() (int64, error)

func (*Server) ValidateAndSetLicenseBytes

func (s *Server) ValidateAndSetLicenseBytes(b []byte) bool

func (*Server) WaitForGoroutines

func (s *Server) WaitForGoroutines()

WaitForGoroutines blocks until all goroutines created by App.Go exit.

type TeamImportData

type TeamImportData struct {
	Name            *string `json:"name"`
	DisplayName     *string `json:"display_name"`
	Type            *string `json:"type"`
	Description     *string `json:"description,omitempty"`
	AllowOpenInvite *bool   `json:"allow_open_invite,omitempty"`
	Scheme          *string `json:"scheme,omitempty"`
}

type TokenLocation

type TokenLocation int
const (
	TokenLocationNotFound TokenLocation = iota
	TokenLocationHeader
	TokenLocationCookie
	TokenLocationQueryString
)

func ParseAuthTokenFromRequest

func ParseAuthTokenFromRequest(r *http.Request) (string, TokenLocation)

func (TokenLocation) String

func (tl TokenLocation) String() string

type UploadFileTask

type UploadFileTask struct {
	// File name.
	Name string

	ChannelId string
	TeamId    string
	UserId    string

	// Time stamp to use when creating the file.
	Timestamp time.Time

	// The value of the Content-Length http header, when available.
	ContentLength int64

	// The file data stream.
	Input io.Reader

	// An optional, client-assigned Id field.
	ClientId string

	// If Raw, do not execute special processing for images, just upload
	// the file.  Plugins are still invoked.
	Raw bool
	// contains filtered or unexported fields
}

type UserChannelImportData

type UserChannelImportData struct {
	Name        *string                           `json:"name"`
	Roles       *string                           `json:"roles"`
	NotifyProps *UserChannelNotifyPropsImportData `json:"notify_props,omitempty"`
	Favorite    *bool                             `json:"favorite,omitempty"`
}

func ImportUserChannelDataFromChannelMemberAndPreferences

func ImportUserChannelDataFromChannelMemberAndPreferences(member *model.ChannelMemberForExport, preferences *model.Preferences) *UserChannelImportData

type UserChannelNotifyPropsImportData

type UserChannelNotifyPropsImportData struct {
	Desktop    *string `json:"desktop"`
	Mobile     *string `json:"mobile"`
	MarkUnread *string `json:"mark_unread"`
}

type UserImportData

type UserImportData struct {
	ProfileImage       *string `json:"profile_image,omitempty"`
	Username           *string `json:"username"`
	Email              *string `json:"email"`
	AuthService        *string `json:"auth_service"`
	AuthData           *string `json:"auth_data,omitempty"`
	Password           *string `json:"password,omitempty"`
	Nickname           *string `json:"nickname"`
	FirstName          *string `json:"first_name"`
	LastName           *string `json:"last_name"`
	Position           *string `json:"position"`
	Roles              *string `json:"roles"`
	Locale             *string `json:"locale"`
	UseMarkdownPreview *string `json:"feature_enabled_markdown_preview,omitempty"`
	UseFormatting      *string `json:"formatting,omitempty"`
	ShowUnreadSection  *string `json:"show_unread_section,omitempty"`
	DeleteAt           *int64  `json:"delete_at,omitempty"`

	Teams *[]UserTeamImportData `json:"teams,omitempty"`

	Theme              *string `json:"theme,omitempty"`
	UseMilitaryTime    *string `json:"military_time,omitempty"`
	CollapsePreviews   *string `json:"link_previews,omitempty"`
	MessageDisplay     *string `json:"message_display,omitempty"`
	ChannelDisplayMode *string `json:"channel_display_mode,omitempty"`
	TutorialStep       *string `json:"tutorial_step,omitempty"`
	EmailInterval      *string `json:"email_interval,omitempty"`

	NotifyProps *UserNotifyPropsImportData `json:"notify_props,omitempty"`
}

type UserNotifyPropsImportData

type UserNotifyPropsImportData struct {
	Desktop      *string `json:"desktop"`
	DesktopSound *string `json:"desktop_sound"`

	Email *string `json:"email"`

	Mobile           *string `json:"mobile"`
	MobilePushStatus *string `json:"mobile_push_status"`

	ChannelTrigger  *string `json:"channel"`
	CommentsTrigger *string `json:"comments"`
	MentionKeys     *string `json:"mention_keys"`
}

type UserTeamImportData

type UserTeamImportData struct {
	Name     *string                  `json:"name"`
	Roles    *string                  `json:"roles"`
	Theme    *string                  `json:"theme,omitempty"`
	Channels *[]UserChannelImportData `json:"channels,omitempty"`
}

func ImportUserTeamDataFromTeamMember

func ImportUserTeamDataFromTeamMember(member *model.TeamMemberForExport) *UserTeamImportData

type WebConn

type WebConn struct {
	App       *App
	WebSocket *websocket.Conn
	T         goi18n.TranslateFunc
	Locale    string
	Sequence  int64
	UserId    string
	// contains filtered or unexported fields
}

WebConn represents a single websocket connection to a user. It contains all the necesarry state to manage sending/receiving data to/from a websocket.

func (*WebConn) Close

func (wc *WebConn) Close()

Close closes the WebConn.

func (*WebConn) GetSession

func (wc *WebConn) GetSession() *model.Session

GetSession returns the session of the connection.

func (*WebConn) GetSessionExpiresAt

func (wc *WebConn) GetSessionExpiresAt() int64

GetSessionExpiresAt returns the time at which the session expires.

func (*WebConn) GetSessionToken

func (wc *WebConn) GetSessionToken() string

GetSessionToken returns the session token of the connection.

func (*WebConn) InvalidateCache

func (wc *WebConn) InvalidateCache()

InvalidateCache resets all internal data of the WebConn.

func (*WebConn) IsAuthenticated

func (wc *WebConn) IsAuthenticated() bool

IsAuthenticated returns whether the given WebConn is authenticated or not.

func (*WebConn) Pump

func (wc *WebConn) Pump()

Pump starts the WebConn instance. After this, the websocket is ready to send/receive messages.

func (*WebConn) SetSession

func (wc *WebConn) SetSession(v *model.Session)

SetSession sets the session of the connection.

func (*WebConn) SetSessionExpiresAt

func (wc *WebConn) SetSessionExpiresAt(v int64)

SetSessionExpiresAt sets the time at which the session expires.

func (*WebConn) SetSessionToken

func (wc *WebConn) SetSessionToken(v string)

SetSessionToken sets the session token of the connection.

type WebSocketRouter

type WebSocketRouter struct {
	// contains filtered or unexported fields
}

func (*WebSocketRouter) Handle

func (wr *WebSocketRouter) Handle(action string, handler webSocketHandler)

func (*WebSocketRouter) ServeWebSocket

func (wr *WebSocketRouter) ServeWebSocket(conn *WebConn, r *model.WebSocketRequest)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL