Class: Decidim::Conferences::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-conferences/app/permissions/decidim/conferences/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
51
52
53
54
55
56
57
58
# File 'decidim-conferences/app/permissions/decidim/conferences/permissions.rb', line 6

def permissions
  user_can_enter_space_area?

  return permission_action if conference && !conference.is_a?(Decidim::Conference)

  if read_admin_dashboard_action?
    user_can_read_admin_dashboard?
    return permission_action
  end

  if permission_action.scope == :public
    public_list_conferences_action?
    public_read_conference_action?
    public_list_speakers_action?
    public_list_program_action?
    public_list_media_links_action?
    public_list_registration_types_action?
    public_report_content_action?

    can_join_conference?
    can_leave_conference?
    can_decline_invitation?

    return permission_action
  end

  return permission_action unless user

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

  user_can_read_conference_list?
  user_can_read_current_conference?
  user_can_read_conference_registrations?
  user_can_export_conference_registrations?
  user_can_confirm_conference_registration?
  user_can_create_conference?

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

  return permission_action unless conference

  moderator_action?
  collaborator_action?
  valuator_action?
  conference_admin_action?

  permission_action
end