rbac

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionAll  Verb = "*"
	ActionView Verb = "view"
	ActionEdit Verb = "edit"

	ScopeAll                          Scope = "*"
	ScopeUsers                        Scope = "users"
	ScopeRoles                        Scope = "roles"
	ScopeProjectAll                   Scope = "project.*"
	ScopeProjectSettings              Scope = "project.settings"
	ScopeProjectIntegrations          Scope = "project.integrations"
	ScopeProjectApplicationCategories Scope = "project.application_categories"
	ScopeProjectCustomApplications    Scope = "project.custom_applications"
	ScopeProjectInspections           Scope = "project.inspections"
	ScopeProjectInstrumentations      Scope = "project.instrumentations"
	ScopeProjectTraces                Scope = "project.traces"
	ScopeProjectCosts                 Scope = "project.costs"
	ScopeApplication                  Scope = "project.application"
	ScopeNode                         Scope = "project.node"
)

Variables

Functions

This section is empty.

Types

type Action

type Action struct {
	Scope  Scope
	Action Verb
	Object Object
}

func NewAction

func NewAction(scope Scope, action Verb, object Object) Action

type ActionSet

type ActionSet struct{}
var (
	Actions ActionSet
)

func (ActionSet) List

func (as ActionSet) List() []Action

func (ActionSet) Project

func (as ActionSet) Project(id string) ProjectActionSet

func (ActionSet) Roles

func (as ActionSet) Roles() RolesActionSet

func (ActionSet) Users

func (as ActionSet) Users() UsersActionSet

type ApplicationActionSet

type ApplicationActionSet struct {
	// contains filtered or unexported fields
}

func (ApplicationActionSet) View

func (as ApplicationActionSet) View() Action

type NodeActionSet

type NodeActionSet struct {
	// contains filtered or unexported fields
}

func (NodeActionSet) View

func (as NodeActionSet) View() Action

type Object

type Object map[string]string

type Permission

type Permission struct {
	Scope  Scope  `json:"scope"`
	Action Verb   `json:"action"`
	Object Object `json:"object"`
}

func NewPermission

func NewPermission(scope Scope, action Verb, object Object) Permission

type PermissionSet

type PermissionSet []Permission

func (PermissionSet) Allows

func (ps PermissionSet) Allows(action Action) bool

func (PermissionSet) AllowsForObjects

func (ps PermissionSet) AllowsForObjects(action Action) []Object

type ProjectActionSet

type ProjectActionSet struct {
	// contains filtered or unexported fields
}

func (ProjectActionSet) Application

func (as ProjectActionSet) Application(category model.ApplicationCategory, namespace string, kind model.ApplicationKind, name string) ApplicationActionSet

func (ProjectActionSet) ApplicationCategories

func (as ProjectActionSet) ApplicationCategories() ProjectEditAction

func (ProjectActionSet) Costs

func (ProjectActionSet) CustomApplications

func (as ProjectActionSet) CustomApplications() ProjectEditAction

func (ProjectActionSet) Inspections

func (as ProjectActionSet) Inspections() ProjectEditAction

func (ProjectActionSet) Instrumentations

func (as ProjectActionSet) Instrumentations() ProjectEditAction

func (ProjectActionSet) Integrations

func (as ProjectActionSet) Integrations() ProjectEditAction

func (ProjectActionSet) Node

func (as ProjectActionSet) Node(name string) NodeActionSet

func (ProjectActionSet) Settings

func (as ProjectActionSet) Settings() ProjectEditAction

func (ProjectActionSet) Traces

func (as ProjectActionSet) Traces() ProjectViewAction

type ProjectEditAction

type ProjectEditAction struct {
	// contains filtered or unexported fields
}

func (ProjectEditAction) Edit

func (as ProjectEditAction) Edit() Action

type ProjectViewAction

type ProjectViewAction struct {
	// contains filtered or unexported fields
}

func (ProjectViewAction) View

func (as ProjectViewAction) View() Action

type Role

type Role struct {
	Name        RoleName      `json:"name"`
	Permissions PermissionSet `json:"permissions"`
}

func NewRole

func NewRole(name RoleName, permissions ...Permission) Role

type RoleManager

type RoleManager interface {
	GetRoles() ([]Role, error)
}

type RoleName

type RoleName string
const (
	RoleAdmin  RoleName = "Admin"
	RoleEditor RoleName = "Editor"
	RoleViewer RoleName = "Viewer"
)

func (RoleName) Builtin

func (r RoleName) Builtin() bool

func (RoleName) Valid

func (r RoleName) Valid(roles []Role) bool

type RolesActionSet

type RolesActionSet struct{}

func (RolesActionSet) Edit

func (as RolesActionSet) Edit() Action

type Scope

type Scope string

type StaticRoleManager

type StaticRoleManager struct{}

func NewStaticRoleManager

func NewStaticRoleManager() *StaticRoleManager

func (*StaticRoleManager) GetRoles

func (mgr *StaticRoleManager) GetRoles() ([]Role, error)

type UsersActionSet

type UsersActionSet struct{}

func (UsersActionSet) Edit

func (as UsersActionSet) Edit() Action

type Verb

type Verb string

Jump to

Keyboard shortcuts

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