Peacemaker.Permission (Peacemaker v3.3.5-rc.7) View Source

The Ecto Repo module for the "permission" table. This is meant to be a join table between Accounts and Permissibles, and the lower level module for adding & removing permissions.

Link to this section Summary

Functions

Creates an association between an account and a permissible, ie: adding a permission.

Deletes the assocation between an account and a permissible, ie: remove a permission.

Finds a single permission given an account_id and a permissible_id

Looks through the given Account's permissbiles for the given permissible type.

Link to this section Types

Specs

t() :: %Peacemaker.Permission{
  __meta__: term(),
  account: term(),
  account_id: String.t(),
  id: term(),
  permissible: term(),
  permissible_id: String.t()
}

Link to this section Functions

Link to this function

create(account, permissible)

View Source

Specs

create(Peacemaker.Account.t(), Peacemaker.Permissible.t()) ::
  {:ok, t()} | {:error, Ecto.Changeset.t()}
create(Peacemaker.Account.t(), Peacemaker.Permissible.t()) ::
  {:ok | :error, Peacemaker.Permissible.t() | String.t()}

Creates an association between an account and a permissible, ie: adding a permission.

Link to this function

delete(account, permissible)

View Source

Deletes the assocation between an account and a permissible, ie: remove a permission.

Specs

find_one(account_id: String.t(), permissible_id: String.t()) :: t()

Finds a single permission given an account_id and a permissible_id

Link to this function

has_permissible?(account, permissible_name)

View Source

Specs

has_permissible?(Peacemaker.Account.t(), String.t()) :: boolean()

Looks through the given Account's permissbiles for the given permissible type.

For a list of valid permissible types, see Permissibles.list_permissibles/1