View Source Ash.Authorizer behaviour (ash v2.4.19)

The interface for an ash authorizer

These will typically be implemented by an extension, but a custom one can be implemented by defining an extension that also adopts this behaviour.

Then you can extend a resource with authorizers: [YourAuthorizer]

Link to this section Summary

Link to this section Types

@type context() :: map()
@type state() :: map()

Link to this section Callbacks

@callback check(state(), context()) ::
  :authorized | {:data, [Ash.Resource.record()]} | {:error, term()}
@callback check_context(state()) :: [atom()]
Link to this callback

exception(atom, state)

View Source (optional)
@callback exception(atom(), state()) :: no_return()
Link to this callback

initial_state( t, record, action, boolean )

View Source
@callback initial_state(
  Ash.Resource.t(),
  Ash.Resource.record(),
  Ash.Resource.Actions.action(),
  boolean()
) :: state()
Link to this callback

strict_check(state, context)

View Source
@callback strict_check(state(), context()) ::
  :authorized
  | {:continue, state()}
  | {:filter, Keyword.t()}
  | {:filter, Keyword.t(), state()}
  | {:filter_and_continue, Keyword.t(), state()}
  | {:error, term()}
Link to this callback

strict_check_context(state)

View Source
@callback strict_check_context(state()) :: [atom()]

Link to this section Functions

Link to this function

check(module, state, context)

View Source
Link to this function

check_context(module, state)

View Source
Link to this function

exception(module, reason, state)

View Source
Link to this function

initial_state(module, actor, resource, action, verbose?)

View Source
Link to this function

strict_check(module, state, context)

View Source
Link to this function

strict_check_context(module, state)

View Source