rmngctx

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessorEntity

type AccessorEntity interface {
	GetID() string
	GetPermissions() *rbac.EntityPermissions
}

type Condition

type Condition struct {
	Operator string
	Value    string
}

type RmngContext

type RmngContext struct {
	Context  context.Context
	Accessor AccessorEntity
	// [action][resource]Condition
	// XXX this is hacked up. This expects that even if a wildcard condition matches in Permissions
	// we need to get exact match in ExtraConditions, if it exists for this combination
	ExtraConditions map[string]map[string][]Condition
	// contains filtered or unexported fields
}

func NewRmngContext

func NewRmngContext(accessor AccessorEntity) *RmngContext

TODO: Why is this needed?

func NewRmngContextWithCtx

func NewRmngContextWithCtx(ctx context.Context, accessor AccessorEntity) *RmngContext

func NewRmngContextWithNode

func NewRmngContextWithNode(ctx context.Context, accessor AccessorEntity, nid string) *RmngContext

func NewRmngContextWithUser

func NewRmngContextWithUser(ctx context.Context, accessor AccessorEntity, uid string) *RmngContext

func (*RmngContext) Deadline

func (c *RmngContext) Deadline() (deadline time.Time, ok bool)

Deadline implements context.Context

func (*RmngContext) Done

func (c *RmngContext) Done() <-chan struct{}

Done implements context.Context

func (*RmngContext) EnrichLogger

func (c *RmngContext) EnrichLogger(key, value string)

EnrichLogger adds a field to the logger stored in this context.

func (*RmngContext) Err

func (c *RmngContext) Err() error

Err implements context.Context

func (*RmngContext) GetAccessor

func (c *RmngContext) GetAccessor() AccessorEntity

func (*RmngContext) GetID

func (c *RmngContext) GetID() string

func (*RmngContext) IsAuthorized

func (c *RmngContext) IsAuthorized(action fmt.Stringer, resource string) error

func (*RmngContext) IsConditionMatch

func (c *RmngContext) IsConditionMatch(action fmt.Stringer, resource string, value string) (bool, error)

IsConditionMatch reports whether value satisfies the extra conditions recorded for (action, resource). An absent condition means "unrestricted", not "denied": full-group access deliberately sets no conditions, so defaulting to deny here would hide every subgroup from a primary/secondary user. Callers that narrow access must therefore set their restriction when they grant the permission — see GetUserSubGroup and ListGroupsForUser in db/user_group_db.go.

func (*RmngContext) SetAllow

func (c *RmngContext) SetAllow(action fmt.Stringer, resource string) error

func (*RmngContext) SetAllowMultiple

func (c *RmngContext) SetAllowMultiple(actions []string, resource string) error

func (*RmngContext) SetScopedConditions

func (c *RmngContext) SetScopedConditions(action fmt.Stringer, resource string, values []string) error

SetScopedConditions narrows (action, resource) to exactly values, so IsConditionMatch denies anything not listed. Registering the entry is the load-bearing part when values is empty: with no entry, IsConditionMatch reads the grant as unscoped and allows every value.

func (*RmngContext) Value

func (c *RmngContext) Value(key interface{}) interface{}

Value implements context.Context

Jump to

Keyboard shortcuts

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