eco-helpers 2.7.24 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +16 -1
- data/eco-helpers.gemspec +12 -11
- data/lib/eco/api/common/session/base_session.rb +1 -0
- data/lib/eco/api/common/session/helpers/prompt_user.rb +3 -1
- data/lib/eco/api/common/session/helpers.rb +0 -9
- data/lib/eco/api/common/session/logger.rb +2 -0
- data/lib/eco/api/microcases/account_excluded.rb +2 -0
- data/lib/eco/api/microcases/append_usergroups.rb +4 -6
- data/lib/eco/api/microcases/core_excluded.rb +2 -1
- data/lib/eco/api/microcases/fix_default_group.rb +13 -14
- data/lib/eco/api/microcases/people_cache.rb +10 -3
- data/lib/eco/api/microcases/people_load.rb +21 -7
- data/lib/eco/api/microcases/people_refresh.rb +11 -3
- data/lib/eco/api/microcases/people_search.rb +24 -10
- data/lib/eco/api/microcases/person_update.rb +8 -4
- data/lib/eco/api/microcases/preserve_default_tag.rb +9 -9
- data/lib/eco/api/microcases/preserve_policy_groups.rb +14 -14
- data/lib/eco/api/microcases/refresh_default_tag.rb +11 -12
- data/lib/eco/api/microcases/s3upload_targets.rb +3 -2
- data/lib/eco/api/microcases/set_account.rb +6 -7
- data/lib/eco/api/microcases/strict_search.rb +0 -1
- data/lib/eco/api/microcases/take_email_from_account.rb +46 -27
- data/lib/eco/api/microcases/with_each.rb +15 -5
- data/lib/eco/api/microcases/with_each_leaver.rb +1 -1
- data/lib/eco/api/microcases/with_each_present.rb +6 -2
- data/lib/eco/api/microcases/with_each_starter.rb +7 -3
- data/lib/eco/api/microcases/with_each_subordinate.rb +0 -1
- data/lib/eco/api/microcases/with_supervisor.rb +0 -1
- data/lib/eco/api/microcases.rb +0 -2
- data/lib/eco/api/organization/login_providers.rb +23 -5
- data/lib/eco/api/session.rb +1 -1
- data/lib/eco/cli_default/input.rb +17 -14
- data/lib/eco/cli_default/options.rb +41 -23
- data/lib/eco/cli_default/people.rb +50 -12
- data/lib/eco/cli_default/people_filters.rb +1 -1
- data/lib/eco/cli_default/workflow.rb +4 -0
- data/lib/eco/data/files/helpers.rb +1 -0
- data/lib/eco/version.rb +1 -1
- data/lib/eco-helpers.rb +4 -0
- metadata +18 -60
- /data/{.markdownlint.jsonc → .markdownlint.json} +0 -0
@@ -5,15 +5,14 @@ module Eco
|
|
5
5
|
# @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
|
6
6
|
# @param options [Hash] the options.
|
7
7
|
def set_account(entry, person, options)
|
8
|
-
|
9
|
-
entry.set_account(person, exclude: micro.account_excluded(person, options))
|
8
|
+
return if options.dig(:exclude, :account)
|
10
9
|
|
11
|
-
|
12
|
-
micro.refresh_default_tag(entry, person, options)
|
13
|
-
micro.fix_default_group(entry, person, options)
|
14
|
-
end
|
15
|
-
end
|
10
|
+
entry.set_account(person, exclude: micro.account_excluded(person, options))
|
16
11
|
|
12
|
+
person.account.send_invites = options[:send_invites] if options.key?(:send_invites)
|
13
|
+
micro.refresh_default_tag(entry, person, options)
|
14
|
+
micro.fix_default_group(entry, person, options)
|
15
|
+
end
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:disable Metrics/BlockNesting, Layout/LineLength
|
1
2
|
module Eco
|
2
3
|
module API
|
3
4
|
class MicroCases
|
@@ -7,21 +8,25 @@ module Eco
|
|
7
8
|
# - If `original_doc["account"]` is `nil` (no account on server side), this case will not do anything.
|
8
9
|
# - If the `target_email` and the `current_email` are the same or empty, this case will not do anything.
|
9
10
|
# @note
|
10
|
-
# - **It does not do the final update to the server to the `target_email`**.
|
11
|
+
# - **It does not do the final update to the server to the `target_email`**.
|
12
|
+
# You will need to do this part yourself.
|
11
13
|
# - You would call this function only when you got an error of `email already taken`.
|
12
14
|
# - If the `target_email` is associated to a user in the same org, this will fail.
|
13
|
-
# @param person [Ecoportal::API::V1::Person] the person we want to update,
|
14
|
-
#
|
15
|
+
# @param person [Ecoportal::API::V1::Person] the person we want to update,
|
16
|
+
# carrying the changes to be done.
|
17
|
+
# @param dest_email [String, Proc] the email that we will move the other account to,
|
18
|
+
# when we free up `target_email`.
|
15
19
|
# @param target_email [String] the email that we want to free up from another account and bring to ours.
|
16
20
|
# If it's empty, the `person.email` will be used instead.
|
17
21
|
# @param options [Hash] the options.
|
18
22
|
# @param current_email [String] the email that the person's account is currently linked.
|
19
|
-
# As the current email should be associated with this person's account on server side,
|
23
|
+
# As the current email should be associated with this person's account on server side,
|
24
|
+
# we use `original_doc["email"]`.
|
20
25
|
# @param context [String] main core part of logs. Provides context to the logs.
|
21
26
|
def take_email_from_account(person, dest_email:, target_email: nil, options: {}, context: "Session")
|
22
27
|
return false if options.dig(:exclude, :account)
|
23
|
-
return false unless account = person.account
|
24
|
-
return false unless had_account = person.original_doc["account"]
|
28
|
+
return false unless (account = person.account)
|
29
|
+
return false unless (had_account = person.original_doc["account"]) # rubocop:disable Lint/UselessAssignment
|
25
30
|
|
26
31
|
target_email ||= person.email
|
27
32
|
account_email = person.original_doc["email"]
|
@@ -36,16 +41,16 @@ module Eco
|
|
36
41
|
return false if dest_email.to_s.strip.empty?
|
37
42
|
end
|
38
43
|
|
39
|
-
account_json
|
44
|
+
account_json = _take_email_account_json(account)
|
40
45
|
person.email = account_email
|
41
46
|
|
42
|
-
if success = _take_email_remove_account!(person, context: context)
|
43
|
-
if success = _take_email_acquire_account!(person, target_email, account: {}, context: context)
|
44
|
-
if success = _take_email_email_free_up!(person, dest_email: dest_email, context: context)
|
45
|
-
if success = _take_email_remove_account!(person, context: context)
|
47
|
+
if (success = _take_email_remove_account!(person, context: context))
|
48
|
+
if (success = _take_email_acquire_account!(person, target_email, account: {}, context: context))
|
49
|
+
if (success = _take_email_email_free_up!(person, dest_email: dest_email, context: context))
|
50
|
+
if (success = _take_email_remove_account!(person, context: context))
|
46
51
|
# Bring back the original account
|
47
|
-
if success = _take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
48
|
-
success
|
52
|
+
if (success = _take_email_acquire_account!(person, account_email, account: account_json, context: context)) # rubocop:disable Style/SoleNestedConditional
|
53
|
+
success = true
|
49
54
|
person.email = target_email
|
50
55
|
end
|
51
56
|
end
|
@@ -55,41 +60,53 @@ module Eco
|
|
55
60
|
if reverted ||= _take_email_remove_account!(person, context: context)
|
56
61
|
reverted ||= _take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
57
62
|
end
|
58
|
-
|
63
|
+
|
64
|
+
unless reverted
|
65
|
+
msg = "Could not revert back to the original account #{person.identify}"
|
66
|
+
log(:debug) { msg }
|
67
|
+
puts msg
|
68
|
+
end
|
69
|
+
|
59
70
|
success = false
|
60
71
|
end
|
61
72
|
else # aquire other account
|
62
73
|
# restore
|
63
74
|
unless _take_email_acquire_account!(person, account_email, account: account_json, context: context)
|
64
|
-
|
75
|
+
msg = "Could not bring back the original account that "
|
76
|
+
msg << "we want to update the email to '#{target_email}' #{person.identify}"
|
77
|
+
log(:debug) { msg }
|
78
|
+
puts msg
|
65
79
|
end
|
80
|
+
|
66
81
|
success = false
|
67
82
|
end
|
68
83
|
end
|
84
|
+
|
69
85
|
success
|
70
86
|
end
|
71
87
|
|
72
88
|
private
|
73
89
|
|
74
90
|
def _take_email_account_json(account)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
91
|
+
JSON.parse(account.to_json).tap do |hash|
|
92
|
+
hash.delete("user_id")
|
93
|
+
hash.delete("permissions_merged")
|
94
|
+
hash.delete("permissions_preset")
|
95
|
+
hash.delete("prefilter")
|
96
|
+
|
97
|
+
if (pref = hash["preferences"])
|
98
|
+
hash["preferences"] = pref.reject do |attr, _value|
|
99
|
+
attr.start_with?("kiosk")
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
86
103
|
end
|
87
104
|
|
88
105
|
# Bring the account of the `target_email` taken, so we can change the email of this account
|
89
106
|
def _take_email_acquire_account!(person, target_email, account: {}, context: "Session")
|
90
107
|
person.account = account
|
91
108
|
person.account.send_invites = false
|
92
|
-
person.email
|
109
|
+
person.email = target_email
|
93
110
|
micro.person_update!(person, reason: "bring account with email '#{target_email}'", context: context)
|
94
111
|
end
|
95
112
|
|
@@ -108,3 +125,5 @@ module Eco
|
|
108
125
|
end
|
109
126
|
end
|
110
127
|
end
|
128
|
+
|
129
|
+
# rubocop:enable Metrics/BlockNesting, Layout/LineLength
|
@@ -33,6 +33,7 @@ module Eco
|
|
33
33
|
|
34
34
|
person.entry = entry
|
35
35
|
yield(entry, person) if block_given?
|
36
|
+
|
36
37
|
scoped << person
|
37
38
|
end.then do |all_people|
|
38
39
|
people.newFrom all_people.uniq
|
@@ -45,10 +46,11 @@ module Eco
|
|
45
46
|
unless error.is_a?(Eco::API::Organization::People::MultipleSearchResults)
|
46
47
|
raise "Expecting Eco::API::Organization::People::MultipleSearchResults. Given: #{error.class}"
|
47
48
|
end
|
49
|
+
|
48
50
|
@_with_each_prompts = 0 unless instance_variable_defined?(:@_with_each_prompts)
|
49
51
|
@_with_each_prompts += 1 if increase_count
|
50
52
|
|
51
|
-
lines
|
53
|
+
lines = []
|
52
54
|
lines << "\n(#{@_with_each_prompts}) #{error}\n"
|
53
55
|
lines << " #index - Select the correct person by its number index among the list above."
|
54
56
|
lines << " (I) - Just Skip/Ignore this one. I will deal with that input entry in another launch."
|
@@ -60,20 +62,27 @@ module Eco
|
|
60
62
|
res = res.upcase
|
61
63
|
|
62
64
|
if res.start_with?("I")
|
63
|
-
|
65
|
+
log(:info) { "Ignoring entry... #{entry&.to_s(:identify)}" }
|
66
|
+
|
64
67
|
nil
|
65
68
|
elsif res.start_with?("A")
|
66
|
-
|
69
|
+
log(:info) {
|
70
|
+
"All input entries with this same issue will be ignored for this launch"
|
71
|
+
}
|
72
|
+
|
67
73
|
@_skip_all_multiple_results = true
|
68
74
|
nil
|
69
75
|
elsif res.start_with?("C")
|
70
|
-
|
76
|
+
log(:info) {
|
77
|
+
"Creating new person...#{"for entry #{entry.to_s(:identify)}" if entry}"
|
78
|
+
}
|
79
|
+
|
71
80
|
session.new_person
|
72
81
|
elsif res.start_with?("B")
|
73
82
|
raise error
|
74
83
|
elsif res && !res.empty? && (pos = res.to_i rescue nil) && (pos < error.candidates.length) # rubocop:disable Style/RescueModifier
|
75
84
|
error.candidate(pos).tap do |person|
|
76
|
-
|
85
|
+
log(:info) { "Thanks!! You selected #{person.identify}" }
|
77
86
|
sleep(1.5)
|
78
87
|
end
|
79
88
|
else
|
@@ -82,6 +91,7 @@ module Eco
|
|
82
91
|
else
|
83
92
|
print "#{res} is not an option. "
|
84
93
|
end
|
94
|
+
|
85
95
|
puts "Please select one of the offered options..."
|
86
96
|
sleep(1)
|
87
97
|
_with_each_prompt_to_select_user(error, increase_count: false, entry: entry)
|
@@ -17,16 +17,20 @@ module Eco
|
|
17
17
|
micro.with_each(entries, people, options) do |entry, person|
|
18
18
|
if person.new?
|
19
19
|
if log_starter
|
20
|
-
|
20
|
+
log(:error) {
|
21
|
+
"This person does not exist: #{entry.to_s(:identify)}"
|
22
|
+
}
|
21
23
|
end
|
24
|
+
|
22
25
|
next
|
23
26
|
end
|
27
|
+
|
24
28
|
found << person
|
25
29
|
yield(entry, person) if block_given?
|
26
30
|
end
|
31
|
+
|
27
32
|
people.newFrom found
|
28
33
|
end
|
29
|
-
|
30
34
|
end
|
31
35
|
end
|
32
36
|
end
|
@@ -16,18 +16,22 @@ module Eco
|
|
16
16
|
def with_each_starter(entries, people, options, log_present: false, append_created: true)
|
17
17
|
starters = []
|
18
18
|
micro.with_each(entries, people, options, append_created: append_created) do |entry, person|
|
19
|
-
|
19
|
+
unless person.new?
|
20
20
|
if log_present
|
21
|
-
|
21
|
+
log(:error) {
|
22
|
+
"This person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}"
|
23
|
+
}
|
22
24
|
end
|
25
|
+
|
23
26
|
next
|
24
27
|
end
|
28
|
+
|
25
29
|
starters << person
|
26
30
|
yield(entry, person) if block_given?
|
27
31
|
end
|
32
|
+
|
28
33
|
people.newFrom starters
|
29
34
|
end
|
30
|
-
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
data/lib/eco/api/microcases.rb
CHANGED
@@ -76,19 +76,37 @@ module Eco
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
def init_caches
|
79
|
+
def init_caches # rubocop:disable Metrics/AbcSize
|
80
80
|
return if @caches_init
|
81
|
-
|
82
|
-
|
81
|
+
|
82
|
+
enabled_lps = reject {|lp| lp.enabled_for == 'disabled'}
|
83
|
+
|
84
|
+
@by_id = enabled_lps.each_with_object({}) do |lp, hash|
|
83
85
|
hash[lp.id.downcase] = lp
|
84
86
|
end
|
87
|
+
|
85
88
|
@by_name = enabled_lps.each_with_object({}) do |lp, hash|
|
86
89
|
hash[lp.name.downcase] = lp
|
90
|
+
|
91
|
+
hash['magic link'] = lp if lp.type == 'onetimepassword'
|
87
92
|
end
|
93
|
+
|
88
94
|
@by_type = enabled_lps.each_with_object({}) do |lp, hash|
|
89
|
-
|
90
|
-
|
95
|
+
type = lp.type.downcase.to_sym
|
96
|
+
|
97
|
+
hash[type] = lp unless hash.key?(type)
|
98
|
+
|
99
|
+
# only map the first :sso
|
100
|
+
unless hash.key?(:sso)
|
101
|
+
hash[:sso] = lp if lp.type == 'saml'
|
102
|
+
end
|
103
|
+
|
104
|
+
if lp.type == 'onetimepassword'
|
105
|
+
hash[:magic_link] = lp
|
106
|
+
hash[:magiclink] = lp
|
107
|
+
end
|
91
108
|
end
|
109
|
+
|
92
110
|
@caches_init = true
|
93
111
|
end
|
94
112
|
end
|
data/lib/eco/api/session.rb
CHANGED
@@ -193,7 +193,7 @@ module Eco
|
|
193
193
|
# @return [Eco::API::Common::People::Entries] collection of entries.
|
194
194
|
def entries(*args, **kargs)
|
195
195
|
entry_factory.entries(*args, **kargs).tap do |collection|
|
196
|
-
|
196
|
+
log(:info) { "Loaded #{collection.length} input entries." }
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
@@ -1,19 +1,20 @@
|
|
1
|
+
# rubocop:disable Metrics/BlockLength
|
1
2
|
ASSETS.cli.config do |cnf|
|
2
3
|
formats = {
|
3
|
-
csv:
|
4
|
-
option:
|
4
|
+
csv: {
|
5
|
+
option: ["-csv"],
|
5
6
|
extname: [".csv", ".txt"]
|
6
7
|
},
|
7
|
-
xml:
|
8
|
-
option:
|
8
|
+
xml: {
|
9
|
+
option: ["-xml"],
|
9
10
|
extname: [".xml"]
|
10
11
|
},
|
11
12
|
xls: {
|
12
|
-
option:
|
13
|
+
option: ["-xls", "-xlsx", "-excel"],
|
13
14
|
extname: [".xls", ".xlsx", ".xlsm"]
|
14
15
|
},
|
15
16
|
json: {
|
16
|
-
option:
|
17
|
+
option: ["-json"],
|
17
18
|
extname: [".json"]
|
18
19
|
}
|
19
20
|
}
|
@@ -24,10 +25,10 @@ ASSETS.cli.config do |cnf|
|
|
24
25
|
file = SCR.get_file(str_opt, required: true)
|
25
26
|
|
26
27
|
# Command line check
|
27
|
-
format = formats.reduce(nil) do |matched, (
|
28
|
-
used = selectors[:option].reduce(false) {|
|
28
|
+
format = formats.reduce(nil) do |matched, (frm, selectors)|
|
29
|
+
used = selectors[:option].reduce(false) {|us, option| SCR.get_arg(option) || us}
|
29
30
|
next matched if matched
|
30
|
-
next
|
31
|
+
next frm if used
|
31
32
|
end
|
32
33
|
|
33
34
|
# File/Folder check
|
@@ -43,12 +44,12 @@ ASSETS.cli.config do |cnf|
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
else
|
46
|
-
ext
|
47
|
+
ext = File.extname(file)
|
47
48
|
end
|
48
49
|
|
49
|
-
format ||= formats.reduce(nil) do |matched, (
|
50
|
+
format ||= formats.reduce(nil) do |matched, (frm, selectors)|
|
50
51
|
next matched if matched
|
51
|
-
next
|
52
|
+
next frm if selectors[:extname].any? {|e| ext == e}
|
52
53
|
end
|
53
54
|
format ||= :csv
|
54
55
|
|
@@ -66,8 +67,8 @@ ASSETS.cli.config do |cnf|
|
|
66
67
|
when :xls
|
67
68
|
input = session.entries(file: file, format: format)
|
68
69
|
when :json
|
69
|
-
input = [file].flatten.reduce(Eco::API::Organization::People.new([])) do |people,
|
70
|
-
people.merge(JSON.parse(File.read(
|
70
|
+
input = [file].flatten.reduce(Eco::API::Organization::People.new([])) do |people, filename|
|
71
|
+
people.merge(JSON.parse(File.read(filename)))
|
71
72
|
end
|
72
73
|
else # :csv
|
73
74
|
kargs = {check_headers: true}
|
@@ -78,3 +79,5 @@ ASSETS.cli.config do |cnf|
|
|
78
79
|
input
|
79
80
|
end
|
80
81
|
end
|
82
|
+
|
83
|
+
# rubocop:enable Metrics/BlockLength
|
@@ -2,25 +2,27 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
2
2
|
cnf.options_set do |options_set, options| # rubocop:disable Metrics/BlockLength
|
3
3
|
options_set.add("--help", "Offers a HELP") do |options, session|
|
4
4
|
conf = ASSETS.cli.config
|
5
|
+
|
5
6
|
active = proc do |opt|
|
6
|
-
if there = SCR.get_arg(opt)
|
7
|
+
if (there = SCR.get_arg(opt))
|
7
8
|
refine = SCR.get_arg(opt, with_param: true)
|
8
9
|
end
|
9
10
|
refine || there
|
10
11
|
end
|
11
12
|
|
12
|
-
if hpf = active.call("-filters")
|
13
|
+
if (hpf = active.call("-filters"))
|
13
14
|
puts conf.people_filters.help(refine: hpf)
|
14
15
|
end
|
15
|
-
if hif = active.call("-input-filters")
|
16
|
+
if (hif = active.call("-input-filters"))
|
16
17
|
puts conf.input_filters.help(refine: hif)
|
17
18
|
end
|
18
|
-
if ho
|
19
|
+
if (ho = active.call("-options"))
|
19
20
|
puts conf.options_set.help(refine: ho)
|
20
21
|
end
|
21
|
-
if huc = active.call("-usecases")
|
22
|
+
if (huc = active.call("-usecases"))
|
22
23
|
puts conf.usecases.help(refine: huc)
|
23
24
|
end
|
25
|
+
|
24
26
|
puts [
|
25
27
|
"Please specify one of the below:",
|
26
28
|
" -filters to display available filters on people",
|
@@ -72,35 +74,44 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
72
74
|
session.schema = sch_id
|
73
75
|
end
|
74
76
|
|
75
|
-
desc = "Used to be used to specify the input file or folder when using -get-partial."
|
76
|
-
desc
|
77
|
+
desc = "Used to be used to specify the input file or folder when using -get-partial. "
|
78
|
+
desc << "It can also be useful to obtain `-get-partial` of people base on `:export` use cases (i.e. -people-to-csv)"
|
77
79
|
options_set.add("-entries-from", desc) do |options, session|
|
78
80
|
options.deep_merge!(input: {entries_from: true})
|
79
81
|
end
|
80
82
|
|
81
|
-
desc
|
83
|
+
desc = "Used to specify the input file encoding"
|
82
84
|
options_set.add("-input-encoding", desc) do |options, session|
|
83
85
|
if encoding = SCR.get_arg("-input-encoding", with_param: true)
|
84
86
|
options.deep_merge!(input: {file: {encoding: encoding}})
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
|
-
desc
|
89
|
-
options_set.add("-
|
90
|
+
desc = "Do not load any people for this run."
|
91
|
+
options_set.add("-no-people", desc) do |options, session|
|
90
92
|
options.deep_merge!(people: {
|
91
|
-
get:
|
93
|
+
get: false
|
92
94
|
})
|
93
95
|
end
|
94
96
|
|
95
|
-
desc = "
|
96
|
-
|
97
|
-
|
97
|
+
desc = "Used to only get the people from the input file. "
|
98
|
+
desc << "It will also include their current and new supervisors."
|
99
|
+
options_set.add("-get-partial", desc) do |options, session|
|
100
|
+
options.deep_merge!(people: {
|
101
|
+
get: {
|
102
|
+
from: :remote,
|
103
|
+
type: :partial
|
104
|
+
}
|
105
|
+
})
|
98
106
|
end
|
99
107
|
|
100
108
|
desc = "Locally cache all the people manager by retrieving from the server"
|
101
109
|
options_set.add("-get-people", desc) do |options, session|
|
102
110
|
options.deep_merge!(people: {
|
103
|
-
get: {
|
111
|
+
get: {
|
112
|
+
from: :remote,
|
113
|
+
type: :full
|
114
|
+
}
|
104
115
|
})
|
105
116
|
end
|
106
117
|
|
@@ -110,16 +121,20 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
110
121
|
end
|
111
122
|
|
112
123
|
desc = "Used to specify the cache file of people to be used. "
|
113
|
-
desc
|
124
|
+
desc << "It is useful to use as people reference those stored in cached file diffrent to the last one."
|
114
125
|
options_set.add("-people-from-backup", desc) do |options, session|
|
115
126
|
file = SCR.get_file("-people-from-backup", required: true, should_exist: true)
|
116
127
|
options.deep_merge!(people: {
|
117
|
-
get: {
|
128
|
+
get: {
|
129
|
+
from: :local,
|
130
|
+
type: :file,
|
131
|
+
file: file
|
132
|
+
}
|
118
133
|
})
|
119
134
|
end
|
120
135
|
|
121
136
|
desc = "Used to export to a csv the final people (after processing). "
|
122
|
-
desc
|
137
|
+
desc << "It is useful analyse the data after a -dry-run (-simulate)."
|
123
138
|
options_set.add("-processed-people-to-csv", desc) do |options, session|
|
124
139
|
file = SCR.get_file("-processed-people-to-csv", required: true, should_exist: false)
|
125
140
|
options.deep_merge!(report: {people: {csv: file}})
|
@@ -138,7 +153,7 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
138
153
|
end
|
139
154
|
|
140
155
|
desc = "(careful with this option) This will include everybody as part of the update (including those that are api excluded). "
|
141
|
-
desc
|
156
|
+
desc << "Only launch with this option when only api excluded people are included in your update."
|
142
157
|
options_set.add("-include-excluded", desc) do |options|
|
143
158
|
options.deep_merge!(include: {excluded: true})
|
144
159
|
end
|
@@ -169,16 +184,19 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
169
184
|
end
|
170
185
|
|
171
186
|
desc = "Force search mode to 'strict' when pairing input entries with existing people."
|
172
|
-
desc
|
187
|
+
desc << " Besides id and external_id it will not try to find by email unless external_id is not specified"
|
173
188
|
options_set.add("-search-strict", desc) do |options|
|
174
189
|
options.deep_merge!(search: {strict: true})
|
175
190
|
end
|
176
191
|
|
177
192
|
desc = "Search mode that will try to find people using email when id and external_id have failed"
|
178
|
-
desc
|
179
|
-
desc
|
193
|
+
desc << " This option could identify existing people by their email addresses"
|
194
|
+
desc << " (it should not be used in orgs where multiple people usually have the same email address)"
|
180
195
|
options_set.add("-search-soft", desc) do |options|
|
181
|
-
options.deep_merge!(search: {
|
196
|
+
options.deep_merge!(search: {
|
197
|
+
soft: true,
|
198
|
+
strict: false
|
199
|
+
})
|
182
200
|
end
|
183
201
|
|
184
202
|
desc = "Prevent email to be sent (experimental)"
|