eco-helpers 2.7.23 → 2.7.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -5
- data/lib/eco/api/common/people/person_entry.rb +2 -1
- 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 +35 -23
- 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
- metadata +1 -1
@@ -1,31 +1,69 @@
|
|
1
|
+
MAX_GET_PARTIAL = 12_000
|
2
|
+
|
1
3
|
ASSETS.cli.config do |cnf|
|
2
4
|
cnf.people do |input, session, options|
|
3
|
-
get
|
4
|
-
|
5
|
-
|
5
|
+
get = options.dig(:people, :get)
|
6
|
+
get = {} if get.nil?
|
7
|
+
|
8
|
+
from_remote = get && get[:from] == :remote
|
9
|
+
from_local = get && get[:from] == :local
|
10
|
+
|
11
|
+
get_full = from_remote && get[:type] == :full
|
12
|
+
get_partial = from_remote && get[:type] == :partial
|
13
|
+
get_by_file = from_local && get[:type] == :file
|
14
|
+
|
15
|
+
# -get-partial: validate input present and under max
|
16
|
+
if get_partial
|
17
|
+
msg = "To use -get-partial (partial updates), you need to use -entries-from"
|
18
|
+
raise msg unless input.is_a?(Enumerable)
|
19
|
+
|
20
|
+
if input.count > MAX_GET_PARTIAL
|
21
|
+
get_full = true
|
22
|
+
get_partial = false
|
23
|
+
|
24
|
+
msg = "(Optimization) "
|
25
|
+
msg << "Switching from partial to full people download. "
|
26
|
+
msg << "Input (#{input.count}) surpases MAX_GET_PARTIAL (#{MAX_GET_PARTIAL}) entries."
|
27
|
+
session.logger.info(msg)
|
28
|
+
|
29
|
+
options.deep_merge!(people: {
|
30
|
+
get: {
|
31
|
+
from: :remote,
|
32
|
+
type: :full
|
33
|
+
}
|
34
|
+
})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if get == false
|
6
39
|
Eco::API::Organization::People.new([])
|
7
|
-
|
40
|
+
elsif get_full
|
8
41
|
# -get-people
|
9
42
|
session.micro.people_cache
|
10
|
-
|
43
|
+
elsif get_partial
|
11
44
|
# -get-partial
|
12
|
-
unless (input && input.is_a?(Enumerable))
|
13
|
-
raise "To use -get-partial (partial updates), you need to use -entries-from"
|
14
|
-
end
|
15
45
|
session.micro.people_search(input, options: options)
|
16
|
-
|
46
|
+
elsif get_by_file
|
17
47
|
# -people-from-backup
|
18
48
|
session.micro.people_load(get[:file], modifier: :file)
|
19
49
|
#people = JSON.parse(File.read(get[:file]))
|
20
50
|
#Eco::API::Organization::People.new(people)
|
21
51
|
else
|
22
52
|
options.deep_merge!(people: {
|
23
|
-
get: {
|
53
|
+
get: {
|
54
|
+
from: :local,
|
55
|
+
type: :full
|
56
|
+
}
|
24
57
|
})
|
25
|
-
|
58
|
+
|
59
|
+
people = session.micro.people_load(modifier: %i[newest save])
|
60
|
+
|
26
61
|
if people.empty?
|
27
62
|
options.deep_merge!(people: {
|
28
|
-
get: {
|
63
|
+
get: {
|
64
|
+
from: :remote,
|
65
|
+
type: :full
|
66
|
+
}
|
29
67
|
})
|
30
68
|
people = session.micro.people_cache
|
31
69
|
end
|
@@ -94,7 +94,7 @@ ASSETS.cli.config do |cnf|
|
|
94
94
|
end
|
95
95
|
|
96
96
|
options.deep_merge!(people: {filter: {details: {schema_id: sch_id}}})
|
97
|
-
session.logger.info("Filtering people
|
97
|
+
session.logger.info("Filtering people records with schema #{session.schemas.to_name(sch_id)}")
|
98
98
|
|
99
99
|
people.select do |person|
|
100
100
|
person.details && (person.details.schema_id == sch_id)
|
@@ -4,6 +4,7 @@ ASSETS.cli do |cli| # rubocop:disable Metrics/BlockLength
|
|
4
4
|
# default rescue
|
5
5
|
wf.rescue do |err, io|
|
6
6
|
next io if rescued
|
7
|
+
|
7
8
|
rescued = true
|
8
9
|
log(:debug) { err.patch_full_message }
|
9
10
|
wf.run(:close, io: io)
|
@@ -47,11 +48,13 @@ ASSETS.cli do |cli| # rubocop:disable Metrics/BlockLength
|
|
47
48
|
io.class.people_required?(usecase.type)
|
48
49
|
end
|
49
50
|
next if cases_with_people.empty? && !options.dig(:people, :get)
|
51
|
+
|
50
52
|
io.new(people: cli.config.people(io: io))
|
51
53
|
end
|
52
54
|
|
53
55
|
wf_peo.on(:filter) do |_wf_pf, io|
|
54
56
|
next unless people && !people.empty?
|
57
|
+
|
55
58
|
io.new(people: cli.config.people_filters.process(io: io))
|
56
59
|
end
|
57
60
|
end
|
@@ -61,6 +64,7 @@ ASSETS.cli do |cli| # rubocop:disable Metrics/BlockLength
|
|
61
64
|
# save partial entries -> should be native to session.workflow
|
62
65
|
get_people = options.dig(:people, :get)
|
63
66
|
partial_update = get_people && get_people[:type] == :partial
|
67
|
+
|
64
68
|
if !options[:dry_run] && partial_update
|
65
69
|
partial_file = session.config.people.partial_cache
|
66
70
|
session.file_manager.save_json(io.people, partial_file, :timestamp)
|
data/lib/eco/version.rb
CHANGED