Class: Decidim::Consultations::Admin::Permissions

Inherits:
DefaultPermissions
  • Object
show all
Defined in:
app/permissions/decidim/consultations/admin/permissions.rb

Instance Method Summary collapse

Instance Method Details

#permissionsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/permissions/decidim/consultations/admin/permissions.rb', line 7

def permissions
  return permission_action unless user
  return permission_action unless permission_action.scope == :admin

  return permission_action if consultation && (!consultation.is_a?(Decidim::Consultation) && !consultation.is_a?(Decidim::Consultations::Question))

  unless user.admin?
    disallow!
    return permission_action
  end

  user_can_enter_space_area?

  if read_admin_dashboard_action?
    allow!
    return permission_action
  end

  allowed_read_participatory_space?
  allowed_action_on_component?
  allowed_consultation_action?
  allowed_question_action?
  allowed_response_action?
  allowed_response_group_action?

  permission_action
end