Sha256: a2378094b8b6f5c33ef41d39697762e217811620f59b4c30037db1bdcb920ac4

Contents?: true

Size: 595 Bytes

Versions: 14

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Surveys
    class Permissions < Decidim::DefaultPermissions
      def permissions
        return permission_action unless user

        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 != :survey

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

        permission_action
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-surveys-0.15.2 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.15.1 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.15.0 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.14.4 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.14.3 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.14.2 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.14.1 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.13.1 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.12.2 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.13.0 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.12.1 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.13.0.pre1 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.12.0 app/permissions/decidim/surveys/permissions.rb
decidim-surveys-0.12.0.pre app/permissions/decidim/surveys/permissions.rb