Class: Pageflow::MembershipPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Pageflow::MembershipPolicy
- Defined in:
- app/policies/pageflow/membership_policy.rb
Defined Under Namespace
Classes: Scope
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #edit_role? ⇒ Boolean
-
#initialize(user, membership) ⇒ MembershipPolicy
constructor
A new instance of MembershipPolicy.
Constructor Details
#initialize(user, membership) ⇒ MembershipPolicy
Returns a new instance of MembershipPolicy.
45 46 47 48 |
# File 'app/policies/pageflow/membership_policy.rb', line 45 def initialize(user, membership) @user = user @membership = membership end |
Instance Method Details
#create? ⇒ Boolean
50 51 52 53 54 55 56 |
# File 'app/policies/pageflow/membership_policy.rb', line 50 def create? if @membership.entity_type == 'Pageflow::Account' create_for_account? else create_for_entry? end end |
#destroy? ⇒ Boolean
66 67 68 69 70 71 72 |
# File 'app/policies/pageflow/membership_policy.rb', line 66 def destroy? if @membership.entity_type == 'Pageflow::Account' destroy_for_account? else destroy_for_entry? end end |
#edit_role? ⇒ Boolean
58 59 60 61 62 63 64 |
# File 'app/policies/pageflow/membership_policy.rb', line 58 def edit_role? if @membership.entity_type == 'Pageflow::Account' edit_role_on_account? else edit_role_on_entry? end end |