Behaviour and unified dispatcher for ReBAC backends (Licet, SpiceDB HTTP, or Memory).
Summary
Functions
Applies a .zed schema text to the backing adapter store.
Checks whether subject has permission on resource, returning {:ok, boolean()} or {:error, Exception.t()}.
Checks whether subject has permission on resource.
Returns true if allowed, false otherwise.
Looks up all resource IDs of resource_type on which subject has permission.
Looks up all resource IDs of resource_type on which subject has permission, raising on error.
Applies a list of relationship tuple operations ({:create | :touch | :delete, tuple_string}).
Types
@type operation() :: {:create | :touch | :delete, String.t()}
Callbacks
@callback apply_schema(schema_text :: String.t(), opts :: keyword()) :: :ok | {:ok, term()} | {:error, Exception.t()}
@callback write_tuples(operations :: [operation()], opts :: keyword()) :: {:ok, term()} | {:error, Exception.t()}
Functions
@spec apply_schema(String.t(), keyword()) :: :ok | {:ok, term()} | {:error, Exception.t()}
Applies a .zed schema text to the backing adapter store.
@spec check(String.t(), String.t() | atom(), String.t(), keyword()) :: {:ok, boolean()} | {:error, Exception.t()}
Checks whether subject has permission on resource, returning {:ok, boolean()} or {:error, Exception.t()}.
Checks whether subject has permission on resource.
Returns true if allowed, false otherwise.
@spec lookup_resources(String.t(), String.t() | atom(), String.t(), keyword()) :: {:ok, [String.t()]} | {:error, Exception.t()}
Looks up all resource IDs of resource_type on which subject has permission.
Looks up all resource IDs of resource_type on which subject has permission, raising on error.
@spec write_tuples([operation()], keyword()) :: :ok | {:ok, term()} | {:error, Exception.t()}
Applies a list of relationship tuple operations ({:create | :touch | :delete, tuple_string}).