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

Inherits:
DefaultPermissions
  • Object
show all
Defined in:
app/permissions/decidim/surveys/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
# File '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