Class: Decidim::Votings::Admin::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-elections/app/permissions/decidim/votings/admin/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
19
20
21
22
23
24
25
# File 'decidim-elections/app/permissions/decidim/votings/admin/permissions.rb', line 7

def permissions
  return permission_action unless user
  return user_allowed_to_read_admin_dashboard? if read_admin_dashboard_action?
  return permission_action unless permission_action.scope == :admin

  user_can_enter_space_area?

  return permission_action if voting && !voting.is_a?(Decidim::Votings::Voting)

  unless user_can_read_votings_admin_dashboard?
    disallow!
    return permission_action
  end

  allowed_read_participatory_space?
  allowed_voting_action?

  permission_action
end