Help us shape the future of Go! Take the 2026 Go Developer Survey

middleware

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRebuild

func IsRebuild(path string) bool

func Options

func Options(c *web.C, h http.Handler) http.Handler

Options automatically return an appropriate "Allow" header when the request method is OPTIONS and the request would have otherwise been 404'd.

func RepoToC

func RepoToC(c *web.C, repo *model.Repo)

RepoToC sets the User in the current web context.

func RequireRepoAdmin

func RequireRepoAdmin(c *web.C, h http.Handler) http.Handler

RequireRepoAdmin is a middleware function that verifies the user has admin access to the repository.

func RequireRepoRead

func RequireRepoRead(c *web.C, h http.Handler) http.Handler

RequireRepoRead is a middleware function that verifies the user has read access to the repository.

func RequireUser

func RequireUser(c *web.C, h http.Handler) http.Handler

RequireUser is a middleware function that verifies there is a currently authenticated user stored in the context.

func RequireUserAdmin

func RequireUserAdmin(c *web.C, h http.Handler) http.Handler

RequireUserAdmin is a middleware function that verifies there is a currently authenticated user stored in the context with ADMIN privilege.

func RoleToC

func RoleToC(c *web.C, role *model.Perm)

RoleToC sets the User in the current web context.

func SetHeaders

func SetHeaders(c *web.C, h http.Handler) http.Handler

SetHeaders is a middleware function that applies default headers and caching rules to each request.

func SetRepo

func SetRepo(c *web.C, h http.Handler) http.Handler

SetRepo is a middleware function that retrieves the repository and stores in the context.

func SetUser

func SetUser(c *web.C, h http.Handler) http.Handler

SetUser is a middleware function that retrieves the currently authenticated user from the request and stores in the context.

func ToRepo

func ToRepo(c *web.C) *model.Repo

ToRepo returns the Repo from the current request context. If the Repo does not exist a nil value is returned.

func ToRole

func ToRole(c *web.C) *model.Perm

ToRole returns the Role from the current request context. If the Role does not exist a nil value is returned.

func ToUser

func ToUser(c *web.C) *model.User

ToUser returns the User from the current request context. If the User does not exist a nil value is returned.

func UserToC

func UserToC(c *web.C, user *model.User)

UserToC sets the User in the current web context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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