View Source Glific.AccessControl.UserRole (Glific v5.1.6)
A pipe for managing the user roles
Link to this section Summary
Functions
Standard changeset pattern we use for all data types
Creates a access control.
Delete user roles
Update user roles based on add_role_ids and delete_role_ids and return number_deleted as integer and roles added as access_controls
Link to this section Types
@type t() :: %Glific.AccessControl.UserRole{ __meta__: Ecto.Schema.Metadata.t(), id: non_neg_integer() | nil, organization: Glific.Partners.Organization.t() | Ecto.Association.NotLoaded.t() | nil, organization_id: non_neg_integer() | nil, role: Glific.AccessControl.Role.t() | Ecto.Association.NotLoaded.t() | nil, role_id: term(), user: Glific.Users.User.t() | Ecto.Association.NotLoaded.t() | nil, user_id: term() }
Link to this section Functions
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Standard changeset pattern we use for all data types
@spec create_user_role(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Creates a access control.
examples
Examples
iex> create_user_role(%{field: value})
{:ok, %UserRole{}}
iex> create_user_role(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Delete user roles
Update user roles based on add_role_ids and delete_role_ids and return number_deleted as integer and roles added as access_controls