RestAuth v1.1.1 RestAuth.Utility View Source

Module is responsible for taking a set of user roles and checking them against required roles on action.

Link to this section Summary

Functions

Gets current authority struct saved on conn

Retrieves current user_id from conn. Returns :anonymous if the user is not authenticated

Gets current metadata saved on conn

Retrieves roles for current user from conn

Returns true if all of the required_roles are in users role, false if not

Checks if the current user on conn is logged in or not

Returns true if one or more of the required_roles are in users role, false if not

Returns true if none of the required_roles are in users role, false if not

Link to this section Functions

Gets current authority struct saved on conn

Link to this function get_current_user_id(conn) View Source

Retrieves current user_id from conn. Returns :anonymous if the user is not authenticated

Link to this function get_current_user_metadata(conn) View Source

Gets current metadata saved on conn

Link to this function get_current_user_roles(conn) View Source

Retrieves roles for current user from conn.

Link to this function is_all_granted?(conn, required_roles) View Source

Returns true if all of the required_roles are in users role, false if not

Checks if the current user on conn is logged in or not

Link to this function is_any_granted?(conn, required_roles) View Source

Returns true if one or more of the required_roles are in users role, false if not

Link to this function is_none_granted?(conn, required_roles) View Source

Returns true if none of the required_roles are in users role, false if not