web

package
v6.0.0-...-cfe9101 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0, Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PageDefault        = 0
	PerPageDefault     = 60
	PerPageMaximum     = 200
	LogsPerPageDefault = 10000
	LogsPerPageMaximum = 10000
	LimitDefault       = 60
	LimitMaximum       = 200
)

Variables

This section is empty.

Functions

func CheckClientCompatibility

func CheckClientCompatibility(agentString string) bool

func GetHandlerName

func GetHandlerName(h func(*Context, http.ResponseWriter, *http.Request)) string

func Handle404

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

func IsAPICall

func IsAPICall(a app.AppIface, r *http.Request) bool

func IsOAuthAPICall

func IsOAuthAPICall(a app.AppIface, r *http.Request) bool

func IsWebhookCall

func IsWebhookCall(a app.AppIface, r *http.Request) bool

func NewInvalidParamError

func NewInvalidParamError(parameter string) *model.AppError

func NewInvalidRemoteClusterTokenError

func NewInvalidRemoteClusterTokenError() *model.AppError

func NewInvalidRemoteIdError

func NewInvalidRemoteIdError(parameter string) *model.AppError

func NewInvalidURLParamError

func NewInvalidURLParamError(parameter string) *model.AppError

func NewJSONEncodingError

func NewJSONEncodingError() *model.AppError

func NewServerBusyError

func NewServerBusyError() *model.AppError

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
	AppContext *request.Context
	Logger     *mlog.Logger
	Params     *Params
	Err        *model.AppError
	// contains filtered or unexported fields
}

func (*Context) CloudKeyRequired

func (c *Context) CloudKeyRequired()

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

func (c *Context) GetRemoteID(r *http.Request) string

func (*Context) GetSiteURLHeader

func (c *Context) GetSiteURLHeader() string

func (*Context) HandleEtag

func (c *Context) HandleEtag(etag string, routeName string, w http.ResponseWriter, r *http.Request) bool

func (*Context) IsSystemAdmin

func (c *Context) IsSystemAdmin() bool

func (*Context) LogAudit

func (c *Context) LogAudit(extraInfo string)

func (*Context) LogAuditRec

func (c *Context) LogAuditRec(rec *audit.Record)

LogAuditRec logs an audit record using default LevelAPI.

func (*Context) LogAuditRecWithLevel

func (c *Context) LogAuditRecWithLevel(rec *audit.Record, level mlog.Level)

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 (c *Context) LogAuditWithUserId(userId, extraInfo string)

func (*Context) LogErrorByCode

func (c *Context) LogErrorByCode(err *model.AppError)

func (*Context) MakeAuditRecord

func (c *Context) MakeAuditRecord(event string, initialStatus string) *audit.Record

MakeAuditRecord creates a audit record pre-populated with data from this context.

func (*Context) MfaRequired

func (c *Context) MfaRequired()

func (*Context) RemoteClusterTokenRequired

func (c *Context) RemoteClusterTokenRequired()

func (*Context) RemoveSessionCookie

func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)

func (*Context) RequireAppId

func (c *Context) RequireAppId() *Context

func (*Context) RequireBotUserId

func (c *Context) RequireBotUserId() *Context

func (*Context) RequireCategory

func (c *Context) RequireCategory() *Context

func (*Context) RequireCategoryId

func (c *Context) RequireCategoryId() *Context

func (*Context) RequireChannelId

func (c *Context) RequireChannelId() *Context

func (*Context) RequireChannelName

func (c *Context) RequireChannelName() *Context

func (*Context) RequireCommandId

func (c *Context) RequireCommandId() *Context

func (*Context) RequireEmojiId

func (c *Context) RequireEmojiId() *Context

func (*Context) RequireEmojiName

func (c *Context) RequireEmojiName() *Context

func (*Context) RequireFileId

func (c *Context) RequireFileId() *Context

func (*Context) RequireFilename

func (c *Context) RequireFilename() *Context

func (*Context) RequireGroupId

func (c *Context) RequireGroupId() *Context

func (*Context) RequireHookId

func (c *Context) RequireHookId() *Context

func (*Context) RequireInviteId

func (c *Context) RequireInviteId() *Context

func (*Context) RequireInvoiceId

func (c *Context) RequireInvoiceId() *Context

func (*Context) RequireJobId

func (c *Context) RequireJobId() *Context

func (*Context) RequireJobType

func (c *Context) RequireJobType() *Context

