AshGrant.Domain.Info (AshGrant v0.20.0)

Copy Markdown View Source

Introspection helpers for AshGrant domain-level DSL configuration.

Used internally by AshGrant.Info to read domain-level settings and merge them into resources at runtime. Merging happens on each call rather than at compile time to avoid a compile-time cycle between resource and domain when the domain also defines code_interface entries targeting the resource.

Summary

Functions

Returns true if the domain has the AshGrant.Domain extension configured.

Gets a specific scope by name from the domain.

Gets the permission resolver configured on the domain.

Gets all scope definitions from the domain.

Functions

configured?(domain)

@spec configured?(domain :: Ash.Domain.t()) :: boolean()

Returns true if the domain has the AshGrant.Domain extension configured.

get_scope(domain, name)

@spec get_scope(domain :: Ash.Domain.t(), name :: atom()) ::
  AshGrant.Dsl.Scope.t() | nil

Gets a specific scope by name from the domain.

resolver(domain)

@spec resolver(domain :: Ash.Domain.t()) :: module() | function() | nil

Gets the permission resolver configured on the domain.

Returns nil if the domain does not use the AshGrant.Domain extension or has no resolver configured.

scopes(domain)

@spec scopes(domain :: Ash.Domain.t()) :: [AshGrant.Dsl.Scope.t()]

Gets all scope definitions from the domain.

Returns [] if the domain does not use the AshGrant.Domain extension.