Sha256: afb2a0f00ef05dcdb3b82bb9224b8a47a74ea85f4bdf1b570da1b9dd8f74eab6
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 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"].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("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}") end end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eco-helpers-1.3.5 | lib/eco/api/usecases/default_cases/append_usergroups_case.rb |