View Source Ash.Authorizer behaviour (ash v3.4.4)

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]

Summary

Types

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

Callbacks

Link to this callback

add_calculations(arg1, state, context)

View Source (optional)
@callback add_calculations(Ash.Query.t() | Ash.Changeset.t(), state(), context()) ::
  {:ok, Ash.Query.t() | Ash.Changeset.t(), state()} | {:error, Ash.Error.t()}
Link to this callback

alter_filter(filter, state, context)

View Source (optional)
@callback alter_filter(filter :: Ash.Filter.t(), state(), context()) ::
  {:ok, Ash.Filter.t()} | {:error, Ash.Error.t()}
Link to this callback

alter_results(state, list, context)

View Source (optional)
@callback alter_results(state(), [Ash.Resource.record()], context()) ::
  {:ok, [Ash.Resource.record()]} | {:error, Ash.Error.t()}
@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, t)

View Source
Link to this callback

strict_check(state, context)

View Source
@callback strict_check(state(), context()) ::
  {:authorized, state()}
  | {: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()]

Functions

Link to this function

add_calculations(module, query_or_changeset, state, context)

View Source
Link to this function

alter_filter(module, state, filter, context)

View Source
Link to this function

alter_results(module, state, records, context)

View Source
Link to this function

alter_sort(module, state, sort, context)

View Source
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, domain)

View Source
Link to this function

strict_check(module, state, context)

View Source
Link to this function

strict_check_context(module, state)

View Source