{"modulePath":"github.com/mapmeld/codemingler","version":"v0.6.9","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package middleware\n\n## Constants\n\n```go\nconst (\n\tFIREFOX_COPY_SUPPORT = \"41.0\"\n\tCHROME_COPY_SUPPORT  = \"43.0.2356\"\n)\n```\n\n## Functions\n\n```go\nfunc ApiRepoAssignment() macaron.Handler\n```\n\n```go\nfunc ApiReqBasicAuth() macaron.Handler\n```\n\n```go\nfunc ApiReqToken() macaron.Handler\n```\nContexter middleware already checks token for user sign in process.\n\n```go\nfunc AutoSignIn(ctx *Context) (bool, error)\n```\nAutoSignIn reads cookie and try to auto-login.\n\n```go\nfunc Contexter() macaron.Handler\n```\nContexter initializes a classic context for a request.\n\n```go\nfunc GitHookService() macaron.Handler\n```\nGitHookService checks if repository Git hooks service has been enabled.\n\n```go\nfunc OrgAssignment(redirect bool, args ...bool) macaron.Handler\n```\n\n```go\nfunc RepoAssignment(redirect bool, args ...bool) macaron.Handler\n```\n\n```go\nfunc RepoRef() macaron.Handler\n```\nRepoRef handles repository reference name including those contain \\`/\\`.\n\n```go\nfunc RequireRepoAdmin() macaron.Handler\n```\n\n```go\nfunc RetrieveBaseRepo(ctx *Context, repo *models.Repository)\n```\n\n```go\nfunc Toggle(options *ToggleOptions) macaron.Handler\n```\n\n## Types\n\n```go\ntype Context struct {\n\t*macaron.Context\n\tCache cache.Cache\n\n\tFlash   *session.Flash\n\tSession session.Store\n\n\tUser        *models.User\n\tIsSigned    bool\n\tIsBasicAuth bool\n\n\tRepo RepoContext\n\n\tOrg struct {\n\t\tIsOwner      bool\n\t\tIsMember     bool\n\t\tIsAdminTeam  bool // In owner team or team that has admin permission level.\n\t\tOrganization *models.User\n\t\tOrgLink      string\n\n\t\tTeam *models.Team\n\t}\n\t// contains filtered or unexported fields\n}\n```\nContext represents context of a request.\n\n```go\nfunc (ctx *Context) GetErrMsg() string\n```\n\n```go\nfunc (ctx *Context) HTML(status int, name base.TplName)\n```\nHTML calls Context.HTML and converts template name to string.\n\n```go\nfunc (ctx *Context) Handle(status int, title string, err error)\n```\nHandle handles and logs error by given status.\n\n```go\nfunc (ctx *Context) HandleAPI(status int, obj interface{})\n```\n\n```go\nfunc (ctx *Context) HandleText(status int, title string)\n```\n\n```go\nfunc (ctx *Context) HasApiError() bool\n```\nHasError returns true if error occurs in form validation.\n\n```go\nfunc (ctx *Context) HasError() bool\n```\nHasError returns true if error occurs in form validation.\n\n```go\nfunc (ctx *Context) HasValue(name string) bool\n```\nHasValue returns true if value of given name exists.\n\n```go\nfunc (ctx *Context) RenderWithErr(msg string, tpl base.TplName, form interface{})\n```\nRenderWithErr used for page has form validation but need to prompt error to users.\n\n```go\nfunc (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{})\n```\n\n```go\ntype RepoContext struct {\n\tAccessMode   models.AccessMode\n\tIsWatching   bool\n\tIsBranch     bool\n\tIsTag        bool\n\tIsCommit     bool\n\tRepository   *models.Repository\n\tOwner        *models.User\n\tCommit       *git.Commit\n\tTag          *git.Tag\n\tGitRepo      *git.Repository\n\tBranchName   string\n\tTagName      string\n\tTreeName     string\n\tCommitID     string\n\tRepoLink     string\n\tCloneLink    models.CloneLink\n\tCommitsCount int\n\tMirror       *models.Mirror\n}\n```\n\n```go\nfunc (r RepoContext) HasAccess() bool\n```\nReturn if the current user has read access for this repository\n\n```go\nfunc (r RepoContext) IsAdmin() bool\n```\nIsAdmin returns true if current user has admin or higher access of repository.\n\n```go\nfunc (r RepoContext) IsOwner() bool\n```\nIsOwner returns true if current user is the owner of repository.\n\n```go\ntype ToggleOptions struct {\n\tSignInRequire  bool\n\tSignOutRequire bool\n\tAdminRequire   bool\n\tDisableCsrf    bool\n}\n```\n\n","path":"github.com/mapmeld/codemingler/modules/middleware","name":"middleware","synopsis":"","isRedistributable":true}
