View Source Permit.Phoenix.Types (permit_phoenix v0.2.0)

Defines types for usage with Permit in the context of Phoenix applications.

Link to this section Summary

Types

A default error message for the controller in case there's no authorization.

A default fallback path for the controller in case there's no authorization.

A default handler that is called in case there is no authorization.

A name of a resource struct's ID parameter in controller or LiveView params, typically represented by a string.

Link to this section Types

@type action_list() :: [Permit.Types.action_group()]
@type conn() :: Plug.Conn.t()
@type error_msg() :: binary()

A default error message for the controller in case there's no authorization.

@type fallback_path() :: binary()

A default fallback path for the controller in case there's no authorization.

@type handle_unauthorized() :: (Permit.Types.action_group(), conn() -> conn())

A default handler that is called in case there is no authorization.

@type hook_outcome() :: {:halt, socket()} | {:cont, socket()} | no_return()
@type id_param_name() :: binary()

A name of a resource struct's ID parameter in controller or LiveView params, typically represented by a string.

Link to this type

live_authorization_result()

View Source
@type live_authorization_result() ::
  {:authorized | :unauthorized | :not_found, socket()}
@type plug_opts() :: [
  authorization_module: Permit.Types.authorization_module(),
  resource_module: Permit.Types.resource_module(),
  preload_actions: action_list(),
  id_param_name: id_param_name(),
  except: action_list(),
  fallback_path: fallback_path(),
  error_msg: error_msg(),
  handle_unauthorized: handle_unauthorized(),
  loader: Permit.Types.loader()
]
@type socket() :: Phoenix.LiveView.Socket.t()