Documentation ¶
Index ¶
- type FoundSubject
- func (fs FoundSubject) ExcludedSubjectsFromWildcard() ([]*core.ObjectAndRelation, bool)
- func (fs FoundSubject) GetExcludedSubjectIds() []string
- func (fs FoundSubject) GetSubjectId() string
- func (fs FoundSubject) Relationships() []*core.ObjectAndRelation
- func (fs FoundSubject) Subject() *core.ObjectAndRelation
- func (fs FoundSubject) ToValidationString() string
- func (fs FoundSubject) WildcardType() (string, bool)
- type FoundSubjects
- type Set
- type TrackingSubjectSet
- func (tss *TrackingSubjectSet) Add(subjectsAndResources ...FoundSubject)
- func (tss *TrackingSubjectSet) AddFrom(otherSet *TrackingSubjectSet)
- func (tss *TrackingSubjectSet) Contains(subject *core.ObjectAndRelation) bool
- func (tss *TrackingSubjectSet) Exclude(otherSet *TrackingSubjectSet) *TrackingSubjectSet
- func (tss *TrackingSubjectSet) Get(subject *core.ObjectAndRelation) (FoundSubject, bool)
- func (tss *TrackingSubjectSet) Intersect(otherSet *TrackingSubjectSet) *TrackingSubjectSet
- func (tss TrackingSubjectSet) IsEmpty() bool
- func (tss *TrackingSubjectSet) RemoveFrom(otherSet *TrackingSubjectSet)
- func (tss TrackingSubjectSet) ToFoundSubjects() FoundSubjects
- func (tss TrackingSubjectSet) ToSlice() []FoundSubject
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.ObjectAndRelation, 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() ([]*core.ObjectAndRelation, bool)
ExcludedSubjectsFromWildcard returns those subjects excluded from the wildcard subject. If not a wildcard subject, returns false.
func (FoundSubject) GetExcludedSubjectIds ¶ added in v1.12.0
func (fs FoundSubject) GetExcludedSubjectIds() []string
func (FoundSubject) GetSubjectId ¶ added in v1.12.0
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) 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 NewTrackingSubjectSet ¶
func NewTrackingSubjectSet(subjects ...FoundSubject) *TrackingSubjectSet
NewTrackingSubjectSet creates a new TrackingSubjectSet, with optional initial subjects.
func (*TrackingSubjectSet) Add ¶
func (tss *TrackingSubjectSet) Add(subjectsAndResources ...FoundSubject)
Add adds the given subjects to this set.
func (*TrackingSubjectSet) AddFrom ¶
func (tss *TrackingSubjectSet) AddFrom(otherSet *TrackingSubjectSet)
AddFrom adds the subjects found in the other set to this 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 ¶
func (tss *TrackingSubjectSet) Get(subject *core.ObjectAndRelation) (FoundSubject, bool)
Get returns the found subject in the set, if any.
func (*TrackingSubjectSet) Intersect ¶
func (tss *TrackingSubjectSet) Intersect(otherSet *TrackingSubjectSet) *TrackingSubjectSet
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 ¶ added in v1.12.0
func (tss TrackingSubjectSet) IsEmpty() bool
IsEmpty returns true if the tracking subject set is empty.
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.