Rajska v0.0.1 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

get_current_user(resolution) View Source (optional)
get_current_user(resolution :: Absinthe.Resolution.t()) :: 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, scoped_struct, field_value) View Source (optional)
has_user_access?(
  current_user(),
  scoped_struct :: module(),
  field_value :: any()
) :: boolean()

Link to this callback

is_field_authorized?(current_user_role, scope_by, source) View Source (optional)
is_field_authorized?(current_user_role(), scope_by :: atom(), source :: map()) ::
  boolean()

Link to this callback

is_role_authorized?(current_user_role, allowed_role) View Source (optional)
is_role_authorized?(current_user_role(), allowed_role :: role()) :: boolean()

Link to this callback

is_super_role?(role) View Source (optional)
is_super_role?(role()) :: boolean()

Link to this callback

not_scoped_roles() View Source (optional)
not_scoped_roles() :: [role()]

Link to this callback

unauthorized_msg() View Source (optional)
unauthorized_msg() :: String.t()