terminator v0.5.2 Terminator.Performer View Source

Performer is a main actor for determining abilities

Link to this section Summary

Types

t()

A performer struct

Link to this section Types

Link to this type

t() View Source
t() :: %Terminator.Performer{
  __meta__: term(),
  abilities: term(),
  entities: term(),
  id: term(),
  inserted_at: term(),
  roles: term(),
  updated_at: term()
}

A performer struct

Link to this section Functions

Link to this function

changeset(struct, params \\ %{}) View Source

Grant given grant type to a performer.

Examples

Function accepts either Terminator.Ability or Terminator.Role grants. Function is merging existing grants with the new ones, so calling grant with same grants will not duplicate entries in table.

To grant particular ability to a given performer

iex> Terminator.Performer.grant(%Terminator.Performer{id: 1}, %Terminator.Ability{id: 1})

To grant particular role to a given performer

iex> Terminator.Performer.grant(%Terminator.Performer{id: 1}, %Terminator.Role{id: 1})
Link to this function

grant(performer, ability, entity) View Source

Link to this function

load_performer_entities(performer, map) View Source

Revoke given grant type from a performer.

Examples

Function accepts either Terminator.Ability or Terminator.Role grants. Function is directly opposite of Terminator.Performer.grant/2

To revoke particular ability from a given performer

iex> Terminator.Performer.revoke(%Terminator.Performer{id: 1}, %Terminator.Ability{id: 1})

To revoke particular role from a given performer

iex> Terminator.Performer.revoke(%Terminator.Performer{id: 1}, %Terminator.Role{id: 1})
Link to this function

revoke(performer, ability, entity) View Source