lib/eco/api/microcases/set_account.rb in eco-helpers-1.5.1 vs lib/eco/api/microcases/set_account.rb in eco-helpers-1.5.2
- old
+ new
@@ -1,32 +1,20 @@
module Eco
module API
class MicroCases
- #self.define("set_account") do |entry, person, session, options|
-
# @param entry [PersonEntry] the input entry with the data we should set on person.
- # @param person [Person] the person we want to update, carrying the changes to be done.
- # @param options [Hash] the options
+ # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
+ # @param options [Hash] the options.
def set_account(entry, person, options)
unless options.dig(:exclude, :account)
- ini_pg_ids = person.account&.policy_group_ids || []
+ entry.set_account(person, exclude: micro.account_excluded(person, options))
- account_excluded = []
- if options.dig(:exclude, :policy_groups) && !person.new?
- account_excluded.push("policy_group_ids")
- end
-
- entry.set_account(person, exclude: account_excluded)
-
- session.microcases.set_default_group(entry, person, session, options)
-
- unless options.dig(:exclude, :abilities) && !person.new?
- person.account.permissions_custom = session.new_preset(person)
- end
-
- session.microcases.set_default_tag(entry, person, session, options)
person.account.send_invites = options[:send_invites] if options.key?(:send_invites)
+ micro.refresh_default_tag(entry, person, options)
+ micro.fix_default_group(entry, person, options)
+ micro.refresh_abilities(person, options)
end
end
+
end
end
end