rbac

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name       = "rbac"
	RoleFn     = "role"
	RolesFn    = "roles"
	ChildrenFn = "children"
	SaveFn     = "save"
	RemoveFn   = "remove"
	BindFn     = "bind"
	UnbindFn   = "unbind"
	BindsFn    = "binds"
	EnforceFn  = "enforce"
)

Variables

This section is empty.

Functions

func RegisterStore

func RegisterStore(s Store)

func Service

func Service() (v service.Service)

Types

type BindArgument

type BindArgument struct {
	Subject string   `json:"subject"`
	Roles   []string `json:"roles"`
}

type BindsArgument

type BindsArgument struct {
	Subject string `json:"subject"`
	Flat    bool   `json:"flat"`
}

type ChildrenArgument

type ChildrenArgument struct {
	Parent       string `json:"parent"`
	LoadChildren bool   `json:"loadChildren"`
}

type EnforceArgument

type EnforceArgument struct {
	Subject string `json:"subject"`
	Object  string `json:"object"`
	Action  string `json:"action"`
}

type EnforceResult

type EnforceResult struct {
	Pass bool `json:"pass"`
}

type Policy

type Policy struct {
	Object string `json:"object"`
	Action string `json:"action"`
	// contains filtered or unexported fields
}

type PolicyRecord

type PolicyRecord struct {
	Object string `json:"object"`
	Action string `json:"action"`
}

type RemoveArgument

type RemoveArgument struct {
	Code string `json:"code"`
}

type Role

type Role struct {
	Code        string    `json:"code"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Parent      string    `json:"parent"`
	Children    []*Role   `json:"children"`
	Policies    []*Policy `json:"policies"`
}

type RoleArgument

type RoleArgument struct {
	Code         string `json:"code"`
	LoadChildren bool   `json:"loadChildren"`
}

type RoleRecord

type RoleRecord struct {
	Code        string          `json:"code"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Parent      string          `json:"parent"`
	Policies    []*PolicyRecord `json:"policies"`
}

type RolesArgument

type RolesArgument struct {
	Flat bool `json:"flat"`
}

type SaveArgument

type SaveArgument struct {
	Code        string    `json:"code"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Parent      string    `json:"parent"`
	Policies    []*Policy `json:"policies"`
}

type Store

type Store interface {
	Build(options StoreOptions) (err error)
	Role(ctx context.Context, code string) (role *RoleRecord, err error)
	Roles(ctx context.Context) (roles []*RoleRecord, err error)
	Children(ctx context.Context, parent string) (children []*RoleRecord, err error)
	SaveRole(ctx context.Context, role *RoleRecord) (err error)
	RemoveRole(ctx context.Context, role *RoleRecord) (err error)
	Binds(ctx context.Context, subject string) (roles []*RoleRecord, err error)
	Bind(ctx context.Context, subject string, roles []*RoleRecord) (err error)
	Unbind(ctx context.Context, subject string, roles []*RoleRecord) (err error)
	Close() (err error)
}

type StoreOptions

type StoreOptions struct {
	Log    logs.Logger
	Config configures.Config
}

type UnbindArgument

type UnbindArgument struct {
	Subject string   `json:"subject"`
	Roles   []string `json:"roles"`
}

Jump to

Keyboard shortcuts

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