auth

package
v0.0.0-...-94d0466 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAuthorized             = errors.New("not authorized")
	ErrParentResourceTypeUnknown = errors.New("Unknown parent resource type")
	ErrPrincipalTypeUnknown      = errors.New("Unknown principal type")
)

Functions

func Check

func Check(
	ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	scope *types.Scope, resource *types.Resource, permission enum.Permission,
) error

Check checks if a resource specific permission is granted for the current auth session in the scope. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckAll

func CheckAll(
	ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	permissionChecks ...types.PermissionCheck,
) error

CheckAll checks if multiple resources specific permission is granted for the current auth session in the scope. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckChild

func CheckChild(
	ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	spaceStore store.SpaceStore, repoStore store.RepoStore, parentType enum.ParentResourceType, parentID int64,
	resourceType enum.ResourceType, resourceName string, permission enum.Permission,
) error

CheckChild checks if a resource specific permission is granted for the current auth session in the scope of a parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckConnector

func CheckConnector(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	parentPath,
	identifier string,
	permission enum.Permission,
) error

CheckConnector checks if a repo specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckGitspace

func CheckGitspace(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	parentPath,
	identifier string,
	permission enum.Permission,
) error

CheckGitspace checks if a gitspace specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckInfraProvider

func CheckInfraProvider(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	parentPath,
	identifier string,
	permission enum.Permission,
) error

CheckInfraProvider checks if a gitspace specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckPipeline

func CheckPipeline(ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	repoPath string, pipelineIdentifier string, permission enum.Permission) error

CheckPipeline checks if a pipeline specific permission is granted for the current auth session in the scope of the parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckRegistry

func CheckRegistry(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	permissionChecks ...types.PermissionCheck,
) error

CheckRegistry checks if a registry specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckRepo

func CheckRepo(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	repo *types.Repository,
	permission enum.Permission,
) error

CheckRepo checks if a repo specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckSecret

func CheckSecret(ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	parentPath, identifier string, permission enum.Permission) error

CheckSecret checks if a repo specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckService

func CheckService(ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	svc *types.Service, permission enum.Permission,
) error

CheckService checks if a service specific permission is granted for the current auth session. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckServiceAccount

func CheckServiceAccount(ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	spaceStore store.SpaceStore, repoStore store.RepoStore, parentType enum.ParentResourceType, parentID int64,
	saUID string, permission enum.Permission,
) error

CheckServiceAccount checks if a service account specific permission is granted for the current auth session in the scope of the parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckSpace

func CheckSpace(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	space *types.Space,
	permission enum.Permission,
) error

CheckSpace checks if a space specific permission is granted for the current auth session in the scope of its parent. Returns nil if permission is granted, otherwise returns NotAuthenticated, NotAuthorized, or the underlying error.

func CheckSpaceScope

func CheckSpaceScope(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	space *types.Space,
	resourceType enum.ResourceType,
	permission enum.Permission,
) error

CheckSpaceScope checks if a specific permission is granted for the current auth session in the scope of the provided space. Returns nil if permission is granted, otherwise returns NotAuthenticated, NotAuthorized, or the underlying error.

func CheckTemplate

func CheckTemplate(ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	parentPath, identifier string, permission enum.Permission) error

CheckTemplate checks if a repo specific permission is granted for the current auth session in the scope of its parent. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func CheckUser

func CheckUser(ctx context.Context, authorizer authz.Authorizer, session *auth.Session,
	user *types.User, permission enum.Permission,
) error

CheckUser checks if a user specific permission is granted for the current auth session. Returns nil if the permission is granted, otherwise returns an error. NotAuthenticated, NotAuthorized, or any underlying error.

func IsRepoOwner

func IsRepoOwner(
	ctx context.Context,
	authorizer authz.Authorizer,
	session *auth.Session,
	repo *types.Repository,
) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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