api

package
v0.0.0-...-fba4c40 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 23 Imported by: 172

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

Init related objects/configurations for the API controllers

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) Prepare

func (ia *InternalAPI) Prepare()

Prepare validates the URL and parms

func (*InternalAPI) RenameAdmin

func (ia *InternalAPI) RenameAdmin()

RenameAdmin we don't provide flexibility in this API, as this is a workaround.

func (*InternalAPI) SyncQuota

func (ia *InternalAPI) SyncQuota()

SyncQuota ...

Jump to

Keyboard shortcuts

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