eco-helpers 2.0.14 → 2.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -2
  3. data/eco-helpers.gemspec +6 -4
  4. data/lib/eco-helpers.rb +2 -0
  5. data/lib/eco/api/common/base_loader.rb +14 -0
  6. data/lib/eco/api/common/people/default_parsers/date_parser.rb +11 -1
  7. data/lib/eco/api/common/people/default_parsers/login_providers_parser.rb +1 -1
  8. data/lib/eco/api/common/people/default_parsers/policy_groups_parser.rb +11 -11
  9. data/lib/eco/api/common/people/entry_factory.rb +26 -9
  10. data/lib/eco/api/common/people/person_entry.rb +5 -2
  11. data/lib/eco/api/common/people/supervisor_helpers.rb +27 -0
  12. data/lib/eco/api/common/session.rb +1 -0
  13. data/lib/eco/api/common/session/base_session.rb +2 -0
  14. data/lib/eco/api/common/session/file_manager.rb +2 -2
  15. data/lib/eco/api/common/session/helpers.rb +30 -0
  16. data/lib/eco/api/common/session/helpers/prompt_user.rb +34 -0
  17. data/lib/eco/api/common/session/mailer.rb +0 -1
  18. data/lib/eco/api/common/session/s3_uploader.rb +0 -1
  19. data/lib/eco/api/common/session/sftp.rb +0 -1
  20. data/lib/eco/api/common/version_patches/ecoportal_api/external_person.rb +1 -1
  21. data/lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb +7 -4
  22. data/lib/eco/api/common/version_patches/exception.rb +8 -4
  23. data/lib/eco/api/microcases.rb +3 -1
  24. data/lib/eco/api/microcases/append_usergroups.rb +0 -1
  25. data/lib/eco/api/microcases/people_cache.rb +2 -2
  26. data/lib/eco/api/microcases/people_load.rb +2 -2
  27. data/lib/eco/api/microcases/people_refresh.rb +2 -2
  28. data/lib/eco/api/microcases/people_search.rb +6 -6
  29. data/lib/eco/api/microcases/preserve_default_tag.rb +23 -0
  30. data/lib/eco/api/microcases/preserve_filter_tags.rb +28 -0
  31. data/lib/eco/api/microcases/preserve_policy_groups.rb +30 -0
  32. data/lib/eco/api/microcases/set_account.rb +0 -1
  33. data/lib/eco/api/microcases/with_each.rb +67 -6
  34. data/lib/eco/api/microcases/with_each_present.rb +4 -2
  35. data/lib/eco/api/microcases/with_each_starter.rb +4 -2
  36. data/lib/eco/api/organization.rb +1 -0
  37. data/lib/eco/api/organization/people.rb +98 -22
  38. data/lib/eco/api/organization/people_similarity.rb +112 -0
  39. data/lib/eco/api/organization/person_schemas.rb +5 -1
  40. data/lib/eco/api/organization/policy_groups.rb +5 -1
  41. data/lib/eco/api/organization/presets_factory.rb +40 -80
  42. data/lib/eco/api/organization/presets_integrity.json +6 -0
  43. data/lib/eco/api/organization/presets_values.json +5 -4
  44. data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +0 -30
  45. data/lib/eco/api/session.rb +6 -22
  46. data/lib/eco/api/session/batch.rb +25 -7
  47. data/lib/eco/api/session/config.rb +16 -15
  48. data/lib/eco/api/session/config/api.rb +4 -0
  49. data/lib/eco/api/session/config/apis.rb +80 -0
  50. data/lib/eco/api/session/config/files.rb +7 -0
  51. data/lib/eco/api/session/config/people.rb +3 -19
  52. data/lib/eco/api/usecases/default_cases.rb +4 -1
  53. data/lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb +161 -0
  54. data/lib/eco/api/usecases/default_cases/analyse_people_case.rb +53 -0
  55. data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +2 -3
  56. data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +11 -1
  57. data/lib/eco/api/usecases/default_cases/restore_db_case.rb +1 -2
  58. data/lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb +72 -0
  59. data/lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb +59 -0
  60. data/lib/eco/api/usecases/default_cases/to_csv_case.rb +132 -29
  61. data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +61 -36
  62. data/lib/eco/api/usecases/ooze_samples/ooze_update_case.rb +3 -2
  63. data/lib/eco/cli.rb +0 -10
  64. data/lib/eco/cli/config/default/options.rb +20 -17
  65. data/lib/eco/cli/config/default/people_filters.rb +3 -3
  66. data/lib/eco/cli/config/default/usecases.rb +80 -26
  67. data/lib/eco/cli/config/default/workflow.rb +16 -4
  68. data/lib/eco/cli/config/help.rb +1 -0
  69. data/lib/eco/cli/config/options_set.rb +106 -13
  70. data/lib/eco/cli/config/use_cases.rb +33 -33
  71. data/lib/eco/cli/scripting/args_helpers.rb +30 -3
  72. data/lib/eco/csv.rb +4 -2
  73. data/lib/eco/data.rb +1 -0
  74. data/lib/eco/data/crypto/encryption.rb +3 -3
  75. data/lib/eco/data/files/directory.rb +28 -20
  76. data/lib/eco/data/files/helpers.rb +6 -4
  77. data/lib/eco/data/fuzzy_match.rb +161 -0
  78. data/lib/eco/data/fuzzy_match/array_helpers.rb +75 -0
  79. data/lib/eco/data/fuzzy_match/chars_position_score.rb +37 -0
  80. data/lib/eco/data/fuzzy_match/ngrams_score.rb +78 -0
  81. data/lib/eco/data/fuzzy_match/pairing.rb +101 -0
  82. data/lib/eco/data/fuzzy_match/result.rb +73 -0
  83. data/lib/eco/data/fuzzy_match/results.rb +59 -0
  84. data/lib/eco/data/fuzzy_match/score.rb +44 -0
  85. data/lib/eco/data/fuzzy_match/stop_words.rb +35 -0
  86. data/lib/eco/data/fuzzy_match/string_helpers.rb +69 -0
  87. data/lib/eco/version.rb +1 -1
  88. metadata +87 -10
  89. data/lib/eco/api/microcases/refresh_abilities.rb +0 -19
  90. data/lib/eco/api/organization/presets_reference.json +0 -59
  91. data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +0 -30
