context

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2017 License: MIT Imports: 19 Imported by: 12

Documentation

Index

Constants

View Source
const (
	TOKEN_TYPE_AUTH = iota
	TOKEN_TYPE_ACCESS
)

Variables

This section is empty.

Functions

func APIContexter

func APIContexter() macaron.Handler

func APIToggle

func APIToggle(options *ToggleOptions) macaron.Handler

func Contexter

func Contexter() macaron.Handler

func HTMLContexter

func HTMLContexter() macaron.Handler

func InitContextConfig

func InitContextConfig(reverseProxyAuthAble, installLock, registerEmailConfirmAble, registrationDisabled bool, tokenCacheTimeOut, attachmentMaxSize int64, subUrl, reverseProxyAuthUserName string)

func IsAPIPath

func IsAPIPath(url string) bool

func Toggle

func Toggle(options *ToggleOptions) macaron.Handler

Types

type APIContext

type APIContext struct {
	*Context
}

func (*APIContext) Auth

func (ctx *APIContext) Auth()

func (*APIContext) Error

func (ctx *APIContext) Error(obj interface{})

func (*APIContext) GetToken

func (ctx *APIContext) GetToken() string

func (*APIContext) JSON

func (ctx *APIContext) JSON(status int, obj interface{})

type Context

type Context struct {
	*macaron.Context
	Cache       cache.Cache
	User        *model.User
	SignError   error
	IsSigned    bool
	IsBasicAuth bool
}

func (*Context) Auth

func (ctx *Context) Auth()

func (*Context) Handle

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

func (*Context) Query

func (ctx *Context) Query(name string) string

func (*Context) ServeContent

func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{})

func (*Context) ServeFile

func (ctx *Context) ServeFile(file string, names ...string)

type HTMLContext

type HTMLContext struct {
	*Context

	Flash   *session.Flash
	Session session.Store
	// contains filtered or unexported fields
}

func (*HTMLContext) Auth

func (ctx *HTMLContext) Auth()

func (*HTMLContext) GetErrMsg

func (ctx *HTMLContext) GetErrMsg() string

func (*HTMLContext) HTML

func (ctx *HTMLContext) HTML(status int, name infrastructure.TplName)

func (*HTMLContext) Handle

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

func (*HTMLContext) HasError

func (ctx *HTMLContext) HasError() bool

func (*HTMLContext) RenderWithErr

func (ctx *HTMLContext) RenderWithErr(msg string, tpl infrastructure.TplName, form interface{})

type ToggleOptions

type ToggleOptions struct {
	SignInRequire  bool
	SignOutRequire bool
	AdminRequire   bool
	DisableCSRF    bool
}

Jump to

Keyboard shortcuts

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