Class: Decidim::Elections::TrusteeZone::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-elections/app/permissions/decidim/elections/trustee_zone/permissions.rb

Instance Method Summary collapse

Methods inherited from DefaultPermissions

#initialize

Constructor Details

This class inherits a constructor from Decidim::DefaultPermissions

Instance Method Details

#permissionsObject


7
8
9
10
11
12
13
14
15
16
17
18
# File 'decidim-elections/app/permissions/decidim/elections/trustee_zone/permissions.rb', line 7

def permissions
  return permission_action unless permission_action.scope == :trustee_zone

  case permission_action.subject
  when :trustee, :election
    toggle_allow(trustee_for_user?) if [:view, :update].member?(permission_action.action)
  when :user
    allow! if permission_action.action == :update_profile
  end

  permission_action
end