AshAuthzed.PolicyMacros (ash_authzed v0.2.0)

Copy Markdown View Source

Policy check macros automatically imported into Ash resources that use AshAuthzed.

Summary

Functions

Checks if the actor has permission on the resource in Licet / SpiceDB. Works for both read queries (via lookup_resources) and single-record mutations.

Checks if the actor has permission to assign the incoming value of attribute on target (:on).

Functions

authzed_can(permission, opts \\ [])

@spec authzed_can(atom() | String.t(), keyword()) :: {module(), keyword()}

Alias for rebac_can/2.

authzed_can_assign(attribute, opts)

@spec authzed_can_assign(atom(), keyword()) :: {module(), keyword()}

Alias for rebac_can_assign/2.

rebac_can(permission, opts \\ [])

@spec rebac_can(atom() | String.t(), keyword()) :: {module(), keyword()}

Checks if the actor has permission on the resource in Licet / SpiceDB. Works for both read queries (via lookup_resources) and single-record mutations.

rebac_can_assign(attribute, opts)

@spec rebac_can_assign(atom(), keyword()) :: {module(), keyword()}

Checks if the actor has permission to assign the incoming value of attribute on target (:on).

For example, rebac_can_assign(:role, on: "platform:main") checks platform:main#assign_<new_role>@user:<actor_id>.