Class: Pageflow::MembershipPolicy Private

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/pageflow/membership_policy.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Scope

Instance Method Summary collapse

Constructor Details

#initialize(user, membership) ⇒ MembershipPolicy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MembershipPolicy.



47
48
49
50
# File 'app/policies/pageflow/membership_policy.rb', line 47

def initialize(user, membership)
  @user = user
  @membership = membership
end

Instance Method Details

#create?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


52
53
54
55
56
57
58
# File 'app/policies/pageflow/membership_policy.rb', line 52

def create?
  if @membership.entity_type == 'Pageflow::Account'
    create_for_account?
  else
    create_for_entry?
  end
end

#destroy?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


68
69
70
71
72
73
74
# File 'app/policies/pageflow/membership_policy.rb', line 68

def destroy?
  if @membership.entity_type == 'Pageflow::Account'
    destroy_for_account?
  else
    destroy_for_entry?
  end
end

#edit_role?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


60
61
62
63
64
65
66
# File 'app/policies/pageflow/membership_policy.rb', line 60

def edit_role?
  if @membership.entity_type == 'Pageflow::Account'
    edit_role_on_account?
  else
    edit_role_on_entry?
  end
end