Parrhesia.API.ACL
(parrhesia v0.12.0)
Copy Markdown
Public ACL API and rule matching for protected sync traffic.
ACL checks are only applied when the requested subject overlaps with
config :parrhesia, :acl, protected_filters: [...].
The intended flow is:
- mark a subset of sync traffic as protected with
protected_filters - persist pubkey-based grants with
grant/2 - call
check/3during sync reads and writes
Unprotected subjects always return :ok.
Summary
Functions
Authorizes a protected sync read or write subject for the given request context.
Persists an ACL rule.
Lists persisted ACL rules.
Returns true when a filter overlaps the configured protected read surface.
Returns the configured protected read filters.
Returns true when an event matches the configured protected write surface.
Deletes ACL rules matching the given selector.
Functions
Authorizes a protected sync read or write subject for the given request context.
Supported capabilities are :sync_read and :sync_write.
opts[:context] defaults to an empty Parrhesia.API.RequestContext, which means protected
subjects will fail with {:error, :auth_required} until authenticated pubkeys are present.
Local callers bypass ACL enforcement entirely. ACL is intended to protect external sync traffic, not trusted in-process calls.
Persists an ACL rule.
A typical rule looks like:
%{
principal_type: :pubkey,
principal: "...64 hex chars...",
capability: :sync_read,
match: %{"kinds" => [5000], "#r" => ["tribes.accounts.user"]}
}
Lists persisted ACL rules.
Supported filters are:
:principal_type:principal:capability
Returns true when a filter overlaps the configured protected read surface.
Returns the configured protected read filters.
Returns true when an event matches the configured protected write surface.
Deletes ACL rules matching the given selector.
The selector is passed through to the configured storage adapter, which typically accepts an
id-based selector such as %{id: rule_id}.