rbac

package
v3.0.0-beta13 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GrantRoot           = NewGrant("root", "")
	GrantSquatter       = NewGrant("squatter", "")
	GrantHeartbeat      = NewGrant("heartbeat", "")
	GrantBlacklistAdmin = NewGrant("blacklistadmin", "")
	GrantJoin           = NewGrant("join", "")
	GrantLeave          = NewGrant("leave", "")
	GrantPrioritizer    = NewGrant("prioritizer", "")
)

Functions

func Roles

func Roles() []string

Roles returns list of defined roles

Types

type Grant

type Grant string

Grant is <role>:<scope>

func NewGrant

func NewGrant(role Role, scope string) Grant

func (*Grant) Split

func (t *Grant) Split() (string, string)

func (*Grant) String

func (t *Grant) String() string

type Grants

type Grants []Grant

Grants is a list of Grant

func NewGrants

func NewGrants(l ...string) Grants

func (Grants) AsStringList

func (t Grants) AsStringList() []string

func (Grants) Has

func (t Grants) Has(role Role, scope string) bool

func (Grants) HasGrant

func (t Grants) HasGrant(grants ...Grant) bool

HasGrant returns true if any grant of the variadic grants is found.

func (Grants) HasRole

func (t Grants) HasRole(roles ...Role) bool

HasRole returns true if any role of the variadic roles is found.

func (Grants) HasRoleOn

func (t Grants) HasRoleOn(scope string, roles ...Role) bool

HasRoleOn checks if any of the specified roles with the given scope exist in the Grants.

func (Grants) Namespaces

func (t Grants) Namespaces(roles ...Role) []string

func (Grants) String

func (t Grants) String() string

type Role

type Role string
const (
	RoleUndef          Role = ""
	RoleRoot           Role = "root"
	RoleAdmin          Role = "admin"
	RoleOperator       Role = "operator"
	RolePrioritizer    Role = "prioritizer"
	RoleGuest          Role = "guest"
	RoleSquatter       Role = "squatter"
	RoleBlacklistAdmin Role = "blacklistadmin"
	RoleHeartbeat      Role = "heartbeat"
	RoleJoin           Role = "join"
	RoleLeave          Role = "leave"
)

func SplitGrant

func SplitGrant(grant Grant) (r Role, ns string)

SplitGrant extract role and scope from a grant

func (*Role) String

func (t *Role) String() string

Jump to

Keyboard shortcuts

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