permission

package
v0.0.0-...-9451de5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CtxGlobal          = ContextType("global")
	CtxApp             = ContextType("app")
	CtxTeam            = ContextType("team")
	CtxUser            = ContextType("user")
	CtxPool            = ContextType("pool")
	CtxIaaS            = ContextType("iaas")
	CtxService         = ContextType("service")
	CtxServiceInstance = ContextType("service-instance")
	CtxVolume          = ContextType("volume")

	ContextTypes = []ContextType{
		CtxGlobal, CtxApp, CtxTeam, CtxPool, CtxIaaS, CtxService, CtxServiceInstance,
	}
)
View Source
var (
	ErrRoleNotFound          = errors.New("role not found")
	ErrRoleAlreadyExists     = errors.New("role already exists")
	ErrRoleEventNotFound     = errors.New("role event not found")
	ErrInvalidRoleName       = errors.New("invalid role name")
	ErrInvalidPermissionName = errors.New("invalid permission name")
	ErrRemoveRoleWithUsers   = errors.New("role has users assigned. you must dissociate them before remove the role.")

	RoleEventUserCreate = &RoleEvent{
		Name:        "user-create",
		Context:     CtxGlobal,
		Description: "role added to user when user is created",
	}
	RoleEventTeamCreate = &RoleEvent{
		Name:        "team-create",
		Context:     CtxTeam,
		Description: "role added to user when a new team is created",
	}

	RoleEventMap = map[string]*RoleEvent{
		RoleEventUserCreate.Name: RoleEventUserCreate,
		RoleEventTeamCreate.Name: RoleEventTeamCreate,
	}
)

Functions

This section is empty.

Types

type ContextType

type ContextType string

type ErrPermissionNotAllowed

type ErrPermissionNotAllowed struct {
	Permission  string
	ContextType ContextType
}

func (ErrPermissionNotAllowed) Error

func (e ErrPermissionNotAllowed) Error() string

type ErrPermissionNotFound

type ErrPermissionNotFound struct {
	Permission string
}

func (ErrPermissionNotFound) Error

func (e ErrPermissionNotFound) Error() string

type ErrRoleEventWrongContext

type ErrRoleEventWrongContext struct {
	Expected string
	Role     string
}

func (ErrRoleEventWrongContext) Error

func (e ErrRoleEventWrongContext) Error() string

type PermissionContext

type PermissionContext struct {
	CtxType ContextType
	Value   string
}

type RoleEvent

type RoleEvent struct {
	Name        string
	Context     ContextType
	Description string
}

func (*RoleEvent) String

func (e *RoleEvent) String() string

Jump to

Keyboard shortcuts

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