groups

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Empty emptyGrouper

Empty is a grouper that returns not found for all groups.

View Source
var ErrNotFound = fmt.Errorf("not found")

ErrNotFound us used by Grouper implementations to signal a group is not found. Can be used as the cause in errors.Wrap if more context is required.

Use IsNotFound to detect this condition.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the case of the error is ErrNotFound.

func Normalize

func Normalize(subjects []rbacv1.Subject) []rbacv1.Subject

Normalize returns the slice of subjects sorted and unique.

The underlying argument slice is preserved.

func SortSubjects

func SortSubjects(subjects []rbacv1.Subject)

Types

type GroupMap

type GroupMap map[string][]rbacv1.Subject

GroupMap is simple map of group name to subjects.

Can be created with make or NewGroupMap.

func NewGroupMap

func NewGroupMap(m map[string][]rbacv1.Subject) GroupMap

NewGroupMap creates a group map from the provided map, ensuring that subjects are sorted and unique.

func (GroupMap) DeepCopy

func (gm GroupMap) DeepCopy() GroupMap

func (GroupMap) Members

func (gm GroupMap) Members(group string) ([]rbacv1.Subject, error)

func (GroupMap) MergeInto

func (gm GroupMap) MergeInto(other GroupMap) GroupMap

MergeInto takes another group map and merges into the receiver.

This peforms differently that merge, which returns the two original groups. This one modifies the group definitions into a single one.

The receiver is always returned.

type Grouper

type Grouper interface {
	Members(group string) ([]rbacv1.Subject, error)
}

Grouper returns the members of a group, as RBAC Subjects, given a group name.

If the group is unknown to the grouper, the error will return true for IsNotFound.

type Merged

type Merged struct {
	// contains filtered or unexported fields
}

func Merge

func Merge(groupers ...Grouper) Merged

Merge returns a merged grouper that will combine the subjects at runtime.

Underlying groupers remain untouched.

func (Merged) Members

func (m Merged) Members(group string) ([]rbacv1.Subject, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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