Documentation ¶
Index ¶
Constants ¶
const DefaultNamespaceSeparator = ":"
DefaultNamespaceSeparator is the default separator for namespaces.
const DefaultSeparator = "/"
DefaultSeparator is the default separator for entities.
Variables ¶
This section is empty.
Functions ¶
func EntityString ¶
EntitiesString is a type that represents a list of entities.
Types ¶
type AuthzError ¶
type AuthzError struct { // Op is the operation that caused the error. Op string // Err is the error that occurred. Err error }
AuthzError is an error that occurred while executing a query.
func NewQueryError ¶
func NewQueryError(op string, err error) *AuthzError
NewQueryError returns a new QueryError.
func (*AuthzError) Error ¶
func (e *AuthzError) Error() string
Error implements the error interface.
func (*AuthzError) Unwrap ¶
func (e *AuthzError) Unwrap() error
Unwrap implements the errors.Wrapper interface.
type NoopStore ¶
type NoopStore struct{}
NoopStore is a store that does nothing.
type Object ¶
type Object string
Object is the object that is being accessed.
const NoopObject Object = ""
NoopObject is an object that represents no object.
type Relation ¶
type Relation string
Relation is the relation between the user and the object.
const NoopRelation Relation = ""
NoopRelation is a relation that represents no relation.
type Store ¶
type Store[Tx any] interface { // Allowed checks if the user is allowed to perform the operation on the object. Allowed(context.Context, User, Object, Relation) (bool, error) // WriteTx starts a read write transaction. WriteTx(context.Context, func(context.Context, Tx) error) error }
Store is an interface that provides methods for transactional operations on the authz database.
func NewStore ¶
func NewStore[Tx any](client *client.OpenFgaClient, tx StoreTxFactory[Tx]) (Store[Tx], error)
NewStore returns a new instance of authz store.
type StoreTx ¶
type StoreTx interface { // WriteTuple writes a tuple to the authz database. WriteTuple(context.Context, User, Object, Relation) error // DeleteTuple deletes a tuple from the authz database. DeleteTuple(context.Context, User, Object, Relation) error }
StoreTx is an interface that provides methods for transactional operations on the authz database.
type StoreTxFactory ¶
type StoreTxFactory[Tx any] func(*client.OpenFgaClient, StoreTx) (Tx, error)
StoreTxFactory is a function that creates a new instance of authz store.