middleware

package
v2.0.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2015 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SESS_KEY_USERID    = "uid"
	SESS_KEY_FAVORITES = "favorites"
)

Variables

This section is empty.

Functions

func Auth

func Auth(options *AuthOptions) macaron.Handler

func GetContextHandler

func GetContextHandler() macaron.Handler

func Logger

func Logger() macaron.Handler

Logger returns a middleware handler that logs the request as it goes in and the response as it goes out.

func RoleAuth

func RoleAuth(roles ...m.RoleType) macaron.Handler

Types

type AuthOptions

type AuthOptions struct {
	ReqGrafanaAdmin bool
	ReqSignedIn     bool
}

type Context

type Context struct {
	*macaron.Context
	*m.SignedInUser

	Session session.Store

	IsSignedIn     bool
	AllowAnonymous bool
}

func (*Context) Handle

func (ctx *Context) Handle(status int, title string, err error)

Handle handles and logs error by given status.

func (*Context) IsApiRequest

func (ctx *Context) IsApiRequest() bool

func (*Context) JsonApiErr

func (ctx *Context) JsonApiErr(status int, message string, err error)

func (*Context) JsonOK

func (ctx *Context) JsonOK(message string)

Jump to

Keyboard shortcuts

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