Rajska v0.8.0 Rajska.Authorization behaviour View Source

Behaviour of an Authorization module.

Link to this section Summary

Link to this section Types

Link to this type

current_user()

View Source
current_user() :: any()
Link to this type

current_user_role()

View Source
current_user_role() :: role()

Link to this section Callbacks

Link to this callback

field_authorized?(current_user_role, scope_by, source)

View Source (optional)
field_authorized?(current_user_role(), scope_by :: atom(), source :: map()) ::
  boolean()
Link to this callback

get_current_user(context)

View Source (optional)
get_current_user(context :: map()) :: current_user()
Link to this callback

get_user_role(current_user)

View Source (optional)
get_user_role(current_user()) :: role()
Link to this callback

has_user_access?(current_user, scope, {}, rule)

View Source (optional)
has_user_access?(
  current_user(),
  scope :: module(),
  {field :: any(), field_value :: any()},
  rule :: any()
) :: boolean()
Link to this callback

not_scoped_roles()

View Source (optional)
not_scoped_roles() :: [role()]
Link to this callback

role_authorized?(current_user_role, allowed_role)

View Source (optional)
role_authorized?(current_user_role(), allowed_role :: role()) :: boolean()
Link to this callback

unauthorized_msg(resolution)

View Source (optional)
unauthorized_msg(resolution :: Absinthe.Resolution.t()) :: String.t()