AuthShield v0.0.4 AuthShield.Resources.Roles View Source
Roles are used to define an group of permissions that the user has. It usually works as an definition of the person function in the company.
We use this to implement and Role-based access control (RBAC).
RBAC is a policy-neutral access-control mechanism defined around roles and privileges.
The components of RBAC such as role-permissions and user-role relationships make it simple to perform user assignments.
This module implements an interface to deal with database transactions as inserts, updates, deletes, etc.
Link to this section Summary
Functions
Changes an set of AuthShield.Resources.Schemas.Permission of the AuthShield.Resources.Schemas.Role.
Changes an set of AuthShield.Resources.Schemas.Permission of the AuthShield.Resources.Schemas.Role.
Deletes a AuthShield.Resources.Schemas.Role register.
Deletes a AuthShield.Resources.Schemas.Role register.
Gets a AuthShield.Resources.Schemas.Role register by its filters.
Gets a Role register by its filters.
Creates a new AuthShield.Resources.Schemas.Role register.
Creates a new AuthShield.Resources.Schemas.Role register.
Returns a list of AuthShield.Resources.Schemas.Role by its filters
Updates a AuthShield.Resources.Schemas.Role register.
Updates a AuthShield.Resources.Schemas.Role register.
Link to this section Functions
change_permissions(role, permissions)
View Sourcechange_permissions( role :: AuthShield.Resources.Schemas.Role.t(), permissions :: [AuthShield.Resources.Schemas.Permission.t()] ) :: {:ok, AuthShield.Resources.Schemas.Role.t()} | {:error, Ecto.Changeset.t()}
Changes an set of AuthShield.Resources.Schemas.Permission of the AuthShield.Resources.Schemas.Role.
It will add or remove permissions from the list, so you should pass the all list every time you use this function.
Exemples:
AuthShield.Resources.Roles.change_permissions(role, permissions)
change_permissions!(role, permissions)
View Sourcechange_permissions!( role :: AuthShield.Resources.Schemas.Role.t(), permissions :: [AuthShield.Resources.Schemas.Permission.t()] ) :: AuthShield.Resources.Schemas.Role.t() | no_return()
Changes an set of AuthShield.Resources.Schemas.Permission of the AuthShield.Resources.Schemas.Role.
Similar to appeappend_permissionnd_role/2 but returns the struct or raises if the changeset is invalid.
Deletes a AuthShield.Resources.Schemas.Role register.
Exemples:
AuthShield.Resources.Roles.delete(role)
Deletes a AuthShield.Resources.Schemas.Role register.
Similar to delete/1 but returns the struct or raises if the changeset is invalid.
Gets a AuthShield.Resources.Schemas.Role register by its filters.
Exemples:
AuthShield.Resources.Roles.get_by(name: "admin")
Gets a Role register by its filters.
Similar to get_by/1 but returns the struct or raises if the changeset is invalid.
Creates a new AuthShield.Resources.Schemas.Role register.
Exemples:
AuthShield.Resources.Roles.insert(%{name: "admin", description: "System administrator"})
Creates a new AuthShield.Resources.Schemas.Role register.
Similar to insert/1 but returns the struct or raises if the changeset is invalid.
Returns a list of AuthShield.Resources.Schemas.Role by its filters
Exemples:
# Getting the all list
AuthShield.Resources.Roles.list()
# Filtering the list by field
AuthShield.Resources.Roles.list(name: "admin")
Updates a AuthShield.Resources.Schemas.Role register.
Exemples:
AuthShield.Resources.Roles.update(role, %{name: "sales", description: "The sales user roles"})
Updates a AuthShield.Resources.Schemas.Role register.
Similar to update/2 but returns the struct or raises if the changeset is invalid.