Documentation ¶
Index ¶
- func APIContexter() macaron.Handler
- func CheckUnit(unitType models.UnitType) macaron.Handler
- func Contexter() macaron.Handler
- func GitHookService() macaron.Handler
- func HandleOrgAssignment(ctx *Context, args ...bool)
- func LoadRepoUnits() macaron.Handler
- func OrgAssignment(args ...bool) macaron.Handler
- func RedirectToRepo(ctx *Context, redirectRepoID int64)
- func ReferencesGitRepo() macaron.Handler
- func RepoAssignment() macaron.Handler
- func RepoRef() macaron.Handler
- func RequireRepoAdmin() macaron.Handler
- func RequireRepoWriter() macaron.Handler
- func RetrieveBaseRepo(ctx *Context, repo *models.Repository)
- func Toggle(options *ToggleOptions) macaron.Handler
- func UnitTypes() macaron.Handler
- type APIContext
- type APIEmpty
- type APIError
- type APIForbiddenError
- type APINotFound
- type APIOrganization
- type APIRedirect
- type APIValidationError
- type Context
- func (ctx *Context) GetErrMsg() string
- func (ctx *Context) HTML(status int, name base.TplName)
- func (ctx *Context) Handle(status int, title string, err error)
- func (ctx *Context) HandleText(status int, title string)
- func (ctx *Context) HasAPIError() bool
- func (ctx *Context) HasError() bool
- func (ctx *Context) HasValue(name string) bool
- func (ctx *Context) NotFoundOrServerError(title string, errck func(error) bool, err error)
- func (ctx *Context) RenderWithErr(msg string, tpl base.TplName, form interface{})
- func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{})
- type Organization
- type PullRequest
- type Repository
- func (r *Repository) CanCommitToBranch() (bool, error)
- func (r *Repository) CanEnableEditor() bool
- func (r *Repository) GetEditorconfig() (*editorconfig.Editorconfig, error)
- func (r *Repository) HasAccess() bool
- func (r *Repository) IsAdmin() bool
- func (r *Repository) IsOwner() bool
- func (r *Repository) IsWriter() bool
- type ToggleOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIContexter ¶
APIContexter returns apicontext as macaron middleware
func GitHookService ¶
GitHookService checks if repository Git hooks service has been enabled.
func HandleOrgAssignment ¶
HandleOrgAssignment handles organization assignment
func LoadRepoUnits ¶ added in v1.2.0
LoadRepoUnits loads repsitory's units, it should be called after repository and user loaded
func OrgAssignment ¶
OrgAssignment returns a macaron middleware to handle organization assignment
func RedirectToRepo ¶ added in v1.1.0
RedirectToRepo redirect to a differently-named repository
func ReferencesGitRepo ¶ added in v1.0.0
ReferencesGitRepo injects the GitRepo into the Context
func RepoAssignment ¶
RepoAssignment returns a macaron to handle repository assignment
func RequireRepoAdmin ¶
RequireRepoAdmin returns a macaron middleware for requiring repository admin permission
func RequireRepoWriter ¶
RequireRepoWriter returns a macaron middleware for requiring repository write permission
func RetrieveBaseRepo ¶
func RetrieveBaseRepo(ctx *Context, repo *models.Repository)
RetrieveBaseRepo retrieves base repository
func Toggle ¶
func Toggle(options *ToggleOptions) macaron.Handler
Toggle returns toggle options as middleware
Types ¶
type APIContext ¶
type APIContext struct { *Context Org *APIOrganization }
APIContext is a specific macaron context for API service
func (*APIContext) Error ¶
func (ctx *APIContext) Error(status int, title string, obj interface{})
Error responses error message to client with given message. If status is 500, also it prints error to log.
func (*APIContext) SetLinkHeader ¶
func (ctx *APIContext) SetLinkHeader(total, pageSize int)
SetLinkHeader sets pagination link header by given total number and page size.
type APIEmpty ¶ added in v1.2.0
type APIEmpty struct{}
APIEmpty is an empty response swagger:response empty
type APIForbiddenError ¶ added in v1.2.0
type APIForbiddenError struct {
APIError
}
APIForbiddenError is a forbidden error response swagger:response forbidden
type APINotFound ¶ added in v1.2.0
type APINotFound struct{}
APINotFound is a not found empty response swagger:response notFound
type APIOrganization ¶
APIOrganization contains organization and team
type APIRedirect ¶ added in v1.2.0
type APIRedirect struct{}
APIRedirect is a redirect response swagger:response redirect
type APIValidationError ¶ added in v1.2.0
APIValidationError is error format response related to input validation swagger:response validationError
type Context ¶
type Context struct { *macaron.Context Cache cache.Cache Flash *session.Flash Session session.Store Link string // current request URL User *models.User IsSigned bool IsBasicAuth bool Repo *Repository Org *Organization // contains filtered or unexported fields }
Context represents context of a request.
func (*Context) HandleText ¶
HandleText handles HTTP status code
func (*Context) HasAPIError ¶ added in v1.0.0
HasAPIError returns true if error occurs in form validation.
func (*Context) NotFoundOrServerError ¶
NotFoundOrServerError use error check function to determine if the error is about not found. It responses with 404 status code for not found error, or error context description for logging purpose of 500 server error.
func (*Context) RenderWithErr ¶
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{})
ServeContent serves content to http request
type Organization ¶
type Organization struct { IsOwner bool IsMember bool IsTeamMember bool // Is member of team. IsTeamAdmin bool // In owner team or team that has admin permission level. Organization *models.User OrgLink string Team *models.Team }
Organization contains organization context
type PullRequest ¶
type PullRequest struct { BaseRepo *models.Repository Allowed bool SameRepo bool HeadInfo string // [<user>:]<branch> }
PullRequest contains informations to make a pull request
type Repository ¶
type Repository struct { AccessMode models.AccessMode IsWatching bool IsViewBranch bool IsViewTag bool IsViewCommit bool Repository *models.Repository Owner *models.User Commit *git.Commit Tag *git.Tag GitRepo *git.Repository BranchName string TagName string TreePath string CommitID string RepoLink string CloneLink models.CloneLink CommitsCount int64 Mirror *models.Mirror PullRequest *PullRequest }
Repository contains information to operate a repository
func (*Repository) CanCommitToBranch ¶ added in v1.2.0
func (r *Repository) CanCommitToBranch() (bool, error)
CanCommitToBranch returns true if repository is editable and user has proper access level
and branch is not protected
func (*Repository) CanEnableEditor ¶
func (r *Repository) CanEnableEditor() bool
CanEnableEditor returns true if repository is editable and user has proper access level.
func (*Repository) GetEditorconfig ¶
func (r *Repository) GetEditorconfig() (*editorconfig.Editorconfig, error)
GetEditorconfig returns the .editorconfig definition if found in the HEAD of the default repo branch.
func (*Repository) HasAccess ¶
func (r *Repository) HasAccess() bool
HasAccess returns true if the current user has at least read access for this repository
func (*Repository) IsAdmin ¶
func (r *Repository) IsAdmin() bool
IsAdmin returns true if current user has admin or higher access of repository.
func (*Repository) IsOwner ¶
func (r *Repository) IsOwner() bool
IsOwner returns true if current user is the owner of repository.
func (*Repository) IsWriter ¶
func (r *Repository) IsWriter() bool
IsWriter returns true if current user has write or higher access of repository.