relationships

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInvalidSubjectTypeError

func NewInvalidSubjectTypeError(
	relationship tuple.Relationship,
	relationType *core.AllowedRelation,
	typeSystem *typesystem.TypeSystem,
) error

NewInvalidSubjectTypeError constructs a new error for attempting to write an invalid subject type.

func ValidateOneRelationship added in v1.22.0

func ValidateOneRelationship(
	namespaceMap map[string]*typesystem.TypeSystem,
	caveatMap map[string]*core.CaveatDefinition,
	rel tuple.Relationship,
	rule ValidationRelationshipRule,
) error

ValidateOneRelationship validates a single relationship for CREATE/TOUCH or DELETE.

func ValidateRelationshipUpdates

func ValidateRelationshipUpdates(
	ctx context.Context,
	reader datastore.Reader,
	updates []tuple.RelationshipUpdate,
) error

ValidateRelationshipUpdates performs validation on the given relationship updates, ensuring that they can be applied against the datastore.

func ValidateRelationshipsForCreateOrTouch added in v1.23.0

func ValidateRelationshipsForCreateOrTouch(
	ctx context.Context,
	reader datastore.Reader,
	rels ...tuple.Relationship,
) error

ValidateRelationshipsForCreateOrTouch performs validation on the given relationships to be written, ensuring that they can be applied against the datastore.

NOTE: This method *cannot* be used for relationships that will be deleted.

Types

type CannotWriteToPermissionError added in v1.39.0

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

CannotWriteToPermissionError indicates that a write was attempted on a permission.

func NewCannotWriteToPermissionError

func NewCannotWriteToPermissionError(rel tuple.Relationship) CannotWriteToPermissionError

NewCannotWriteToPermissionError constructs a new error for attempting to write to a permission.

func (CannotWriteToPermissionError) GRPCStatus added in v1.39.0

func (err CannotWriteToPermissionError) GRPCStatus() *status.Status

GRPCStatus implements retrieving the gRPC status for the error.

type CaveatNotFoundError added in v1.39.0

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

CaveatNotFoundError indicates that a caveat referenced in a relationship update was not found.

func NewCaveatNotFoundError

func NewCaveatNotFoundError(relationship tuple.Relationship) CaveatNotFoundError

NewCaveatNotFoundError constructs a new caveat not found error.

func (CaveatNotFoundError) GRPCStatus added in v1.39.0

func (err CaveatNotFoundError) GRPCStatus() *status.Status

GRPCStatus implements retrieving the gRPC status for the error.

type InvalidSubjectTypeError added in v1.39.0

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

InvalidSubjectTypeError indicates that a write was attempted with a subject type which is not allowed on relation.

func (InvalidSubjectTypeError) GRPCStatus added in v1.39.0

func (err InvalidSubjectTypeError) GRPCStatus() *status.Status

GRPCStatus implements retrieving the gRPC status for the error.

type ValidationRelationshipRule added in v1.23.0

type ValidationRelationshipRule int

ValidationRelationshipRule is the rule to use for the validation.

const (
	// ValidateRelationshipForCreateOrTouch indicates that the validation should occur for a CREATE or TOUCH operation.
	ValidateRelationshipForCreateOrTouch ValidationRelationshipRule = 0

	// ValidateRelationshipForDeletion indicates that the validation should occur for a DELETE operation.
	ValidateRelationshipForDeletion ValidationRelationshipRule = 1
)

Jump to

Keyboard shortcuts

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