@@ -0,0 +1,35 @@
1
+ module Eco
2
+ module Data
3
+ module FuzzyMatch
4
+ module StopWords
5
+ PREPOSITIONS = [
6
+ "aboard", "about", "above", "across", "after", "against", "along", "amid", "among", "around", "as", "at",
7
+ "before", "behind", "below", "beneath", "beside", "between", "beyond", "but", "by",
8
+ "concerning", "considering", "despite", "down", "during", "except", "following", "for", "from",
9
+ "in", "inside", "into", "like", "minus", "near", "next",
10
+ "of", "off", "on", "onto", "opposite", "out", "outside", "over", "past", "per", "plus",
11
+ "regarding", "round", "save", "since", "than", "through", "till", "to", "toward",
12
+ "under", "underneath", "unlike", "until", "up", "upon", "versus", "via",
13
+ "with", "within", "without"
14
+ ]
15
+ PRONOUNS = [
16
+ "all", "another", "any", "anybody", "anyone", "anything", "as", "aught",
17
+ "both", "each", "each other", "either", "enough", "everybody", "everyone", "everything",
18
+ "few", "he", "her", "hers", "herself", "him", "himself", "his", "I", "idem", "it", "its", "itself",
19
+ "many", "me", "mine", "most", "my", "myself", "naught", "neither", "no one", "nobody", "none", "nothing", "nought",
20
+ "one", "one another", "other", "others", "ought", "our", "ours", "ourself", "ourselves",
21
+ "several", "she", "some", "somebody", "someone", "something", "somewhat", "such", "suchlike",
22
+ "that", "thee", "their", "theirs", "theirself", "theirselves", "them", "themself", "themselves", "there",
23
+ "these", "they", "thine", "this", "those", "thou", "thy", "thyself", "us",
24
+ "we", "what", "whatever", "whatnot", "whatsoever", "whence", "where", "whereby", "wherefrom",
25
+ "wherein", "whereinto", "whereof", "whereon", "wherever", "wheresoever", "whereto", "whereunto",
26
+ "wherewith", "wherewithal", "whether", "which", "whichever", "whichsoever", "who", "whoever", "whom",
27
+ "whomever", "whomso", "whomsoever", "whose", "whosever", "whosesoever", "whoso", "whosoever",
28
+ "ye", "yon", "yonder", "you", "your", "yours", "yourself", "yourselves"
29
+ ]
30
+ ARTICLES = ["a", "an", "the"]
31
+
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,69 @@
1
+ module Eco
2
+ module Data
3
+ module FuzzyMatch
4
+ module StringHelpers
5
+ # Downcases and trims
6
+ def normalize_string(value)
7
+ case value
8
+ when Array
9
+ value.map {|val| normalize_string(val)}
10
+ when Symbol
11
+ normalize_string(value.to_sym)
12
+ when String
13
+ value.downcase.strip
14
+ end
15
+ end
16
+
17
+ def get_words(str, normalized: false)
18
+ return [] unless str
19
+ str = normalize_string(str) unless normalized
20
+ str.scan(/[a-zA-Z'-]+/)
21
+ end
22
+
23
+ # Keeps the start order of the `words` and consecutive `words` together/consecutive.
24
+ # @param str [String] the input string with the words.
25
+ # @param range [Integer, Range] determine the lenght of the generated values.
26
+ # @return [Array<String>] combinations of `range` length of `words`.
27
+ def string_ngrams(str, range=2..3, normalized: false)
28
+ ngrams(get_words(str, normalized: normalized), range)
29
+ end
30
+
31
+ # Keeps the start order of the `words` of the input `Array` `words`.
32
+ # It does **not** keep consecutive `words` together (it can jump/skip items).
33
+ # @param str [String] the input string with the words.
34
+ # @param range [Integer, Range] determine the lenght of the generated values.
35
+ # @return [Array<String>] combinations of `range` length of `words`
36
+ def string_combinations(str, range=2..3, normalized: false)
37
+ combinations(get_words(str, normalized: normalized), range)
38
+ .map {|comb| comb.join(' ')}
39
+ end
40
+
41
+ # It includes `combinations` that break the initial order of the `Array`.
42
+ # It does **not** keep consecutive `words` together (it can jump/skip items).
43
+ # @param str [String] the input string with the words.
44
+ # @param range [Integer, Range] determine the lenght of the generated values.
45
+ # @return [Array<String>] permutations of `range` length of `words`
46
+ def string_permutations(str, range=2..3, normalized: false)
47
+ permutations(get_words(str, normalized: normalized), range)
48
+ .map {|comb| comb.join(' ')}
49
+ end
50
+
51
+ # Keeps the start order of the `charts` and consecutive `charts` together/consecutive.
52
+ # @param str [String] the input `word` string.
53
+ # @param range [Integer, Range] determine the lenght of the generated values.
54
+ # @return [Array<String>] combinations of `range` length of `words`.
55
+ def word_ngrams(str, range=2..3, normalized: false)
56
+ str = normalize_string(str) unless normalized
57
+ ngrams(str.to_s.chars, range)
58
+ .map {|comb| no_blanks(comb)}
59
+ end
60
+
61
+ def no_blanks(str)
62
+ return nil unless str && str.is_a?(String)
63
+ str.tr(' ', '')
64
+ end
65
+
66
+ end
67
+ end
68
+ end
69
+ end
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.14"
2
+ VERSION = "2.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.11
19
+ version: 2.2.17
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.3'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 2.2.11
29
+ version: 2.2.17
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.3'
@@ -116,7 +116,7 @@ dependencies:
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: 0.8.2
119
+ version: 0.8.3
120
120
  - - "<"
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0.9'
@@ -126,7 +126,7 @@ dependencies:
126
126
  requirements:
127
127
  - - ">="
128
128
  - !ruby/object:Gem::Version
129
- version: 0.8.2
129
+ version: 0.8.3
130
130
  - - "<"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0.9'
@@ -136,7 +136,7 @@ dependencies:
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 0.8.6
139
+ version: 0.8.7
140
140
  - - "<"
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0.9'
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ">="
148
148
  - !ruby/object:Gem::Version
149
- version: 0.8.6
149
+ version: 0.8.7
150
150
  - - "<"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.9'
@@ -230,6 +230,66 @@ dependencies:
230
230
  - - "<"
231
231
  - !ruby/object:Gem::Version
232
232
  version: '3.1'
233
+ - !ruby/object:Gem::Dependency
234
+ name: fuzzy_match
235
+ requirement: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - ">="
238
+ - !ruby/object:Gem::Version
239
+ version: 2.1.0
240
+ - - "<"
241
+ - !ruby/object:Gem::Version
242
+ version: '2.2'
243
+ type: :runtime
244
+ prerelease: false
245
+ version_requirements: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - ">="
248
+ - !ruby/object:Gem::Version
249
+ version: 2.1.0
250
+ - - "<"
251
+ - !ruby/object:Gem::Version
252
+ version: '2.2'
253
+ - !ruby/object:Gem::Dependency
254
+ name: amatch
255
+ requirement: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - ">="
258
+ - !ruby/object:Gem::Version
259
+ version: 0.4.0
260
+ - - "<"
261
+ - !ruby/object:Gem::Version
262
+ version: '0.5'
263
+ type: :runtime
264
+ prerelease: false
265
+ version_requirements: !ruby/object:Gem::Requirement
266
+ requirements:
267
+ - - ">="
268
+ - !ruby/object:Gem::Version
269
+ version: 0.4.0
270
+ - - "<"
271
+ - !ruby/object:Gem::Version
272
+ version: '0.5'
273
+ - !ruby/object:Gem::Dependency
274
+ name: jaro_winkler
275
+ requirement: !ruby/object:Gem::Requirement
276
+ requirements:
277
+ - - ">="
278
+ - !ruby/object:Gem::Version
279
+ version: 1.5.4
280
+ - - "<"
281
+ - !ruby/object:Gem::Version
282
+ version: '1.6'
283
+ type: :runtime
284
+ prerelease: false
285
+ version_requirements: !ruby/object:Gem::Requirement
286
+ requirements:
287
+ - - ">="
288
+ - !ruby/object:Gem::Version
289
+ version: 1.5.4
290
+ - - "<"
291
+ - !ruby/object:Gem::Version
292
+ version: '1.6'
233
293
  description:
234
294
  email:
235
295
  - oscar@ecoportal.co.nz
@@ -285,6 +345,8 @@ files:
285
345
  - lib/eco/api/common/session/base_session.rb
286
346
  - lib/eco/api/common/session/environment.rb
287
347
  - lib/eco/api/common/session/file_manager.rb
348
+ - lib/eco/api/common/session/helpers.rb
349
+ - lib/eco/api/common/session/helpers/prompt_user.rb
288
350
  - lib/eco/api/common/session/logger.rb
289
351
  - lib/eco/api/common/session/logger/cache.rb
290
352
  - lib/eco/api/common/session/logger/log.rb
@@ -318,7 +380,9 @@ files:
318
380
  - lib/eco/api/microcases/people_load.rb
319
381
  - lib/eco/api/microcases/people_refresh.rb
320
382
  - lib/eco/api/microcases/people_search.rb
321
- - lib/eco/api/microcases/refresh_abilities.rb
383
+ - lib/eco/api/microcases/preserve_default_tag.rb
384
+ - lib/eco/api/microcases/preserve_filter_tags.rb
385
+ - lib/eco/api/microcases/preserve_policy_groups.rb
322
386
  - lib/eco/api/microcases/refresh_default_tag.rb
323
387
  - lib/eco/api/microcases/s3upload_targets.rb
324
388
  - lib/eco/api/microcases/set_account.rb
@@ -335,13 +399,13 @@ files:
335
399
  - lib/eco/api/organization.rb
336
400
  - lib/eco/api/organization/login_providers.rb
337
401
  - lib/eco/api/organization/people.rb
402
+ - lib/eco/api/organization/people_similarity.rb
338
403
  - lib/eco/api/organization/person_schemas.rb
339
404
  - lib/eco/api/organization/policy_groups.rb
340
405
  - lib/eco/api/organization/preferences.rb
341
406
  - lib/eco/api/organization/preferences_reference.json
342
407
  - lib/eco/api/organization/presets_factory.rb
343
408
  - lib/eco/api/organization/presets_integrity.json
344
- - lib/eco/api/organization/presets_reference.json
345
409
  - lib/eco/api/organization/presets_values.json
346
410
  - lib/eco/api/organization/tag_tree.rb
347
411
  - lib/eco/api/policies.rb
@@ -375,6 +439,8 @@ files:
375
439
  - lib/eco/api/usecases/base_case.rb
376
440
  - lib/eco/api/usecases/base_io.rb
377
441
  - lib/eco/api/usecases/default_cases.rb
442
+ - lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb
443
+ - lib/eco/api/usecases/default_cases/analyse_people_case.rb
378
444
  - lib/eco/api/usecases/default_cases/append_usergroups_case.rb
379
445
  - lib/eco/api/usecases/default_cases/change_email_case.rb
380
446
  - lib/eco/api/usecases/default_cases/codes_to_tags_case.rb
@@ -389,7 +455,6 @@ files:
389
455
  - lib/eco/api/usecases/default_cases/new_id_case.rb
390
456
  - lib/eco/api/usecases/default_cases/new_id_case0.rb
391
457
  - lib/eco/api/usecases/default_cases/org_data_convert_case.rb
392
- - lib/eco/api/usecases/default_cases/refresh_abilities_case.rb
393
458
  - lib/eco/api/usecases/default_cases/refresh_case.rb
394
459
  - lib/eco/api/usecases/default_cases/reinvite_sync_case.rb
395
460
  - lib/eco/api/usecases/default_cases/reinvite_trans_case.rb
@@ -399,6 +464,8 @@ files:
399
464
  - lib/eco/api/usecases/default_cases/restore_db_case.rb
400
465
  - lib/eco/api/usecases/default_cases/set_default_tag_case.rb
401
466
  - lib/eco/api/usecases/default_cases/set_supervisor_case.rb
467
+ - lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb
468
+ - lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb
402
469
  - lib/eco/api/usecases/default_cases/switch_supervisor_case.rb
403
470
  - lib/eco/api/usecases/default_cases/to_csv_case.rb
404
471
  - lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb
@@ -444,6 +511,16 @@ files:
444
511
  - lib/eco/data/files/directory.rb
445
512
  - lib/eco/data/files/file_pattern.rb
446
513
  - lib/eco/data/files/helpers.rb
514
+ - lib/eco/data/fuzzy_match.rb
515
+ - lib/eco/data/fuzzy_match/array_helpers.rb
516
+ - lib/eco/data/fuzzy_match/chars_position_score.rb
517
+ - lib/eco/data/fuzzy_match/ngrams_score.rb
518
+ - lib/eco/data/fuzzy_match/pairing.rb
519
+ - lib/eco/data/fuzzy_match/result.rb
520
+ - lib/eco/data/fuzzy_match/results.rb
521
+ - lib/eco/data/fuzzy_match/score.rb
522
+ - lib/eco/data/fuzzy_match/stop_words.rb
523
+ - lib/eco/data/fuzzy_match/string_helpers.rb
447
524
  - lib/eco/data/mapper.rb
448
525
  - lib/eco/language.rb
449
526
  - lib/eco/language/curry.rb
@@ -1,19 +0,0 @@
1
- module Eco
2
- module API
3
- class MicroCases
4
- # It sets the correct set of abilities based on the usergroups of `person`.
5
- # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
6
- # @param options [Hash] the options.
7
- def refresh_abilities(person, options)
8
- unless options.dig(:exclude, :account)
9
- if person.account
10
- unless options.dig(:exclude, :abilities) && !person.new?
11
- person.account.permissions_custom = session.new_preset(person)
12
- end
13
- end
14
- end
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,59 +0,0 @@
1
- {
2
- "read_only" : {
3
- "files": "browse",
4
- "data": "view",
5
- "reports": "view",
6
- "organization": null,
7
- "people": null,
8
- "person_core": null,
9
- "person_core_create": null,
10
- "person_core_edit": null,
11
- "person_account": null,
12
- "person_details": null,
13
- "pages": "view",
14
- "page_editor": null,
15
- "registers": "view"
16
- },
17
- "forms" : {
18
- "files": "browse",
19
- "data": "view",
20
- "reports": "view",
21
- "organization": null,
22
- "person_core": "attach",
23
- "person_core_create": null,
24
- "person_core_edit": null,
25
- "person_account": null,
26
- "person_details": "view",
27
- "pages": "create",
28
- "page_editor": "basic",
29
- "registers": "view"
30
- },
31
- "editor" : {
32
- "files": "browse",
33
- "data": "update",
34
- "reports": "edit",
35
- "organization": "view",
36
- "person_core": "view_people_manager",
37
- "person_core_create": null,
38
- "person_core_edit": null,
39
- "person_account": "view",
40
- "person_details": "view",
41
- "pages": "create",
42
- "page_editor": "intermediate",
43
- "registers": "view"
44
- },
45
- "administrator" : {
46
- "files": "administrate",
47
- "data": "administrate",
48
- "reports": "administrate",
49
- "organization": "administrate",
50
- "person_core": "view_people_manager",
51
- "person_core_create": "create",
52
- "person_core_edit": "edit",
53
- "person_account": "edit",
54
- "person_details": "edit_private",
55
- "pages": "administrate",
56
- "page_editor": "advanced",
57
- "registers": "dashboard"
58
- }
59
- }
@@ -1,30 +0,0 @@
1
- class Eco::API::UseCases::DefaultCases::RefreshAbilitiesCase < Eco::API::Common::Loaders::UseCase
2
- name "refresh-abilities"
3
- type :transform
4
-
5
- # Usecase to refresh the user's account abilities as defined in the org config for their usergroups.
6
- # @param people [Eco::API::Organization::People] target existing _People_ of the current update.
7
- # @param session [Eco::API::Session] the current session where the usecase kicks in.
8
- # @param options [Hash] the options that modify the case behaviour or bring some dependencies.
9
- # @return [Void]
10
- def main(people, session, options, usecase)
11
- users = require_users!(people, session.logger)
12
- update = session.new_job("main", "update", :update, usecase, :account)
13
- users.each do |person|
14
- person.account.permissions_custom = session.new_preset(person)
15
- update.add(person)
16
- end
17
- end
18
-
19
- private
20
-
21
- def require_users!(people, logger)
22
- people.users.tap do |users|
23
- unless users.length > 0
24
- logger.warn("There are no people with account amoung your #{people.length} people")
25
- exit(1)
26
- end
27
- end
28
- end
29
-
30
- end