AshGrant.Domain.Dsl (AshGrant v0.17.0)

Copy Markdown View Source

DSL definition for the AshGrant domain-level extension.

This module defines the ash_grant DSL section that can be added to Ash domains to configure shared permission settings inherited by resources.

Only resolver and scope entities are supported at the domain level. Resource-specific options like resource_name, default_policies, and field_group must be configured on each resource.

Example

defmodule MyApp.Blog do
  use Ash.Domain,
    extensions: [AshGrant.Domain]

  ash_grant do
    resolver MyApp.PermissionResolver

    scope :always, true
    scope :own, expr(author_id == ^actor(:id))
  end

  resources do
    resource MyApp.Blog.Post   # inherits resolver + scopes
    resource MyApp.Blog.Comment # inherits resolver + scopes
  end
end

Summary

Functions

sections()