AshAuthzed.Adapters.Memory (ash_authzed v0.2.0)

Copy Markdown View Source

Caller-supervised in-memory Zanzibar / ReBAC adapter powered by Licet and Licet.Schema.

Provides full .zed schema evaluation (check, lookup_resources, write_tuples) entirely in memory without requiring a running Postgres database or external SpiceDB daemon. Ideal for fast, isolated async: true unit and integration tests.

Starting in a Supervision Tree or Test

start_supervised!(
  {AshAuthzed.Adapters.Memory,
   name: MyTestAuthzed,
   schema: File.read!("priv/licet/schema.zed")}
)

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns all currently stored %Licet.Relationship{} tuples as strings.

Starts an in-memory ReBAC store linked to the calling process.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

list_tuples(server \\ __MODULE__)

@spec list_tuples(atom()) :: [String.t()]

Returns all currently stored %Licet.Relationship{} tuples as strings.

start_link(opts)

@spec start_link(keyword()) :: Agent.on_start()

Starts an in-memory ReBAC store linked to the calling process.

Options

  • :name (atom/0) - Process registration name for this memory store instance. The default value is AshAuthzed.Adapters.Memory.

  • :schema (term/0) - Required. A .zed schema string, {:file, path}, or compiled %Licet.Schema{}.

  • :relationships (list of String.t/0) - Initial relationship tuple strings to seed on startup. The default value is [].