developmentmembership

package
v1.22.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FoundSubject

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

FoundSubject contains a single found subject and all the relationships in which that subject is a member which were found via the ONRs expansion.

func NewFoundSubject

func NewFoundSubject(subject *core.DirectSubject, resources ...*core.ObjectAndRelation) FoundSubject

NewFoundSubject creates a new FoundSubject for a subject and a set of its resources.

func (FoundSubject) ExcludedSubjectsFromWildcard

func (fs FoundSubject) ExcludedSubjectsFromWildcard() ([]FoundSubject, bool)

ExcludedSubjectsFromWildcard returns those subjects excluded from the wildcard subject. If not a wildcard subject, returns false.

func (FoundSubject) GetCaveatExpression

func (fs FoundSubject) GetCaveatExpression() *core.CaveatExpression

func (FoundSubject) GetExcludedSubjects

func (fs FoundSubject) GetExcludedSubjects() []FoundSubject

func (FoundSubject) GetSubjectId

func (fs FoundSubject) GetSubjectId() string

GetSubjectId is named to match the Subject interface for the BaseSubjectSet.

func (FoundSubject) Relationships

func (fs FoundSubject) Relationships() []*core.ObjectAndRelation

Relationships returns all the relationships in which the subject was found as per the expand.

func (FoundSubject) String added in v1.16.1

func (fs FoundSubject) String() string

func (FoundSubject) Subject

func (fs FoundSubject) Subject() *core.ObjectAndRelation

Subject returns the Subject of the FoundSubject.

func (FoundSubject) ToValidationString

func (fs FoundSubject) ToValidationString() string

ToValidationString returns the FoundSubject in a format that is consumable by the validationfile package.

func (FoundSubject) WildcardType

func (fs FoundSubject) WildcardType() (string, bool)

WildcardType returns the object type for the wildcard subject, if this is a wildcard subject.

type FoundSubjects

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

FoundSubjects contains the subjects found for a specific ONR.

func (FoundSubjects) ListFound

func (fs FoundSubjects) ListFound() []FoundSubject

ListFound returns a slice of all the FoundSubject's.

func (FoundSubjects) LookupSubject

func (fs FoundSubjects) LookupSubject(subject *core.ObjectAndRelation) (FoundSubject, bool)

LookupSubject returns the FoundSubject for a matching subject, if any.

type Set

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

Set represents the set of membership for one or more ONRs, based on expansion trees.

func NewMembershipSet

func NewMembershipSet() *Set

NewMembershipSet constructs a new membership set.

NOTE: This is designed solely for the developer API and should *not* be used in any performance sensitive code.

func (*Set) AddExpansion

func (ms *Set) AddExpansion(onr *core.ObjectAndRelation, expansion *core.RelationTupleTreeNode) (FoundSubjects, bool, error)

AddExpansion adds the expansion of an ONR to the membership set. Returns false if the ONR was already added.

NOTE: The expansion tree *should* be the fully recursive expansion.

func (*Set) SubjectsByONR

func (ms *Set) SubjectsByONR() map[string]FoundSubjects

SubjectsByONR returns a map from ONR (as a string) to the FoundSubjects for that ONR.

type TrackingSubjectSet

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

TrackingSubjectSet defines a set that tracks accessible subjects and their associated relationships.

NOTE: This is designed solely for the developer API and testing and should *not* be used in any performance sensitive code.

func AccessibleExpansionSubjects

func AccessibleExpansionSubjects(treeNode *core.RelationTupleTreeNode) (*TrackingSubjectSet, error)

AccessibleExpansionSubjects returns a TrackingSubjectSet representing the set of accessible subjects in the expansion.

func MustNewTrackingSubjectSetWith added in v1.16.0

func MustNewTrackingSubjectSetWith(subjects ...FoundSubject) *TrackingSubjectSet

MustNewTrackingSubjectSetWith creates a new TrackingSubjectSet, and adds the specified subjects to it.

func NewTrackingSubjectSet

func NewTrackingSubjectSet() *TrackingSubjectSet

NewTrackingSubjectSet creates a new TrackingSubjectSet

func (*TrackingSubjectSet) Add

func (tss *TrackingSubjectSet) Add(subjectsAndResources ...FoundSubject) error

Add adds the given subjects to this set.

func (*TrackingSubjectSet) AddFrom

func (tss *TrackingSubjectSet) AddFrom(otherSet *TrackingSubjectSet) error

AddFrom adds the subjects found in the other set to this set.

func (*TrackingSubjectSet) ApplyParentCaveatExpression added in v1.16.0

func (tss *TrackingSubjectSet) ApplyParentCaveatExpression(parentCaveatExpr *core.CaveatExpression)

ApplyParentCaveatExpression applies the given parent caveat expression (if any) to each subject set.

func (*TrackingSubjectSet) Contains

func (tss *TrackingSubjectSet) Contains(subject *core.ObjectAndRelation) bool

Contains returns true if the set contains the given subject.

func (*TrackingSubjectSet) Exclude

func (tss *TrackingSubjectSet) Exclude(otherSet *TrackingSubjectSet) *TrackingSubjectSet

Exclude returns a new set that contains the items in this set minus those in the other set.

func (*TrackingSubjectSet) Get

Get returns the found subject in the set, if any.

func (*TrackingSubjectSet) Intersect

func (tss *TrackingSubjectSet) Intersect(otherSet *TrackingSubjectSet) (*TrackingSubjectSet, error)

Intersect returns a new set that contains the items in this set *and* the other set. Note that if wildcard is found in *both* sets, it will be returned *along* with any concrete subjects found on the other side of the intersection.

func (*TrackingSubjectSet) IsEmpty

func (tss *TrackingSubjectSet) IsEmpty() bool

IsEmpty returns true if the tracking subject set is empty.

func (*TrackingSubjectSet) MustAdd added in v1.16.0

func (tss *TrackingSubjectSet) MustAdd(subjectsAndResources ...FoundSubject)

MustAdd adds the given subjects to this set.

func (*TrackingSubjectSet) MustAddFrom added in v1.16.0

func (tss *TrackingSubjectSet) MustAddFrom(otherSet *TrackingSubjectSet)

MustAddFrom adds the subjects found in the other set to this set.

func (*TrackingSubjectSet) MustIntersect added in v1.16.0

func (tss *TrackingSubjectSet) MustIntersect(otherSet *TrackingSubjectSet) *TrackingSubjectSet

MustIntersect returns a new set that contains the items in this set *and* the other set. Note that if wildcard is found in *both* sets, it will be returned *along* with any concrete subjects found on the other side of the intersection.

func (*TrackingSubjectSet) RemoveFrom

func (tss *TrackingSubjectSet) RemoveFrom(otherSet *TrackingSubjectSet)

RemoveFrom removes any subjects found in the other set from this set.

func (*TrackingSubjectSet) ToFoundSubjects

func (tss *TrackingSubjectSet) ToFoundSubjects() FoundSubjects

ToFoundSubjects returns the set as a FoundSubjects struct.

func (*TrackingSubjectSet) ToSlice

func (tss *TrackingSubjectSet) ToSlice() []FoundSubject

ToSlice returns a slice of all subjects found in the set.

Jump to

Keyboard shortcuts

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