Documentation ¶
Index ¶
- Constants
- func ContextToSession(ctx context.Context) *session
- func Global() *service
- func NewService(logger *zap.Logger, s rbacRulesStore) (svc *service)
- func NewSession(ctx context.Context, i auth.Identifiable) *session
- func ParamsToSession(ctx context.Context, user uint64, roles ...uint64) *session
- func ParseResourceID(r string) (string, []uint64)
- func ResourceComponent(r string) string
- func ResourceType(r string) string
- func SetGlobal(svc *service)
- type Access
- type CheckAccessFunc
- type EffectiveSet
- type Resource
- type Role
- type RoleSettings
- type Rule
- type RuleFilter
- type RuleSet
- type ServiceAllowAll
- func (ServiceAllowAll) Can(Session, string, Resource) bool
- func (ServiceAllowAll) Check([]uint64, string, Resource) (v Access)
- func (ServiceAllowAll) CloneRulesByRoleID(context.Context, uint64, ...uint64) error
- func (ServiceAllowAll) FindRulesByRoleID(uint64) (rr RuleSet)
- func (ServiceAllowAll) Grant(context.Context, ...*Rule) error
- func (ServiceAllowAll) Trace(Session, string, Resource) *Trace
- type Session
- type Trace
Constants ¶
const ( CommonRole roleKind = iota AnonymousRole AuthenticatedRole ContextRole BypassRole )
const (
RuleResourceType = "corteza::generic:rbac-rule"
)
Variables ¶
This section is empty.
Functions ¶
func ContextToSession ¶
func NewService ¶
NewService initializes service{} struct
service{} struct preloads, checks, grants and flushes privileges to and from store It acts as a caching layer
func NewSession ¶
func NewSession(ctx context.Context, i auth.Identifiable) *session
func ParamsToSession ¶
func ParseResourceID ¶
func ResourceComponent ¶
func ResourceType ¶
ResourceType extracts 1st part of the resource
ns::cmp:res/c returns ns::cmp:res ns::cmp:res/ returns ns::cmp:res ns::cmp:res returns ns::cmp:res
Types ¶
type EffectiveSet ¶
type EffectiveSet []effective
func (*EffectiveSet) Push ¶
func (ee *EffectiveSet) Push(res, op string, allow bool)
type Resource ¶
type Resource interface {
RbacResource() string
}
func NewResource ¶
NewResource constructs untyped resource from the given string
This is a utility method that should not be used for standard permission checking and granting it's intended to be used for testing end permission evaluation where we do not have access to the resource struct
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
role information, adapted for the needs of RBAC package
type RoleSettings ¶
type Rule ¶
type Rule struct { RoleID uint64 `json:"roleID,string"` Resource string `json:"resource"` Operation string `json:"operation"` Access Access `json:"access,string"` // contains filtered or unexported fields }
func InheritRule ¶
InheritRule helper func to create inherit rule
type RuleFilter ¶
type RuleFilter struct {
Limit uint
}
RuleFilter is a dummy struct to satisfy store codegen
type RuleSet ¶
type RuleSet []*Rule
func (RuleSet) FilterAccess ¶
func (RuleSet) FilterOperation ¶
func (RuleSet) FilterResource ¶
FilterResource returns rules that match given list of resources Wildcards are not used!
Note that empty resource list will return ALL rules!
type ServiceAllowAll ¶
type ServiceAllowAll struct{}
ServiceAllowAll constructs not-for-production RBAC service
func (ServiceAllowAll) CloneRulesByRoleID ¶
func (ServiceAllowAll) FindRulesByRoleID ¶
func (ServiceAllowAll) FindRulesByRoleID(uint64) (rr RuleSet)