Documentation ¶
Index ¶
- Constants
- Variables
- func CanManageChannel(c *Context, channel *model.Channel) bool
- func GenerateTestTeamName() string
- func GetAllTeamListings(c *Context, w http.ResponseWriter, r *http.Request)
- func Handle404(a *app.App, w http.ResponseWriter, r *http.Request)
- func IsApiCall(r *http.Request) bool
- func Logout(c *Context, w http.ResponseWriter, r *http.Request)
- func NewInvalidParamError(where string, name string) *model.AppError
- func ReturnStatusOK(w http.ResponseWriter)
- func StopTestStore()
- func UseTestStore(container *storetest.RunningContainer, settings *model.SqlSettings)
- type API
- func (api *API) ApiAdminSystemRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiAdminSystemRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiAppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiAppHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiAppHandlerTrustRequesterIndependent(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiUserRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiUserRequiredActivity(h func(*Context, http.ResponseWriter, *http.Request), isUserActivity bool) http.Handler
- func (api *API) ApiUserRequiredMfa(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiUserRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) AppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) AppHandlerIndependent(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) AppHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) Handle404(w http.ResponseWriter, r *http.Request)
- func (api *API) InitAdmin()
- func (api *API) InitChannel()
- func (api *API) InitCommand()
- func (api *API) InitEmoji()
- func (api *API) InitFile()
- func (api *API) InitGeneral()
- func (api *API) InitLicense()
- func (api *API) InitOAuth()
- func (api *API) InitPost()
- func (api *API) InitPreference()
- func (api *API) InitReaction()
- func (api *API) InitStatus()
- func (api *API) InitTeam()
- func (api *API) InitUser()
- func (api *API) InitWebSocket()
- func (api *API) InitWebhook()
- func (api *API) InitWebrtc()
- func (api *API) UserRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- type Context
- func (c *Context) CheckTeamId()
- func (c *Context) GetSiteURLHeader() string
- func (c *Context) GetTeamURL() 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) LogAuditWithUserId(userId, extraInfo string)
- func (c *Context) LogDebug(err *model.AppError)
- func (c *Context) LogError(err *model.AppError)
- func (c *Context) MfaRequired()
- func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)
- func (c *Context) SetInvalidParam(where string, name string)
- func (c *Context) SetPermissionError(permission *model.Permission)
- func (c *Context) SetSiteURLHeader(url string)
- func (c *Context) SetTeamURLFromSession()
- func (c *Context) SystemAdminRequired()
- func (c *Context) UserRequired()
- type Routes
- type TestHelper
- func (me *TestHelper) AddPermissionToRole(permission string, roleName string)
- func (me *TestHelper) CreateChannel(client *model.Client, team *model.Team) *model.Channel
- func (me *TestHelper) CreateClient() *model.Client
- func (me *TestHelper) CreatePinnedPost(client *model.Client, channel *model.Channel) *model.Post
- func (me *TestHelper) CreatePost(client *model.Client, channel *model.Channel) *model.Post
- func (me *TestHelper) CreatePrivateChannel(client *model.Client, team *model.Team) *model.Channel
- func (me *TestHelper) CreateTeam(client *model.Client) *model.Team
- func (me *TestHelper) CreateUser(client *model.Client) *model.User
- func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError)
- func (me *TestHelper) GenerateTestEmail() string
- func (me *TestHelper) InitBasic() *TestHelper
- func (me *TestHelper) InitSystemAdmin() *TestHelper
- func (me *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)
- func (me *TestHelper) LoginBasic()
- func (me *TestHelper) LoginBasic2()
- func (me *TestHelper) LoginSystemAdmin()
- func (me *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)
- func (me *TestHelper) MakeUserChannelUser(user *model.User, channel *model.Channel)
- func (me *TestHelper) RemovePermissionFromRole(permission string, roleName string)
- func (me *TestHelper) RestoreDefaultRolePermissions(data map[string][]string)
- func (me *TestHelper) SaveDefaultRolePermissions() map[string][]string
- func (me *TestHelper) TearDown()
- func (me *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
- func (me *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
Constants ¶
View Source
const ( PREVIEW_IMAGE_TYPE = "image/jpeg" THUMBNAIL_IMAGE_TYPE = "image/jpeg" )
View Source
const OPEN_GRAPH_METADATA_CACHE_SIZE = 10000
Variables ¶
View Source
var UNSAFE_CONTENT_TYPES = [...]string{
"application/javascript",
"application/ecmascript",
"text/javascript",
"text/ecmascript",
"application/x-javascript",
"text/html",
}
Functions ¶
func GenerateTestTeamName ¶
func GenerateTestTeamName() string
func GetAllTeamListings ¶
func GetAllTeamListings(c *Context, w http.ResponseWriter, r *http.Request)
func ReturnStatusOK ¶
func ReturnStatusOK(w http.ResponseWriter)
func StopTestStore ¶
func StopTestStore()
func UseTestStore ¶
func UseTestStore(container *storetest.RunningContainer, settings *model.SqlSettings)
UseTestStore sets the container and corresponding settings to use for tests. Once the tests are complete (e.g. at the end of your TestMain implementation), you should call StopTestStore.
Types ¶
type API ¶
func (*API) ApiAdminSystemRequired ¶
func (*API) ApiAdminSystemRequiredTrustRequester ¶
func (*API) ApiAppHandler ¶
func (*API) ApiAppHandlerTrustRequester ¶
func (*API) ApiAppHandlerTrustRequesterIndependent ¶
func (*API) ApiUserRequired ¶
func (*API) ApiUserRequiredActivity ¶
func (*API) ApiUserRequiredMfa ¶
func (*API) ApiUserRequiredTrustRequester ¶
func (*API) AppHandler ¶
func (*API) AppHandlerIndependent ¶
func (*API) AppHandlerTrustRequester ¶
func (*API) InitChannel ¶
func (api *API) InitChannel()
func (*API) InitCommand ¶
func (api *API) InitCommand()
func (*API) InitGeneral ¶
func (api *API) InitGeneral()
func (*API) InitLicense ¶
func (api *API) InitLicense()
func (*API) InitPreference ¶
func (api *API) InitPreference()
func (*API) InitReaction ¶
func (api *API) InitReaction()
func (*API) InitStatus ¶
func (api *API) InitStatus()
func (*API) InitWebSocket ¶
func (api *API) InitWebSocket()
func (*API) InitWebhook ¶
func (api *API) InitWebhook()
func (*API) InitWebrtc ¶
func (api *API) InitWebrtc()
func (*API) UserRequired ¶
type Context ¶
type Context struct { App *app.App Session model.Session RequestId string IpAddress string Path string Err *model.AppError T goi18n.TranslateFunc Locale string TeamId string // contains filtered or unexported fields }
func (*Context) CheckTeamId ¶
func (c *Context) CheckTeamId()
func (*Context) GetSiteURLHeader ¶
func (*Context) GetTeamURL ¶
func (*Context) HandleEtag ¶
func (*Context) IsSystemAdmin ¶
func (*Context) LogAuditWithUserId ¶
func (*Context) MfaRequired ¶
func (c *Context) MfaRequired()
func (*Context) RemoveSessionCookie ¶
func (c *Context) RemoveSessionCookie(w http.ResponseWriter, r *http.Request)
func (*Context) SetInvalidParam ¶
func (*Context) SetPermissionError ¶
func (c *Context) SetPermissionError(permission *model.Permission)
func (*Context) SetSiteURLHeader ¶
func (*Context) SetTeamURLFromSession ¶
func (c *Context) SetTeamURLFromSession()
func (*Context) SystemAdminRequired ¶
func (c *Context) SystemAdminRequired()
func (*Context) UserRequired ¶
func (c *Context) UserRequired()
type Routes ¶
type Routes struct { Root *mux.Router // ” ApiRoot *mux.Router // 'api/v3' Users *mux.Router // 'api/v3/users' NeedUser *mux.Router // 'api/v3/users/{user_id:[A-Za-z0-9]+}' Teams *mux.Router // 'api/v3/teams' NeedTeam *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}' Channels *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels' NeedChannel *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}' NeedChannelName *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}' Posts *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}/posts' NeedPost *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}/posts/{post_id:[A-Za-z0-9]+}' Commands *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/commands' Hooks *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/hooks' TeamFiles *mux.Router // 'api/v3/teams/{team_id:[A-Za-z0-9]+}/files' Files *mux.Router // 'api/v3/files' NeedFile *mux.Router // 'api/v3/files/{file_id:[A-Za-z0-9]+}' OAuth *mux.Router // 'api/v3/oauth' Admin *mux.Router // 'api/v3/admin' General *mux.Router // 'api/v3/general' Preferences *mux.Router // 'api/v3/preferences' License *mux.Router // 'api/v3/license' Public *mux.Router // 'api/v3/public' Emoji *mux.Router // 'api/v3/emoji' Webrtc *mux.Router // 'api/v3/webrtc' }
type TestHelper ¶
type TestHelper struct { App *app.App BasicClient *model.Client BasicTeam *model.Team BasicUser *model.User BasicUser2 *model.User BasicChannel *model.Channel BasicPost *model.Post PinnedPost *model.Post SystemAdminClient *model.Client SystemAdminTeam *model.Team SystemAdminUser *model.User SystemAdminChannel *model.Channel // contains filtered or unexported fields }
func Setup ¶
func Setup() *TestHelper
func SetupEnterprise ¶
func SetupEnterprise() *TestHelper
func (*TestHelper) AddPermissionToRole ¶
func (me *TestHelper) AddPermissionToRole(permission string, roleName string)
func (*TestHelper) CreateChannel ¶
func (*TestHelper) CreateClient ¶
func (me *TestHelper) CreateClient() *model.Client
func (*TestHelper) CreatePinnedPost ¶
func (*TestHelper) CreatePost ¶
func (*TestHelper) CreatePrivateChannel ¶
func (*TestHelper) CreateTeam ¶
func (me *TestHelper) CreateTeam(client *model.Client) *model.Team
func (*TestHelper) CreateUser ¶
func (me *TestHelper) CreateUser(client *model.Client) *model.User
func (*TestHelper) CreateWebSocketClient ¶
func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError)
func (*TestHelper) GenerateTestEmail ¶
func (me *TestHelper) GenerateTestEmail() string
func (*TestHelper) InitBasic ¶
func (me *TestHelper) InitBasic() *TestHelper
func (*TestHelper) InitSystemAdmin ¶
func (me *TestHelper) InitSystemAdmin() *TestHelper
func (*TestHelper) LinkUserToTeam ¶
func (me *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)
func (*TestHelper) LoginBasic ¶
func (me *TestHelper) LoginBasic()
func (*TestHelper) LoginBasic2 ¶
func (me *TestHelper) LoginBasic2()
func (*TestHelper) LoginSystemAdmin ¶
func (me *TestHelper) LoginSystemAdmin()
func (*TestHelper) MakeUserChannelAdmin ¶
func (me *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)
func (*TestHelper) MakeUserChannelUser ¶
func (me *TestHelper) MakeUserChannelUser(user *model.User, channel *model.Channel)
func (*TestHelper) RemovePermissionFromRole ¶
func (me *TestHelper) RemovePermissionFromRole(permission string, roleName string)
func (*TestHelper) RestoreDefaultRolePermissions ¶
func (me *TestHelper) RestoreDefaultRolePermissions(data map[string][]string)
func (*TestHelper) SaveDefaultRolePermissions ¶
func (me *TestHelper) SaveDefaultRolePermissions() map[string][]string
func (*TestHelper) TearDown ¶
func (me *TestHelper) TearDown()
func (*TestHelper) UpdateUserToNonTeamAdmin ¶
func (me *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
func (*TestHelper) UpdateUserToTeamAdmin ¶
func (me *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
Click to show internal directories.
Click to hide internal directories.