AuthShield v0.0.2 AuthShield.Resources.Permissions View Source

Permissions are used to define what a set of roles can do in the system.

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

Link to this section Functions

Deletes a AuthShield.Resources.Schemas.Permission register.

Exemples:

  AuthShield.Resources.Permissions.delete(permission)

Deletes a AuthShield.Resources.Schemas.Permission register.

Similar to delete/1 but returns the struct or raises if the changeset is invalid.

Gets a AuthShield.Resources.Schemas.Permission register by its filters.

Exemples:

  AuthShield.Resources.Permissions.get_by(name: "can_create_users")

Gets a AuthShield.Resources.Schemas.Permission 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.Permission register.

Exemples:

  AuthShield.Resources.Permissions.insert(%{
    name: "can_create_users",
    description: "Has permission to create users on the system"
  })

Creates a new AuthShield.Resources.Schemas.Permission register.

Similar to insert/1 but returns the struct or raises if the changeset is invalid.

Returns a list of AuthShield.Resources.Schemas.Permission by its filters

Exemples:

  # Getting the all list
  AuthShield.Resources.Permissions.list()

  # Filtering the list by field
  AuthShield.Resources.Permissions.list(name: "can_create_users")
Link to this function

update(permission, params)

View Source

Updates a AuthShield.Resources.Schemas.Permission register.

Exemples:

  AuthShield.Resources.Permissions.update(permission, %{
    name: "can_update_users",
    description: "Has permission to update users on the system"
  })
Link to this function

update!(permission, params)

View Source

Updates a AuthShield.Resources.Schemas.Permission register.

Similar to update/2 but returns the struct or raises if the changeset is invalid.