Class: Decidim::Meetings::Admin::Permissions

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

Instance Method Summary collapse

Instance Method Details

#permissionsObject



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

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

  return Decidim::Meetings::Admin::MeetingPermissions.new(user, permission_action, context).permissions if subject == :meeting
  return Decidim::Meetings::Admin::QuestionnairePermissions.new(user, permission_action, context).permissions if subject == :questionnaire
  return Decidim::Meetings::Admin::AgendaPermissions.new(user, permission_action, context).permissions if subject == :agenda

  toggle_allow(poll.present? && meeting.present?) if subject == :poll && action == :update

  permission_action
end