Documentation ¶
Index ¶
- func Init() error
- type BaseController
- func (b *BaseController) HasProjectPermission(projectIDOrName interface{}, action rbac.Action, subresource ...rbac.Resource) (bool, error)
- func (b *BaseController) PopulateUserSession(u models.User)
- func (b *BaseController) Prepare()
- func (b *BaseController) RequireAuthenticated() bool
- func (b *BaseController) RequireProjectAccess(projectIDOrName interface{}, action rbac.Action, subresource ...rbac.Resource) bool
- func (b *BaseController) SendPermissionError()
- func (b *BaseController) WriteJSONData(object interface{})
- func (b *BaseController) WriteYamlData(object interface{})
- type InternalAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseController ¶
type BaseController struct { api.BaseAPI // SecurityCtx is the security context used to authN &authZ SecurityCtx security.Context // ProjectCtl is the project controller which abstracts the operations // related to projects ProjectCtl projectcontroller.Controller }
BaseController ...
func (*BaseController) HasProjectPermission ¶
func (b *BaseController) HasProjectPermission(projectIDOrName interface{}, action rbac.Action, subresource ...rbac.Resource) (bool, error)
HasProjectPermission returns true when the request has action permission on project subresource
func (*BaseController) PopulateUserSession ¶
func (b *BaseController) PopulateUserSession(u models.User)
PopulateUserSession generates a new session ID and fill the user model in parm to the session
func (*BaseController) Prepare ¶
func (b *BaseController) Prepare()
Prepare inits security context and project manager from request context
func (*BaseController) RequireAuthenticated ¶
func (b *BaseController) RequireAuthenticated() bool
RequireAuthenticated returns true when the request is authenticated otherwise send Unauthorized response and returns false
func (*BaseController) RequireProjectAccess ¶
func (b *BaseController) RequireProjectAccess(projectIDOrName interface{}, action rbac.Action, subresource ...rbac.Resource) bool
RequireProjectAccess returns true when the request has action access on project subresource otherwise send UnAuthorized or Forbidden response and returns false
func (*BaseController) SendPermissionError ¶
func (b *BaseController) SendPermissionError()
SendPermissionError is a shortcut for sending different http error based on authentication status.
func (*BaseController) WriteJSONData ¶
func (b *BaseController) WriteJSONData(object interface{})
WriteJSONData writes the JSON data to the client.
func (*BaseController) WriteYamlData ¶
func (b *BaseController) WriteYamlData(object interface{})
WriteYamlData writes the yaml data to the client.
type InternalAPI ¶
type InternalAPI struct {
BaseController
}
InternalAPI handles request of harbor admin...
func (*InternalAPI) RenameAdmin ¶
func (ia *InternalAPI) RenameAdmin()
RenameAdmin we don't provide flexibility in this API, as this is a workaround.