rbac

package
v0.0.0-...-4515e61 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCServer

func NewGRPCServer(c Control) pb.ControlServer

NewGRPCServer creates a new grpc server instance for the rbac control

Types

type AccountID

type AccountID string

AccountID of a user in the RBAC-system

type AccountRoles

type AccountRoles []RoleID

AccountRoles are the roles attached to a subject

func (AccountRoles) Contains

func (r AccountRoles) Contains(roleID RoleID) bool

Contains checks whether a rule is available in the role rules

type Control

type Control interface {
	GetRoleRules(ctx context.Context, roleID RoleID) (RoleRules, error)
	SetRoleRules(ctx context.Context, roleID RoleID, rules RoleRules) error
	GetAccountRoles(ctx context.Context, accountID AccountID) (AccountRoles, error)
	SetAccountRoles(ctx context.Context, accountID AccountID, roles AccountRoles) error
	IsAccountAllowed(ctx context.Context, accountID AccountID, rule Rule) (bool, error)
}

Control of the rbac system

func NewControl

func NewControl(r Repository) Control

NewControl instantiates a new RBAC control

func NewGRPCClient

func NewGRPCClient(c *grpc.ClientConn) Control

NewGRPCClient for the rbac controller

type Repository

type Repository interface {
	// GetRoleRules fetches all available Rules from a role
	GetRoleRules(context.Context, RoleID) (RoleRules, error)
	// SetRoleRules sets the rules of a role
	SetRoleRules(context.Context, RoleID, RoleRules) error
	// GetAccountRoles returns the roles of a subject
	GetAccountRoles(context.Context, AccountID) (AccountRoles, error)
	// SetAccountRoles sets the roles of a subject
	SetAccountRoles(context.Context, AccountID, AccountRoles) error
	// GetAccountRuleCount returns the amount of occurrences of a given rule
	// for a given subject
	GetAccountRuleCount(context.Context, AccountID, Rule) (uint64, error)
}

Repository for persistent RBAC storage

type RoleID

type RoleID string

RoleID id of a role

type RoleRules

type RoleRules []Rule

RoleRules from a role

func (RoleRules) Contains

func (r RoleRules) Contains(rule Rule) bool

Contains checks whether a rule is available in the role rules

type Rule

type Rule string

Rule of the RBAC system

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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