developmentmembership

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 9 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 ...tuple.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) ParentResources added in v1.39.0

func (fs FoundSubject) ParentResources() []tuple.ObjectAndRelation

ParentResources returns all the resources 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() tuple.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 tuple.ObjectAndRelation) (FoundSubject, bool)

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

type ONRSet added in v1.36.0

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

ONRSet is a set of ObjectAndRelation's.

func NewONRSet added in v1.36.0

func NewONRSet(onrs ...tuple.ObjectAndRelation) ONRSet

NewONRSet creates a new set.

func (ONRSet) Add added in v1.36.0

func (ons ONRSet) Add(onr tuple.ObjectAndRelation) bool

Add adds the given ONR to the set. Returns true if the object was not in the set before this call and false otherwise.

func (ONRSet) AsSlice added in v1.36.0

func (ons ONRSet) AsSlice() []tuple.ObjectAndRelation

AsSlice returns the ONRs found in the set as a slice.

func (ONRSet) Has added in v1.36.0

func (ons ONRSet) Has(onr tuple.ObjectAndRelation) bool

Has returns true if the set contains the given ONR.

func (ONRSet) Intersect added in v1.36.0

func (ons ONRSet) Intersect(otherSet ONRSet) ONRSet

Intersect returns an intersection between this ONR set and the other set provided.

func (ONRSet) IsEmpty added in v1.36.0

func (ons ONRSet) IsEmpty() bool

IsEmpty returns whether the set is empty.

func (ONRSet) Length added in v1.36.0

func (ons ONRSet) Length() uint64

Length returns the size of the set.

func (ONRSet) Subtract added in v1.36.0

func (ons ONRSet) Subtract(otherSet ONRSet) ONRSet

Subtract returns a subtraction from this ONR set of the other set provided.

func (ONRSet) Union added in v1.36.0

func (ons ONRSet) Union(otherSet ONRSet) ONRSet

Union returns a copy of this ONR set with the other set's elements added in.

func (ONRSet) Update added in v1.36.0

func (ons ONRSet) Update(onrs []tuple.ObjectAndRelation)

Update updates the set by adding the given ONRs to it.

func (ONRSet) UpdateFrom added in v1.36.0

func (ons ONRSet) UpdateFrom(otherSet ONRSet)

UpdateFrom updates the set by adding the ONRs found in the other set to it.

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 tuple.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 tuple.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