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