Sha256: 7f5bfa9a85f5f90c994eea8e714f5d29bde4868d56f507203508b9ab55bce78a

Contents?: true

Size: 653 Bytes

Versions: 23

Compression:

Stored size: 653 Bytes

Contents

module Eco
  module API
    class MicroCases
      # It preserves the usergroups of `person` and appends those defined in `policy_group_ids` of the `entry`
      # @param entry [PersonEntry] the input entry with the data we should set on person.
      # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
      # @param options [Hash] the options.
      def append_usergroups(entry, person, options)
        return if options.dig(:exclude, :account)
        return unless person.account

        person.account.policy_group_ids |= entry.policy_group_ids
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
eco-helpers-3.0.1 lib/eco/api/microcases/append_usergroups.rb
eco-helpers-3.0.0 lib/eco/api/microcases/append_usergroups.rb
eco-helpers-2.7.25 lib/eco/api/microcases/append_usergroups.rb