Class: Locomotive::AccountPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/locomotive/account_policy.rb

Instance Attribute Summary

Attributes inherited from ApplicationPolicy

#membership, #resource

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#edit?, #initialize, #new?, #site_admin?, #site_admin_or_designer?, #site_staff?, #super_admin?

Constructor Details

This class inherits a constructor from Locomotive::ApplicationPolicy

Instance Method Details

#create?Boolean

Returns:



12
13
14
15
# File 'app/policies/locomotive/account_policy.rb', line 12

def create?
  # everybody can create an account
  true
end

#destroy?Boolean

Returns:



21
22
23
24
# File 'app/policies/locomotive/account_policy.rb', line 21

def destroy?
  # can not delete himself/herself
  super_admin? && @resource._id != membership.
end

#index?Boolean

Returns:



4
5
6
# File 'app/policies/locomotive/account_policy.rb', line 4

def index?
  super_admin?
end

#show?Boolean

Returns:



8
9
10
# File 'app/policies/locomotive/account_policy.rb', line 8

def show?
  super_admin? || @resource._id == membership.
end

#update?Boolean

Returns:



17
18
19
# File 'app/policies/locomotive/account_policy.rb', line 17

def update?
  super_admin? || @resource._id == membership.
end