Sha256: 82f4b37a42d27f7da6bf1ede95b57fa3a2064c956d9622e6d425b69b63a8357f
Contents?: true
Size: 1.38 KB
Versions: 12
Compression:
Stored size: 1.38 KB
Contents
module Eco module API class UseCases class DefaultCases class AppendUsergroupsCase < DefaultCase def process @cases.define("append-usergroups", type: :sync) do |entries, people, session, options, usecase| update = session.job_group("main").new("update", usecase: usecase, type: :update, sets: [:core, :details, :account]) strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict)) pgs = session.policy_groups entries.each.with_index do |entry, i| if person = people.find(entry, strict: strict_search) if person.account ini_pg_ids = person.account&.policy_group_ids || [] add = entry.internal_entry["policy_group_ids"].to_s.split("|").compact person.account.policy_group_ids = (ini_pg_ids | add).uniq person.account.permissions_custom = session.new_preset(person) unless options.dig(:exclude, :abilities) update.add(person) end else session.logger.error("This person does not exist: #{entry.to_s(:identify)}") end end end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems