Class: Decidim::Surveys::Permissions

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

def permissions
  return permission_action unless user || context[:current_settings].allow_unregistered?

  return Decidim::Surveys::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
  return permission_action if permission_action.scope != :public

  return permission_action if permission_action.subject != :questionnaire

  permission_action.allow! if permission_action.action == :answer

  permission_action
end