View Source Membership.Role (ex_membership v1.0.3)
Role is main representation of feature flags assigned to a role
Summary
Types
Functions
@spec grant(t(), t() | Membership.Feature.t()) :: Member.t()
Grant given grant type to a feature.
Examples
Function accepts either Membership.Role
or Membership.Feature
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 feature to a given role
iex> Membership.Role.grant(%Membership.Feature{id: 1}, %Membership.Role{id: 1})
To grant particular feature to a given role
iex> Membership.Role.grant(%Membership.Role{id: 1}, %Membership.Feature{id: 1})
@spec revoke(t(), t() | Membership.Feature.t()) :: Member.t()
Revoke given grant type from a member.
Examples
Function accepts either Membership.Role
or Membership.Feature
grants.
Function is directly opposite of Membership.Member.grant/2
To revoke particular feature from a given plan
iex> Membership.Role.revoke(%Membership.Feature{id: 1}, %Membership.Role{id: 1})
To revoke particular plan from a given feature
iex> Membership.Role.revoke(%Membership.Role{id: 1}, %Membership.Feature{id: 1})