AuthShield v0.0.4 AuthShield.Resources.Schemas.Role View Source

Defines all roles that an user can have.

We use it to create a role-based access control (RBAC) in order to restrict system access to users that has specif roles.

Link to this section Summary

Types

t()

Abstract role module type.

Functions

Generates an Ecto.Changeset struct with the changes.

Generates an Ecto.Changeset struct with the changes.

Link to this section Types

Link to this type

t()

View Source
t() :: %AuthShield.Resources.Schemas.Role{
  __meta__: term(),
  description: String.t(),
  id: binary(),
  inserted_at: NaiveDateTime.t(),
  name: String.t(),
  permissions: [AuthShield.Resources.Schemas.Permission.t()],
  updated_at: NaiveDateTime.t(),
  users: [AuthShield.Resources.Schemas.User.t()]
}

Abstract role module type.

Link to this section Functions

Link to this function

changeset(model, params)

View Source
changeset(model :: t(), params :: map()) :: Ecto.Changeset.t()

Generates an Ecto.Changeset struct with the changes.

Link to this function

changeset_permissions(model, permissions)

View Source
changeset_permissions(
  model :: t(),
  permissions :: [AuthShield.Resources.Schemas.Permission.t()]
) :: Ecto.Changeset.t()

Generates an Ecto.Changeset struct with the changes.

It changes the related permissions list.