Documentation ¶
Index ¶
- func AddComment(metadata *core.Metadata, comment string) (*core.Metadata, error)
- func AllowedCaveat(name string) *core.AllowedCaveat
- func AllowedPublicNamespace(namespaceName string) *core.AllowedRelation
- func AllowedPublicNamespaceWithCaveat(namespaceName string, withCaveat *core.AllowedCaveat) *core.AllowedRelation
- func AllowedRelation(namespaceName string, relationName string) *core.AllowedRelation
- func AllowedRelationWithCaveat(namespaceName string, relationName string, withCaveat *core.AllowedCaveat) *core.AllowedRelation
- func CaveatDefinition(env *caveats.Environment, name string, expr string) (*core.CaveatDefinition, error)
- func CompiledCaveatDefinition(env *caveats.Environment, name string, compiled *caveats.CompiledCaveat) (*core.CaveatDefinition, error)
- func ComputedUserset(relation string) *core.SetOperation_Child
- func Exclusion(firstChild *core.SetOperation_Child, rest ...*core.SetOperation_Child) *core.UsersetRewrite
- func FilterUserDefinedMetadataInPlace(nsconfig *core.NamespaceDefinition)
- func GetComments(metadata *core.Metadata) []string
- func GetRelationKind(relation *core.Relation) iv1.RelationMetadata_RelationKind
- func Intersection(firstChild *core.SetOperation_Child, rest ...*core.SetOperation_Child) *core.UsersetRewrite
- func MustCaveatDefinition(env *caveats.Environment, name string, expr string) *core.CaveatDefinition
- func MustCaveatDefinitionWithComment(env *caveats.Environment, name string, comment string, expr string) *core.CaveatDefinition
- func MustComputesUsersetWithSourcePosition(relation string, lineNumber uint64) *core.SetOperation_Child
- func MustRelation(name string, rewrite *core.UsersetRewrite, ...) *core.Relation
- func MustRelationWithComment(name string, comment string, rewrite *core.UsersetRewrite, ...) *core.Relation
- func Namespace(name string, relations ...*core.Relation) *core.NamespaceDefinition
- func Nil() *core.SetOperation_Child
- func Relation(name string, rewrite *core.UsersetRewrite, ...) (*core.Relation, error)
- func RelationReference(namespaceName string, relationName string) *core.RelationReference
- func Rewrite(rewrite *core.UsersetRewrite) *core.SetOperation_Child
- func SetRelationKind(relation *core.Relation, kind iv1.RelationMetadata_RelationKind) error
- func TupleToUserset(tuplesetRelation, usersetRelation string) *core.SetOperation_Child
- func Union(firstChild *core.SetOperation_Child, rest ...*core.SetOperation_Child) *core.UsersetRewrite
- func WithComment(name string, comment string, relations ...*core.Relation) *core.NamespaceDefinition
- type Mapper
- type WithSourcePosition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddComment ¶
AddComment adds a comment to the given metadata message.
func AllowedCaveat ¶ added in v1.14.0
func AllowedCaveat(name string) *core.AllowedCaveat
AllowedCaveat creates a caveat reference.
func AllowedPublicNamespace ¶ added in v1.3.0
func AllowedPublicNamespace(namespaceName string) *core.AllowedRelation
AllowedPublicNamespace creates a relation reference to an allowed public namespace.
func AllowedPublicNamespaceWithCaveat ¶ added in v1.14.0
func AllowedPublicNamespaceWithCaveat(namespaceName string, withCaveat *core.AllowedCaveat) *core.AllowedRelation
AllowedPublicNamespaceWithCaveat creates a relation reference to an allowed public namespace.
func AllowedRelation ¶ added in v1.3.0
func AllowedRelation(namespaceName string, relationName string) *core.AllowedRelation
AllowedRelation creates a relation reference to an allowed relation.
func AllowedRelationWithCaveat ¶ added in v1.14.0
func AllowedRelationWithCaveat(namespaceName string, relationName string, withCaveat *core.AllowedCaveat) *core.AllowedRelation
AllowedRelationWithCaveat creates a relation reference to an allowed relation.
func CaveatDefinition ¶ added in v1.14.0
func CaveatDefinition(env *caveats.Environment, name string, expr string) (*core.CaveatDefinition, error)
CaveatDefinition returns a new caveat definition.
func CompiledCaveatDefinition ¶ added in v1.14.0
func CompiledCaveatDefinition(env *caveats.Environment, name string, compiled *caveats.CompiledCaveat) (*core.CaveatDefinition, error)
CompiledCaveatDefinition returns a new caveat definition.
func ComputedUserset ¶
func ComputedUserset(relation string) *core.SetOperation_Child
ComputesUserset creates a child for a set operation that follows a relation on the given starting object.
func Exclusion ¶
func Exclusion(firstChild *core.SetOperation_Child, rest ...*core.SetOperation_Child) *core.UsersetRewrite
Exclusion creates a rewrite definition that starts with the usersets of the first child and iteratively removes usersets that appear in the remaining children.
func FilterUserDefinedMetadataInPlace ¶ added in v1.5.0
func FilterUserDefinedMetadataInPlace(nsconfig *core.NamespaceDefinition)
FilterUserDefinedMetadataInPlace removes user-defined metadata (e.g. comments) from the given namespace *in place*.
func GetComments ¶
GetComments returns the comment metadata found within the given metadata message.
func GetRelationKind ¶
func GetRelationKind(relation *core.Relation) iv1.RelationMetadata_RelationKind
GetRelationKind returns the kind of the relation.
func Intersection ¶
func Intersection(firstChild *core.SetOperation_Child, rest ...*core.SetOperation_Child) *core.UsersetRewrite
Intersection creates a rewrite definition that returns/considers only usersets present in all children.
func MustCaveatDefinition ¶ added in v1.14.0
func MustCaveatDefinition(env *caveats.Environment, name string, expr string) *core.CaveatDefinition
MustCaveatDefinition returns a new caveat definition.
func MustCaveatDefinitionWithComment ¶ added in v1.27.0
func MustCaveatDefinitionWithComment(env *caveats.Environment, name string, comment string, expr string) *core.CaveatDefinition
MustCaveatDefinitionWithComment returns a new caveat definition.
func MustComputesUsersetWithSourcePosition ¶ added in v1.29.0
func MustComputesUsersetWithSourcePosition(relation string, lineNumber uint64) *core.SetOperation_Child
MustComputesUsersetWithSourcePosition creates a child for a set operation that follows a relation on the given starting object.
func MustRelation ¶ added in v1.16.0
func MustRelation(name string, rewrite *core.UsersetRewrite, allowedDirectRelations ...*core.AllowedRelation) *core.Relation
MustRelation creates a relation definition with an optional rewrite definition.
func MustRelationWithComment ¶ added in v1.16.0
func MustRelationWithComment(name string, comment string, rewrite *core.UsersetRewrite, allowedDirectRelations ...*core.AllowedRelation) *core.Relation
MustRelationWithComment creates a relation definition with an optional rewrite definition.
func Namespace ¶
func Namespace(name string, relations ...*core.Relation) *core.NamespaceDefinition
Namespace creates a namespace definition with one or more defined relations.
func Nil ¶ added in v1.6.0
func Nil() *core.SetOperation_Child
Nil creates a child for a set operation that references the empty set.
func Relation ¶
func Relation(name string, rewrite *core.UsersetRewrite, allowedDirectRelations ...*core.AllowedRelation) (*core.Relation, error)
Relation creates a relation definition with an optional rewrite definition.
func RelationReference ¶
func RelationReference(namespaceName string, relationName string) *core.RelationReference
RelationReference creates a relation reference.
func Rewrite ¶
func Rewrite(rewrite *core.UsersetRewrite) *core.SetOperation_Child
Rewrite wraps a rewrite as a set operation child of another rewrite.
func SetRelationKind ¶
func SetRelationKind(relation *core.Relation, kind iv1.RelationMetadata_RelationKind) error
SetRelationKind sets the kind of relation.
func TupleToUserset ¶
func TupleToUserset(tuplesetRelation, usersetRelation string) *core.SetOperation_Child
TupleToUserset creates a child which first loads all tuples with the specific relation, and then unions all children on the usersets found by following a relation on those loaded tuples.
func Union ¶
func Union(firstChild *core.SetOperation_Child, rest ...*core.SetOperation_Child) *core.UsersetRewrite
Union creates a rewrite definition that combines/considers usersets in all children.
func WithComment ¶ added in v1.7.0
func WithComment(name string, comment string, relations ...*core.Relation) *core.NamespaceDefinition
WithComment creates a namespace definition with one or more defined relations.
Types ¶
type Mapper ¶ added in v0.0.2
type Mapper interface { // Encode translates a given namespace name to an encoded namespace identifier. Encode(name string) (string, error) // Reverse translates a given namespace identifier to the user supplied namespace name. Reverse(id string) (string, error) }
Mapper provides an interface for creating synthetic namespace names from user provided namespace names.
var PassthroughMapper Mapper = passthrough{}
PassthroughMapper is a mapper implementation which passes through the original namespace names unmodified.
type WithSourcePosition ¶ added in v1.6.0
type WithSourcePosition interface {
GetSourcePosition() *core.SourcePosition
}
WithSourcePosition defines an interface for proto messages in core with SourcePosition information attached.