Class: Decidim::Surveys::Admin::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-surveys/app/permissions/decidim/surveys/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
26
# File 'decidim-surveys/app/permissions/decidim/surveys/admin/permissions.rb', line 7

def permissions
  return permission_action unless user

  return permission_action unless permission_action.scope == :admin

  case permission_action.subject
  when :questionnaire
    case permission_action.action
    when :export_answers, :update
      permission_action.allow!
    end
  when :questionnaire_answers
    case permission_action.action
    when :index, :show, :export_response
      permission_action.allow!
    end
  end

  permission_action
end