Module: Eco::API::MicroCases::People::Integrity::FixDefaultGroup
- Included in:
- Eco::API::MicroCases::People::Integrity
- Defined in:
- lib/eco/api/microcases/people/integrity/fix_default_group.rb
Instance Method Summary collapse
-
#fix_default_group(entry, person, options) ⇒ Object
If defined, it sets the default usergroup, only when the
policy_group_idswas not part of the input data.
Instance Method Details
#fix_default_group(entry, person, options) ⇒ Object
If defined, it sets the default usergroup, only when the policy_group_ids was not part of the input data.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/eco/api/microcases/people/integrity/fix_default_group.rb', line 11 def fix_default_group(entry, person, ) return if .dig(:exclude, :account) return if .dig(:exclude, :policy_groups) && !person.new? end_pg_ids = person.account.policy_group_ids if person.account_added? && __def_usergroup_id && !entry.policy_group_ids? # on account creation, if missing policy_group_ids column in the input # use default_usergroup, if it's defined end_pg_ids = [__def_usergroup_id] end person.account.policy_group_ids = end_pg_ids end |