middleware

package
v0.0.0-...-2c08352 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2015 License: MIT Imports: 18 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

This section is empty.

Variables

This section is empty.

Functions

func ApiRepoAssignment

func ApiRepoAssignment() macaron.Handler

func ApiReqBasicAuth

func ApiReqBasicAuth() macaron.Handler

func ApiReqToken

func ApiReqToken() macaron.Handler

func Contexter

func Contexter() macaron.Handler

Contexter initializes a classic context for a request.

func GitHookService

func GitHookService() macaron.Handler

GitHookService checks if repository Git hooks service has been enabled.

func OrgAssignment

func OrgAssignment(redirect bool, args ...bool) macaron.Handler

func RepoAssignment

func RepoAssignment(redirect bool, args ...bool) macaron.Handler

func RepoRef

func RepoRef() macaron.Handler

RepoRef handles repository reference name including those contain `/`.

func RequireAdmin

func RequireAdmin() macaron.Handler

func Toggle

func Toggle(options *ToggleOptions) macaron.Handler

Types

type Context

type Context struct {
	*macaron.Context
	Cache cache.Cache

	Flash   *session.Flash
	Session session.Store

	User        *models.User
	IsSigned    bool
	IsBasicAuth bool

	Repo RepoContext

	Org struct {
		IsOwner      bool
		IsMember     bool
		IsAdminTeam  bool // In owner team or team that has admin permission level.
		Organization *models.User
		OrgLink      string

		Team *models.Team
	}
	// contains filtered or unexported fields
}

Context represents context of a request.

func (*Context) GetErrMsg

func (ctx *Context) GetErrMsg() string

func (*Context) HTML

func (ctx *Context) HTML(status int, name base.TplName)

HTML calls Context.HTML and converts template name to string.

func (*Context) Handle

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

Handle handles and logs error by given status.

func (*Context) HandleAPI

func (ctx *Context) HandleAPI(status int, obj interface{})

func (*Context) HasApiError

func (ctx *Context) HasApiError() bool

HasError returns true if error occurs in form validation.

func (*Context) HasError

func (ctx *Context) HasError() bool

HasError returns true if error occurs in form validation.

func (*Context) RenderWithErr

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

RenderWithErr used for page has form validation but need to prompt error to users.

func (*Context) ServeContent

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

type RepoContext

type RepoContext struct {
	AccessMode   models.AccessMode
	IsWatching   bool
	IsBranch     bool
	IsTag        bool
	IsCommit     bool
	Repository   *models.Repository
	Owner        *models.User
	Commit       *git.Commit
	Tag          *git.Tag
	GitRepo      *git.Repository
	BranchName   string
	TagName      string
	TreeName     string
	CommitId     string
	RepoLink     string
	CloneLink    models.CloneLink
	CommitsCount int
	Mirror       *models.Mirror
}

func (RepoContext) HasAccess

func (r RepoContext) HasAccess() bool

Return if the current user has read access for this repository

func (RepoContext) IsOwner

func (r RepoContext) IsOwner() bool

Return if the current user has write access for this repository

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