Documentation
¶
Index ¶
- type AccessorEntity
- type Condition
- type RmngContext
- func NewRmngContext(accessor AccessorEntity) *RmngContext
- func NewRmngContextWithCtx(ctx context.Context, accessor AccessorEntity) *RmngContext
- func NewRmngContextWithNode(ctx context.Context, accessor AccessorEntity, nid string) *RmngContext
- func NewRmngContextWithUser(ctx context.Context, accessor AccessorEntity, uid string) *RmngContext
- func (c *RmngContext) Deadline() (deadline time.Time, ok bool)
- func (c *RmngContext) Done() <-chan struct{}
- func (c *RmngContext) EnrichLogger(key, value string)
- func (c *RmngContext) Err() error
- func (c *RmngContext) GetAccessor() AccessorEntity
- func (c *RmngContext) GetID() string
- func (c *RmngContext) IsAuthorized(action fmt.Stringer, resource string) error
- func (c *RmngContext) IsConditionMatch(action fmt.Stringer, resource string, value string) (bool, error)
- func (c *RmngContext) SetAllow(action fmt.Stringer, resource string) error
- func (c *RmngContext) SetAllowMultiple(actions []string, resource string) error
- func (c *RmngContext) SetScopedConditions(action fmt.Stringer, resource string, values []string) error
- func (c *RmngContext) Value(key interface{}) interface{}
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 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) 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