Class: Decidim::Assemblies::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-assemblies/app/permissions/decidim/assemblies/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


6
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'decidim-assemblies/app/permissions/decidim/assemblies/permissions.rb', line 6

def permissions
  user_can_enter_space_area?

  return permission_action if assembly && !assembly.is_a?(Decidim::Assembly)

  if read_admin_dashboard_action?
    user_can_read_admin_dashboard?
    return permission_action
  end

  if permission_action.scope == :public
    public_list_assemblies_action?
    public_read_assembly_action?
    public_list_members_action?
    public_report_content_action?
    return permission_action
  end

  return permission_action unless user

  if !has_manageable_assemblies? && !user.admin?
    disallow!
    return permission_action
  end
  return permission_action unless permission_action.scope == :admin

  user_can_read_assembly_list?
  user_can_list_assembly_list?
  user_can_read_current_assembly?
  user_can_create_assembly?
  user_can_read_assemblies_setting?

  # org admins and space admins can do everything in the admin section
  org_admin_action?
  assemblies_type_action?

  return permission_action unless assembly

  moderator_action?
  collaborator_action?
  valuator_action?
  assembly_admin_action?

  permission_action
end