terminator v0.5.2 Terminator.Performer View Source
Performer is a main actor for determining abilities
Link to this section Summary
Link to this section Types
A performer struct
Link to this section Functions
Link to this function
changeset(struct, params \\ %{}) View Source
Link to this function
grant(performer, role)
View Source
grant(performer, role)
View Source
grant(Terminator.Performer.t(), Terminator.Ability.t() | Terminator.Role.t()) ::
Terminator.Performer.t()
grant(Terminator.Performer.t(), Terminator.Ability.t() | Terminator.Role.t()) :: Terminator.Performer.t()
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
Link to this function
revoke(performer, role)
View Source
revoke(performer, role)
View Source
revoke(Terminator.Performer.t(), Terminator.Ability.t() | Terminator.Role.t()) ::
Terminator.Performer.t()
revoke(Terminator.Performer.t(), Terminator.Ability.t() | Terminator.Role.t()) :: Terminator.Performer.t()
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
Link to this function