Auth.Role (auth v1.6.6)

Defines roles schema and CRUD functions

Link to this section Summary

Functions

Returns an %Ecto.Changeset{} for tracking role changes.

Creates a role.

Deletes a role.

Gets a single role.

Returns the list of roles.

get all roles for apps owned + default roles

Updates a role.

Link to this section Functions

Link to this function

change_role(role, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking role changes.

examples

Examples

iex> change_role(role)
%Ecto.Changeset{data: %Role{}}
Link to this function

create_role(attrs \\ %{})

Creates a role.

examples

Examples

iex> create_role(%{field: value})
{:ok, %Role{}}

iex> create_role(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

delete_role(role)

Deletes a role.

examples

Examples

iex> delete_role(role)
{:ok, %Role{}}

iex> delete_role(role)
{:error, %Ecto.Changeset{}}

Gets a single role.

Raises Ecto.NoResultsError if the Role does not exist.

examples

Examples

iex> get_role!(123)
%Role{}

iex> get_role!(456)
** (Ecto.NoResultsError)
Link to this function

get_role!(id, person_id)

Link to this function

list_role_ids_for_app(app_id)

Returns the list of roles.

examples

Examples

iex> list_roles()
[%Role{}, ...]
Link to this function

list_roles_for_app(app_id)

Link to this function

list_roles_for_apps(app_ids)

get all roles for apps owned + default roles

Link to this function

strip_meta(struct)

Link to this function

update_role(role, attrs)

Updates a role.

examples

Examples

iex> update_role(role, %{field: new_value})
{:ok, %Role{}}

iex> update_role(role, %{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

upsert_role(role)