SimpleAuth v1.5.5 SimpleAuth.AccessControl View Source

Plugs for authorization

Link to this section Summary

Functions

Returns true if the current user has any of the given roles or the given role list is empty

Plug to authorize and redirect if not authorized

Gets the current user

True if user logged in

Plug to have unauthorized requests not redirect and just return a text response (for API usage)

Get remaining seconds for the session or nil if expired (if supported by the API)

Get the current user’s roles as a MapSet

Link to this section Functions

Link to this function any_granted?(conn, check_roles) View Source

Returns true if the current user has any of the given roles or the given role list is empty

Plug to authorize and redirect if not authorized

Gets the current user

True if user logged in

Link to this function no_redirect_on_unauthorized(conn, opts) View Source

Plug to have unauthorized requests not redirect and just return a text response (for API usage)

Get remaining seconds for the session or nil if expired (if supported by the API)

Get the current user’s roles as a MapSet