ds

package
v0.21.7 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeIDSeparator   string = ":"
	InstanceSeparator string = "|"
)
View Source
const DefaultHash string = `0`

Variables

View Source
var (
	// TODO renumber errors.
	ErrObjectTypeNotFound                    = cerr.NewAsertoError("E20031", codes.NotFound, http.StatusNotFound, "object type not found")
	ErrObjectNotFound                        = cerr.NewAsertoError("E20032", codes.NotFound, http.StatusNotFound, "object not found")
	ErrRelationNotFound                      = cerr.NewAsertoError("E20033", codes.NotFound, http.StatusNotFound, "relation not found")
	ErrRelationTypeNotFound                  = cerr.NewAsertoError("E20033", codes.NotFound, http.StatusNotFound, "relation type not found")
	ErrInvalidArgumentObjectTypeIdentifier   = cerr.NewAsertoError("E20034", codes.InvalidArgument, http.StatusBadRequest, "object type identifier invalid argument")
	ErrInvalidArgumentRelationTypeIdentifier = cerr.NewAsertoError("E20034", codes.InvalidArgument, http.StatusBadRequest, "relation type identifier invalid argument")
	ErrInvalidArgumentObjectIdentifier       = cerr.NewAsertoError("E20035", codes.InvalidArgument, http.StatusBadRequest, "object identifier invalid argument")
	ErrInvalidArgumentRelationIdentifier     = cerr.NewAsertoError("E20036", codes.InvalidArgument, http.StatusBadRequest, "relation identifier invalid argument")
	ErrInvalidArgumentObjectTypeSelector     = cerr.NewAsertoError("E20037", codes.InvalidArgument, http.StatusBadRequest, "object type selector invalid argument")
	ErrNoCompleteObjectIdentifier            = cerr.NewAsertoError("E20038", codes.FailedPrecondition, http.StatusPreconditionFailed, "relation identifier no complete object identifier")
	ErrInvalidArgumentPermissionIdentifier   = cerr.NewAsertoError("E20039", codes.InvalidArgument, http.StatusBadRequest, "permission identifier invalid argument")
	ErrInvalidArgumentObjectType             = cerr.NewAsertoError("E20040", codes.InvalidArgument, http.StatusBadRequest, "object type invalid argument")
	ErrInvalidArgumentRelationType           = cerr.NewAsertoError("E20041", codes.InvalidArgument, http.StatusBadRequest, "relation type invalid argument")
	ErrInvalidArgumentPermission             = cerr.NewAsertoError("E20042", codes.InvalidArgument, http.StatusBadRequest, "permission invalid argument")
	ErrInvalidArgumentObject                 = cerr.NewAsertoError("E20042", codes.InvalidArgument, http.StatusBadRequest, "object invalid argument")
	ErrInvalidArgumentRelation               = cerr.NewAsertoError("E20042", codes.InvalidArgument, http.StatusBadRequest, "relation invalid argument")
	ErrGraphDirectionality                   = cerr.NewAsertoError("E20043", codes.InvalidArgument, http.StatusPreconditionFailed, "unable to determine graph directionality")
)

Functions

func BoolToByte

func BoolToByte(b bool) []byte

func ByteToInt32

func ByteToInt32(b []byte) int32

func CheckPermission

func CheckPermission(i *dsr.CheckPermissionRequest) *checkPermission

func CheckRelation

func CheckRelation(i *dsr.CheckRelationRequest) *checkRelation

func CreateUserSet added in v0.21.2

func CreateUserSet(ctx context.Context, tx *bolt.Tx, subject *dsc.ObjectIdentifier) ([]*dsc.ObjectIdentifier, error)

CreateUserSet, create the computed user set of a subject.

func ExpandRelation

func ExpandRelation(relTypes []*dsc.RelationType, relation string) []string

ExpandRelation, expand relation to include covering relation within the object_type.

func GetGraph

func GetGraph(i *dsr.GetGraphRequest) *getGraph

func Int32ToByte

func Int32ToByte(i int32) []byte

func Int32ToStr

func Int32ToStr(i int32) string

func Int64ToByte

func Int64ToByte(i int64) []byte

func IsDefaultHash

func IsDefaultHash(h string) bool

func IsNotSet

func IsNotSet(s string) bool

func IsSet

func IsSet(s string) bool

func Object

func Object(i *dsc.Object) *object

func ObjectDependency

func ObjectDependency(i *dsc.ObjectDependency) *objectDependency

func ObjectIdentifier

func ObjectIdentifier(i *dsc.ObjectIdentifier) *objectIdentifier

func ObjectSelector

func ObjectSelector(i *dsc.ObjectIdentifier) *objectSelector

func ObjectType

func ObjectType(i *dsc.ObjectType) *objectType

func ObjectTypeIdentifier

func ObjectTypeIdentifier(i *dsc.ObjectTypeIdentifier) *objectTypeIdentifier

func ObjectTypeSelector

func ObjectTypeSelector(i *dsc.ObjectTypeIdentifier) *objectTypeSelector

func Permission

func Permission(i *dsc.Permission) *permission

func PermissionIdentifier

func PermissionIdentifier(i *dsc.PermissionIdentifier) *permissionIdentifier

func Relation

func Relation(i *dsc.Relation) *relation

func RelationIdentifier

func RelationIdentifier(i *dsc.RelationIdentifier) *relationIdentifier

func RelationSelector

func RelationSelector(i *dsc.RelationIdentifier) *relationSelector

func RelationType

func RelationType(i *dsc.RelationType) *relationType

func RelationTypeIdentifier

func RelationTypeIdentifier(i *dsc.RelationTypeIdentifier) *relationTypeIdentifier

func RelationTypeSelector

func RelationTypeSelector(i *dsc.RelationTypeIdentifier) *relationTypeSelector

func ResolvePermission

func ResolvePermission(ctx context.Context, tx *bolt.Tx, objectType, permission string) ([]string, error)

ResolvePermission, resolves the permission to covering relations, within the scope of the object_type.

func ResolveRelation

func ResolveRelation(ctx context.Context, tx *bolt.Tx, objectType, relation string) ([]string, error)

ResolveRelation, resolves the relation to covering relations within the scope of the object_type.

func StrToInt32

func StrToInt32(s string) int32

func UUIDToByte

func UUIDToByte(s string) []byte

func Uint32ToByte

func Uint32ToByte(i uint32) []byte

func Uint64ToByte

func Uint64ToByte(i uint64) []byte

Types

type Direction

type Direction int
const (
	SubjectToObject Direction = 0
	ObjectToSubject Direction = 1
)

type GraphWalker

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

func (*GraphWalker) Fetch added in v0.21.2

func (w *GraphWalker) Fetch() error

func (*GraphWalker) Filter added in v0.21.2

func (w *GraphWalker) Filter() error

func (*GraphWalker) Results

func (w *GraphWalker) Results() ([]*dsc.ObjectDependency, error)

type RelationFilter added in v0.21.5

type RelationFilter func(*dsc.Relation) bool

Jump to

Keyboard shortcuts

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