func (*Context) RequirePluginId

func (c *Context) RequirePluginId() *Context

func (*Context) RequirePolicyId

func (c *Context) RequirePolicyId() *Context

func (*Context) RequirePostId

func (c *Context) RequirePostId() *Context

func (*Context) RequirePreferenceName

func (c *Context) RequirePreferenceName() *Context

func (*Context) RequireRemoteId

func (c *Context) RequireRemoteId() *Context

func (*Context) RequireReportId

func (c *Context) RequireReportId() *Context

func (*Context) RequireRoleId

func (c *Context) RequireRoleId() *Context

func (*Context) RequireRoleName

func (c *Context) RequireRoleName() *Context

func (*Context) RequireSchemeId

func (c *Context) RequireSchemeId() *Context

func (*Context) RequireService

func (c *Context) RequireService() *Context

func (*Context) RequireSyncableId

func (c *Context) RequireSyncableId() *Context

func (*Context) RequireSyncableType

func (c *Context) RequireSyncableType() *Context

func (*Context) RequireTeamId

func (c *Context) RequireTeamId() *Context

func (*Context) RequireTeamName

func (c *Context) RequireTeamName() *Context

func (*Context) RequireThreadId

func (c *Context) RequireThreadId() *Context

func (*Context) RequireTimeRange

func (c *Context) RequireTimeRange() *Context

func (*Context) RequireTimestamp

func (c *Context) RequireTimestamp() *Context

func (*Context) RequireTokenId

func (c *Context) RequireTokenId() *Context

func (*Context) RequireUploadId

func (c *Context) RequireUploadId() *Context

func (*Context) RequireUserId

func (c *Context) RequireUserId() *Context

func (*Context) RequireUsername

func (c *Context) RequireUsername() *Context

func (*Context) SanitizeEmail

func (c *Context) SanitizeEmail() *Context

func (*Context) SessionRequired

func (c *Context) SessionRequired()

func (*Context) SetCommandNotFoundError

func (c *Context) SetCommandNotFoundError()

func (*Context) SetInvalidParam

func (c *Context) SetInvalidParam(parameter string)

func (*Context) SetInvalidRemoteClusterTokenError

func (c *Context) SetInvalidRemoteClusterTokenError()

func (*Context) SetInvalidRemoteIdError

func (c *Context) SetInvalidRemoteIdError(id string)

func (*Context) SetInvalidURLParam

func (c *Context) SetInvalidURLParam(parameter string)

func (*Context) SetJSONEncodingError

func (c *Context) SetJSONEncodingError()

func (*Context) SetPermissionError

func (c *Context) SetPermissionError(permissions ...*model.Permission)

func (*Context) SetServerBusyError

func (c *Context) SetServerBusyError()

func (*Context) SetSiteURLHeader

func (c *Context) SetSiteURLHeader(url string)

type Handler

type Handler struct {
	Srv                       *app.Server
	HandleFunc                func(*Context, http.ResponseWriter, *http.Request)
	HandlerName               string
	RequireSession            bool
	RequireCloudKey           bool
	RequireRemoteClusterToken bool
	TrustRequester            bool
	RequireMfa                bool
	IsStatic                  bool
	IsLocal                   bool
	DisableWhenBusy           bool
	// contains filtered or unexported fields
}

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

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
	TimeRange                 int64
	ChannelId                 string
	PostId                    string
	PolicyId                  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
	ExportName                string
	ExcludePolicyConstrained  bool
	GroupSource               model.GroupSource
	FilterHasMember           string

	// Cloud
	InvoiceId string
}

func ParamsFromRequest

func ParamsFromRequest(r *http.Request) *Params

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 {
	MainRouter *mux.Router
	// contains filtered or unexported fields
}

func New

func New(srv *app.Server) *Web

func (*Web) APIHandler

func (w *Web) APIHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

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

func (w *Web) APISessionRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

APISessionRequired provides a handler for API endpoints which require the user to be logged in in order for access to be granted.

func (*Web) InitOAuth

func (w *Web) InitOAuth()

func (*Web) InitSaml

func (w *Web) InitSaml()

func (*Web) InitStatic

func (w *Web) InitStatic()

func (*Web) InitWebhooks

func (w *Web) InitWebhooks()

func (*Web) NewHandler

func (w *Web) NewHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

func (*Web) NewStaticHandler

func (w *Web) NewStaticHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL