rbac

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Write gives access to write data to a tenant.
	Write Permission = "write"
	// Read gives access to read data from a tenant.
	Read Permission = "read"

	// User represents a subject that is a user.
	User SubjectKind = "user"
	// Group represents a subject that is a group.
	Group SubjectKind = "group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	// Authorize answers the question: can subject S in groups G perform permission P on resource R for Tenant T?
	Authorize(subject string, groups []string, permission Permission, resource, tenant string) (int, bool)
}

Authorizer can authorize a subject's permission for a tenant's resource.

func NewAuthorizer

func NewAuthorizer(roles []Role, roleBindings []RoleBinding) Authorizer

NewAuthorizer creates a new Authorizer.

func Parse

func Parse(r io.Reader) (Authorizer, error)

Parse parses RBAC data from a reader and creates a new Authorizer.

type Permission

type Permission string

Permission is an Observatorium RBAC permission.

type Role

type Role struct {
	Name        string       `json:"name"`
	Resources   []string     `json:"resources"`
	Tenants     []string     `json:"tenants"`
	Permissions []Permission `json:"permissions"`
}

Role describes a set of permissions to interact with a tenant.

type RoleBinding

type RoleBinding struct {
	Name     string    `json:"name"`
	Subjects []Subject `json:"subjects"`
	Roles    []string  `json:"roles"`
}

RoleBinding binds a set of roles to a set of subjects.

type Subject

type Subject struct {
	Name string      `json:"name"`
	Kind SubjectKind `json:"kind"`
}

Subject represents a subject that has been bound to a role.

type SubjectKind

type SubjectKind string

SubjectKind is a kind of Observatorium RBAC subject.

Jump to

Keyboard shortcuts

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