Sha256: 33843963ddf35e651d73be2905fb751bfa5665a4cafff656a2071a79706d53c3

Contents?: true

Size: 693 Bytes

Versions: 4

Compression:

Stored size: 693 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ReportingProposals
    module Admin
      module PermissionsOverride
        extend ActiveSupport::Concern

        included do
          private

          def valuator_can_unassign_valuator_from_proposals?
            can_unassign_valuator_from_proposals? if user == context.fetch(:valuator, nil)

            can_add_valuators?
          end

          def can_add_valuators?
            return unless permission_action.action == :assign_to_valuator && permission_action.subject == :proposals

            toggle_allow(Decidim::ReportingProposals.valuators_assign_other_valuators)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.5.1 app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb
decidim-reporting_proposals-0.5.0 app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb
decidim-reporting_proposals-0.4.2 app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb
decidim-reporting_proposals-0.2.0 app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb