Sha256: f334d2f370071ee1b48e56fc077cd2e7eecde9b0d6d262bd132a6dded8099765
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
module Eco module API class UseCases class DefaultCases class ChangeEMailCase < DefaultCase def process @cases.define("change-email", type: :sync) do |entries, people, session, options, usecase| remove = session.job_group("main").new("remove account", usecase: usecase, type: :update, sets: :account) change = session.job_group("main").new("change email", usecase: usecase, type: :update, sets: :core) add_account = session.job_group("post").new("add account", usecase: usecase, type: :update, sets: :account) strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict)) entries.each.with_index do |entry, i| person = people.find(entry, strict: strict_search) if !person session.logger.error("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}") else unless entry.email.downcase == person.email account = person.account person.account = nil remove.add(person) new_email = entry.email change.add(person) do |person| person.email = new_email end add_account.add(person) do |person| person.account = account end end end end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eco-helpers-0.9.3 | lib/eco/api/usecases/default_cases/change_email_case.rb |