Auth.Permission (auth v1.6.6)

Defines permissions schema and CRUD functions

Link to this section Summary

Functions

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

Creates a permission.

Deletes a permission.

Gets a single permission.

Returns the list of permissions.

Updates a permission.

Link to this section Functions

Link to this function

change_permission(permission, attrs \\ %{})

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

examples

Examples

iex> change_permission(permission)
%Ecto.Changeset{data: %Permission{}}
Link to this function

create_permission(attrs \\ %{})

Creates a permission.

examples

Examples

iex> create_permission(%{field: value})
{:ok, %Permission{}}

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

delete_permission(permission)

Deletes a permission.

examples

Examples

iex> delete_permission(permission)
{:ok, %Permission{}}

iex> delete_permission(permission)
{:error, %Ecto.Changeset{}}
Link to this function

get_permission!(id)

Gets a single permission.

Raises Ecto.NoResultsError if the Permission does not exist.

examples

Examples

iex> get_permission!(123)
%Permission{}

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

list_permissions()

Returns the list of permissions.

examples

Examples

iex> list_permissions()
[%Permission{}, ...]
Link to this function

update_permission(permission, attrs)

Updates a permission.

examples

Examples

iex> update_permission(permission, %{field: new_value})
{:ok, %Permission{}}

iex> update_permission(permission, %{field: bad_value})
{:error, %Ecto.Changeset{}}