Documentation
¶
Index ¶
- func BuildObject(objectType, objectID string) string
- func GetRelation(objectRelation string) string
- func GetType(objectID string) string
- func IsObjectRelation(userset string) bool
- func IsType(object string) bool
- func IsValidObject(s string) bool
- func IsValidRelation(s string) bool
- func IsValidUser(user string) bool
- func NewTupleKey(object, relation, user string) *openfgapb.TupleKey
- func SplitObject(object string) (string, string)
- func SplitObjectRelation(objectRelation string) (string, string)
- func ToObjectRelationString(object, relation string) string
- func TupleKeyToString(tk *openfgapb.TupleKey) string
- func ValidateObjectsRelations(ctx context.Context, backend storage.TypeDefinitionReadBackend, ...) (*openfgapb.Userset, error)
- func ValidateTuple(ctx context.Context, backend storage.TypeDefinitionReadBackend, ...) (*openfgapb.Userset, error)
- func ValidateUser(tk *openfgapb.TupleKey) error
- type InvalidObjectFormatError
- type InvalidTupleError
- type RelationNotFoundError
- type TypeNotFoundError
- type UserType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildObject ¶
func GetRelation ¶
GetRelation returns the 'relation' portion of an object relation string, which may be empty if the input is malformed (or does not contain a relation specifier).
func GetType ¶
GetType returns the type from a supplied Object identifier or an empty string if the object id does not contain a type.
func IsObjectRelation ¶
IsObjectRelation returns true if the given string specifies a valid object and relation.
func IsValidObject ¶
IsValidObject determines if a string s is a valid object. A valid object contains exactly one `:` and no `#` or spaces.
func IsValidRelation ¶
IsValidRelation determines if a string s is a valid relation. This means it does not contain any `:`, `#`, or spaces.
func IsValidUser ¶
IsValidUser determines if a string s is a valid user. A valid user contains at most one `:` and no `#` or spaces.
func NewTupleKey ¶
func SplitObject ¶
SplitObject splits an object into an objectType and an objectID. If no type is present, it returns the empty string and the original object.
func SplitObjectRelation ¶
SplitObjectRelation splits an object relation string into an object ID and relation name. If no relation is present, it returns the original string and an empty relation.
func ToObjectRelationString ¶
ToObjectRelationString formats an object/relation pair as an object#relation string. This is the inverse of SplitObjectRelation.
func TupleKeyToString ¶
TupleKeyToString converts a tuple key into its string representation. It assumes the tupleKey is valid (i.e. no forbidden characters)
func ValidateObjectsRelations ¶
func ValidateObjectsRelations(ctx context.Context, backend storage.TypeDefinitionReadBackend, store, modelID string, t *openfgapb.TupleKey, dbCallsCounter utils.DBCallCounter) (*openfgapb.Userset, error)
ValidateObjectsRelations returns whether a tuple's object and relations are valid
func ValidateTuple ¶
func ValidateTuple(ctx context.Context, backend storage.TypeDefinitionReadBackend, store, authorizationModelID string, tk *openfgapb.TupleKey, dbCallsCounter utils.DBCallCounter) (*openfgapb.Userset, error)
ValidateTuple returns whether a *openfgapb.TupleKey is valid
func ValidateUser ¶ added in v0.2.0
ValidateUser returns whether the user is valid. If not, return error
Types ¶
type InvalidObjectFormatError ¶
InvalidObjectFormatError is returned if the object is invalid
func (*InvalidObjectFormatError) Error ¶
func (i *InvalidObjectFormatError) Error() string
type InvalidTupleError ¶
InvalidTupleError is returned if the tuple is invalid
func (*InvalidTupleError) Error ¶
func (i *InvalidTupleError) Error() string
type RelationNotFoundError ¶
RelationNotFoundError is returned if the relation is not found
func (*RelationNotFoundError) Error ¶
func (i *RelationNotFoundError) Error() string
type TypeNotFoundError ¶
type TypeNotFoundError struct {
TypeName string
}
TypeNotFoundError is returned if type is not found
func (*TypeNotFoundError) Error ¶
func (i *TypeNotFoundError) Error() string