Documentation ¶
Index ¶
- Constants
- func CheckClientCompatibility(agentString string) bool
- func CheckWhitelisted(c *Context, r *http.Request) (bool, *model.AppError)
- func GetHandlerName(h func(*Context, http.ResponseWriter, *http.Request)) string
- func Handle404(config configservice.ConfigService, w http.ResponseWriter, r *http.Request)
- func IsApiCall(config configservice.ConfigService, r *http.Request) bool
- func IsOAuthApiCall(config configservice.ConfigService, r *http.Request) bool
- func IsWebhookCall(a app.AppIface, r *http.Request) bool
- func NewInvalidParamError(parameter string) *model.AppError
- func NewInvalidUrlParamError(parameter string) *model.AppError
- func NewServerBusyError() *model.AppError
- func ReturnStatusOK(w http.ResponseWriter)
- type Browser
- type Context
- func (c *Context) ExtendSessionExpiryIfNeeded(w http.ResponseWriter, r *http.Request)
- func (c *Context) GetSiteURLHeader() string
- func (c *Context) HandleEtag(etag string, routeName string, w http.ResponseWriter, r *http.Request) bool
- func (c *Context) IsSystemAdmin() bool
- func (c *Context) LogAudit(extraInfo string)
- func (c *Context) LogAuditRec(rec *audit.Record)
- func (c *Context) LogAuditRecWithLevel(rec *audit.Record, level mlog.LogLevel)
- func (c *Context) LogAuditWithUserId(userId, extraInfo string)
- func (c *Context) LogDebug(err *model.AppError)
- func (c *Context) LogError(err *model.AppError)
- func (c *Context) LogInfo(err *model.AppError)
- func (c *Context) MakeAuditRecord(event string, initialStatus string) *audit.Record
- func (c *Context) MfaRequired()
- func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)
- func (c *Context) RequireAppId() *Context
- func (c *Context) RequireBotUserId() *Context
- func (c *Context) RequireCategory() *Context
- func (c *Context) RequireCategoryId() *Context
- func (c *Context) RequireChannelId() *Context
- func (c *Context) RequireChannelName() *Context
- func (c *Context) RequireCommandId() *Context
- func (c *Context) RequireEmojiId() *Context
- func (c *Context) RequireEmojiName() *Context
- func (c *Context) RequireFileId() *Context
- func (c *Context) RequireFilename() *Context
- func (c *Context) RequireGroupId() *Context
- func (c *Context) RequireHookId() *Context
- func (c *Context) RequireInviteId() *Context
- func (c *Context) RequireInvoiceId() *Context
- func (c *Context) RequireJobId() *Context
- func (c *Context) RequireJobType() *Context
- func (c *Context) RequirePluginId() *Context
- func (c *Context) RequirePostId() *Context
- func (c *Context) RequirePreferenceName() *Context
- func (c *Context) RequireRemoteId() *Context
- func (c *Context) RequireReportId() *Context
- func (c *Context) RequireRoleId() *Context
- func (c *Context) RequireRoleName() *Context
- func (c *Context) RequireSchemeId() *Context
- func (c *Context) RequireService() *Context
- func (c *Context) RequireSyncableId() *Context
- func (c *Context) RequireSyncableType() *Context
- func (c *Context) RequireTeamId() *Context
- func (c *Context) RequireTeamName() *Context
- func (c *Context) RequireThreadId() *Context
- func (c *Context) RequireTimestamp() *Context
- func (c *Context) RequireTokenId() *Context
- func (c *Context) RequireUploadId() *Context
- func (c *Context) RequireUserId() *Context
- func (c *Context) RequireUsername() *Context
- func (c *Context) SanitizeEmail() *Context
- func (c *Context) SessionRequired()
- func (c *Context) SetCommandNotFoundError()
- func (c *Context) SetInvalidParam(parameter string)
- func (c *Context) SetInvalidUrlParam(parameter string)
- func (c *Context) SetPermissionError(permissions ...*model.Permission)
- func (c *Context) SetServerBusyError()
- func (c *Context) SetSiteURLHeader(url string)
- type Handler
- type MattermostApp
- type Params
- type SystemBrowser
- type Web
- func (w *Web) ApiHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (w *Web) ApiHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (w *Web) ApiSessionRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (w *Web) InitOAuth()
- func (w *Web) InitSaml()
- func (w *Web) InitStatic()
- func (w *Web) InitWebhooks()
- func (w *Web) NewHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (w *Web) NewStaticHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
Constants ¶
const ( PAGE_DEFAULT = 0 PER_PAGE_DEFAULT = 60 PER_PAGE_MAXIMUM = 200 LOGS_PER_PAGE_DEFAULT = 10000 LOGS_PER_PAGE_MAXIMUM = 10000 LIMIT_DEFAULT = 60 LIMIT_MAXIMUM = 200 )
Variables ¶
This section is empty.
Functions ¶
func GetHandlerName ¶
func Handle404 ¶
func Handle404(config configservice.ConfigService, w http.ResponseWriter, r *http.Request)
func IsApiCall ¶
func IsApiCall(config configservice.ConfigService, r *http.Request) bool
func IsOAuthApiCall ¶
func IsOAuthApiCall(config configservice.ConfigService, r *http.Request) bool
func NewInvalidParamError ¶
func NewInvalidUrlParamError ¶
func NewServerBusyError ¶
func ReturnStatusOK ¶
func ReturnStatusOK(w http.ResponseWriter)
Types ¶
type Browser ¶
type Browser struct { LogoSrc string Title string SupportedVersionString string Src string GetLatestString string }
Browser describes a browser with a download link
type Context ¶
type Context struct { App app.AppIface Log *mlog.Logger Params *Params Err *model.AppError // contains filtered or unexported fields }
func (*Context) ExtendSessionExpiryIfNeeded ¶
func (c *Context) ExtendSessionExpiryIfNeeded(w http.ResponseWriter, r *http.Request)
ExtendSessionExpiryIfNeeded will update Session.ExpiresAt based on session lengths in config. Session cookies will be resent to the client with updated max age.
func (*Context) GetSiteURLHeader ¶
func (*Context) HandleEtag ¶
func (*Context) IsSystemAdmin ¶
func (*Context) LogAuditRec ¶
LogAuditRec logs an audit record using default LevelAPI.
func (*Context) LogAuditRecWithLevel ¶
LogAuditRec logs an audit record using specified Level. If the context is flagged with a permissions error then `level` is ignored and the audit record is emitted with `LevelPerms`.
func (*Context) LogAuditWithUserId ¶
func (*Context) MakeAuditRecord ¶
MakeAuditRecord creates a audit record pre-populated with data from this context.
func (*Context) MfaRequired ¶
func (c *Context) MfaRequired()
func (*Context) RemoveSessionCookie ¶
func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)
func (*Context) RequireAppId ¶
func (*Context) RequireBotUserId ¶
func (*Context) RequireCategory ¶
func (*Context) RequireCategoryId ¶
func (*Context) RequireChannelId ¶
func (*Context) RequireChannelName ¶
func (*Context) RequireCommandId ¶
func (*Context) RequireEmojiId ¶
func (*Context) RequireEmojiName ¶
func (*Context) RequireFileId ¶
func (*Context) RequireFilename ¶
func (*Context) RequireGroupId ¶
func (*Context) RequireHookId ¶
func (*Context) RequireInviteId ¶
func (*Context) RequireInvoiceId ¶
func (*Context) RequireJobId ¶
func (*Context) RequireJobType ¶
func (*Context) RequirePluginId ¶
func (*Context) RequirePostId ¶
func (*Context) RequirePreferenceName ¶
func (*Context) RequireRemoteId ¶
func (*Context) RequireReportId ¶
func (*Context) RequireRoleId ¶
func (*Context) RequireRoleName ¶
func (*Context) RequireSchemeId ¶
func (*Context) RequireService ¶
func (*Context) RequireSyncableId ¶
func (*Context) RequireSyncableType ¶
func (*Context) RequireTeamId ¶
func (*Context) RequireTeamName ¶
func (*Context) RequireThreadId ¶
func (*Context) RequireTimestamp ¶
func (*Context) RequireTokenId ¶
func (*Context) RequireUploadId ¶
func (*Context) RequireUserId ¶
func (*Context) RequireUsername ¶
func (*Context) SanitizeEmail ¶
func (*Context) SessionRequired ¶
func (c *Context) SessionRequired()
func (*Context) SetCommandNotFoundError ¶
func (c *Context) SetCommandNotFoundError()
func (*Context) SetInvalidParam ¶
func (*Context) SetInvalidUrlParam ¶
func (*Context) SetPermissionError ¶
func (c *Context) SetPermissionError(permissions ...*model.Permission)
func (*Context) SetServerBusyError ¶
func (c *Context) SetServerBusyError()
func (*Context) SetSiteURLHeader ¶
type Handler ¶
type MattermostApp ¶
type MattermostApp struct { LogoSrc string Title string SupportedVersionString string Label string Link string InstallGuide string InstallGuideLink string }
MattermostApp describes downloads for the Mattermost App
type Params ¶
type Params struct { UserId string TeamId string InviteId string TokenId string ThreadId string Timestamp int64 ChannelId string PostId string FileId string Filename string UploadId string PluginId string CommandId string HookId string ReportId string EmojiId string AppId string Email string Username string TeamName string ChannelName string PreferenceName string EmojiName string Category string Service string JobId string JobType string ActionId string RoleId string RoleName string SchemeId string Scope string GroupId string Page int PerPage int LogsPerPage int Permanent bool RemoteId string SyncableId string SyncableType model.GroupSyncableType BotUserId string Q string IsLinked *bool IsConfigured *bool NotAssociatedToTeam string NotAssociatedToChannel string Paginate *bool IncludeMemberCount bool NotAssociatedToGroup string ExcludeDefaultChannels bool LimitAfter int LimitBefore int GroupIDs string IncludeTotalCount bool IncludeDeleted bool FilterAllowReference bool FilterParentTeamPermitted bool CategoryId string WarnMetricId string // Cloud InvoiceId string }
func ParamsFromRequest ¶
type SystemBrowser ¶
type SystemBrowser struct { LogoSrc string Title string SupportedVersionString string LabelOpen string LinkOpen string LinkMakeDefault string OrString string MakeDefaultString string }
SystemBrowser describes a browser but includes 2 links: one to open the local browser, and one to make it default
type Web ¶
type Web struct { GetGlobalAppOptions app.AppOptionCreator ConfigService configservice.ConfigService MainRouter *mux.Router }
func New ¶
func New(config configservice.ConfigService, globalOptions app.AppOptionCreator, root *mux.Router) *Web
func (*Web) ApiHandler ¶
ApiHandler provides a handler for API endpoints which do not require the user to be logged in order for access to be granted.
func (*Web) ApiHandlerTrustRequester ¶
func (w *Web) ApiHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
ApiHandlerTrustRequester provides a handler for API endpoints which do not require the user to be logged in and are allowed to be requested directly rather than via javascript/XMLHttpRequest, such as site branding images or the websocket.
func (*Web) ApiSessionRequired ¶
ApiSessionRequired provides a handler for API endpoints which require the user to be logged in in order for access to be granted.
func (*Web) InitStatic ¶
func (w *Web) InitStatic()
func (*Web) InitWebhooks ¶
func (w *Web) InitWebhooks()