eco-helpers 2.0.12 → 2.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -73
  3. data/eco-helpers.gemspec +6 -4
  4. data/lib/eco-helpers.rb +1 -0
  5. data/lib/eco/api/common/base_loader.rb +14 -0
  6. data/lib/eco/api/common/loaders/use_case.rb +1 -1
  7. data/lib/eco/api/common/people/default_parsers/date_parser.rb +11 -1
  8. data/lib/eco/api/common/people/default_parsers/login_providers_parser.rb +1 -1
  9. data/lib/eco/api/common/people/default_parsers/policy_groups_parser.rb +11 -11
  10. data/lib/eco/api/common/people/person_entry.rb +9 -2
  11. data/lib/eco/api/common/people/supervisor_helpers.rb +27 -0
  12. data/lib/eco/api/common/session/file_manager.rb +2 -2
  13. data/lib/eco/api/common/session/mailer.rb +0 -1
  14. data/lib/eco/api/common/session/s3_uploader.rb +0 -1
  15. data/lib/eco/api/common/session/sftp.rb +0 -1
  16. data/lib/eco/api/error.rb +5 -3
  17. data/lib/eco/api/microcases.rb +3 -1
  18. data/lib/eco/api/microcases/append_usergroups.rb +0 -1
  19. data/lib/eco/api/microcases/people_cache.rb +2 -2
  20. data/lib/eco/api/microcases/people_load.rb +2 -2
  21. data/lib/eco/api/microcases/people_refresh.rb +2 -2
  22. data/lib/eco/api/microcases/people_search.rb +6 -6
  23. data/lib/eco/api/microcases/preserve_default_tag.rb +23 -0
  24. data/lib/eco/api/microcases/preserve_filter_tags.rb +28 -0
  25. data/lib/eco/api/microcases/preserve_policy_groups.rb +30 -0
  26. data/lib/eco/api/microcases/set_account.rb +0 -1
  27. data/lib/eco/api/organization.rb +1 -0
  28. data/lib/eco/api/organization/people.rb +7 -0
  29. data/lib/eco/api/organization/people_analytics.rb +60 -0
  30. data/lib/eco/api/organization/presets_factory.rb +116 -93
  31. data/lib/eco/api/organization/presets_integrity.json +58 -0
  32. data/lib/eco/api/organization/presets_values.json +5 -4
  33. data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +0 -30
  34. data/lib/eco/api/session.rb +1 -20
  35. data/lib/eco/api/session/batch.rb +42 -10
  36. data/lib/eco/api/session/batch/job.rb +3 -0
  37. data/lib/eco/api/session/config.rb +16 -15
  38. data/lib/eco/api/session/config/api.rb +4 -0
  39. data/lib/eco/api/session/config/apis.rb +14 -0
  40. data/lib/eco/api/session/config/files.rb +7 -0
  41. data/lib/eco/api/session/config/people.rb +3 -19
  42. data/lib/eco/api/usecases.rb +2 -0
  43. data/lib/eco/api/usecases/default_cases.rb +4 -1
  44. data/lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb +161 -0
  45. data/lib/eco/api/usecases/default_cases/analyse_people_case.rb +76 -0
  46. data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +2 -3
  47. data/lib/eco/api/usecases/default_cases/hris_case.rb +14 -8
  48. data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +11 -1
  49. data/lib/eco/api/usecases/default_cases/restore_db_case.rb +1 -2
  50. data/lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb +72 -0
  51. data/lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb +59 -0
  52. data/lib/eco/api/usecases/default_cases/to_csv_case.rb +104 -26
  53. data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +62 -36
  54. data/lib/eco/cli.rb +0 -10
  55. data/lib/eco/cli/config/default/options.rb +19 -17
  56. data/lib/eco/cli/config/default/people_filters.rb +3 -3
  57. data/lib/eco/cli/config/default/usecases.rb +77 -25
  58. data/lib/eco/cli/config/default/workflow.rb +6 -1
  59. data/lib/eco/cli/config/help.rb +1 -0
  60. data/lib/eco/cli/config/options_set.rb +106 -13
  61. data/lib/eco/cli/config/use_cases.rb +33 -33
  62. data/lib/eco/cli/scripting/args_helpers.rb +30 -3
  63. data/lib/eco/data.rb +1 -0
  64. data/lib/eco/data/crypto/encryption.rb +3 -3
  65. data/lib/eco/data/files/directory.rb +28 -20
  66. data/lib/eco/data/files/helpers.rb +6 -4
  67. data/lib/eco/data/fuzzy_match.rb +119 -0
  68. data/lib/eco/data/fuzzy_match/array_helpers.rb +75 -0
  69. data/lib/eco/data/fuzzy_match/chars_position_score.rb +37 -0
  70. data/lib/eco/data/fuzzy_match/ngrams_score.rb +73 -0
  71. data/lib/eco/data/fuzzy_match/pairing.rb +102 -0
  72. data/lib/eco/data/fuzzy_match/result.rb +67 -0
  73. data/lib/eco/data/fuzzy_match/results.rb +53 -0
  74. data/lib/eco/data/fuzzy_match/score.rb +44 -0
  75. data/lib/eco/data/fuzzy_match/stop_words.rb +35 -0
  76. data/lib/eco/data/fuzzy_match/string_helpers.rb +69 -0
  77. data/lib/eco/version.rb +1 -1
  78. metadata +86 -10
  79. data/lib/eco/api/microcases/refresh_abilities.rb +0 -19
  80. data/lib/eco/api/organization/presets_reference.json +0 -59
  81. data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +0 -30
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.12"
2
+ VERSION = "2.0.17"
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.12
4
+ version: 2.0.17
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
@@ -318,7 +378,9 @@ files:
318
378
  - lib/eco/api/microcases/people_load.rb
319
379
  - lib/eco/api/microcases/people_refresh.rb
320
380
  - lib/eco/api/microcases/people_search.rb
321
- - lib/eco/api/microcases/refresh_abilities.rb
381
+ - lib/eco/api/microcases/preserve_default_tag.rb
382
+ - lib/eco/api/microcases/preserve_filter_tags.rb
383
+ - lib/eco/api/microcases/preserve_policy_groups.rb
322
384
  - lib/eco/api/microcases/refresh_default_tag.rb
323
385
  - lib/eco/api/microcases/s3upload_targets.rb
324
386
  - lib/eco/api/microcases/set_account.rb
@@ -335,12 +397,13 @@ files:
335
397
  - lib/eco/api/organization.rb
336
398
  - lib/eco/api/organization/login_providers.rb
337
399
  - lib/eco/api/organization/people.rb
400
+ - lib/eco/api/organization/people_analytics.rb
338
401
  - lib/eco/api/organization/person_schemas.rb
339
402
  - lib/eco/api/organization/policy_groups.rb
340
403
  - lib/eco/api/organization/preferences.rb
341
404
  - lib/eco/api/organization/preferences_reference.json
342
405
  - lib/eco/api/organization/presets_factory.rb
343
- - lib/eco/api/organization/presets_reference.json
406
+ - lib/eco/api/organization/presets_integrity.json
344
407
  - lib/eco/api/organization/presets_values.json
345
408
  - lib/eco/api/organization/tag_tree.rb
346
409
  - lib/eco/api/policies.rb
@@ -374,6 +437,8 @@ files:
374
437
  - lib/eco/api/usecases/base_case.rb
375
438
  - lib/eco/api/usecases/base_io.rb
376
439
  - lib/eco/api/usecases/default_cases.rb
440
+ - lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb
441
+ - lib/eco/api/usecases/default_cases/analyse_people_case.rb
377
442
  - lib/eco/api/usecases/default_cases/append_usergroups_case.rb
378
443
  - lib/eco/api/usecases/default_cases/change_email_case.rb
379
444
  - lib/eco/api/usecases/default_cases/codes_to_tags_case.rb
@@ -388,7 +453,6 @@ files:
388
453
  - lib/eco/api/usecases/default_cases/new_id_case.rb
389
454
  - lib/eco/api/usecases/default_cases/new_id_case0.rb
390
455
  - lib/eco/api/usecases/default_cases/org_data_convert_case.rb
391
- - lib/eco/api/usecases/default_cases/refresh_abilities_case.rb
392
456
  - lib/eco/api/usecases/default_cases/refresh_case.rb
393
457
  - lib/eco/api/usecases/default_cases/reinvite_sync_case.rb
394
458
  - lib/eco/api/usecases/default_cases/reinvite_trans_case.rb
@@ -398,6 +462,8 @@ files:
398
462
  - lib/eco/api/usecases/default_cases/restore_db_case.rb
399
463
  - lib/eco/api/usecases/default_cases/set_default_tag_case.rb
400
464
  - lib/eco/api/usecases/default_cases/set_supervisor_case.rb
465
+ - lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb
466
+ - lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb
401
467
  - lib/eco/api/usecases/default_cases/switch_supervisor_case.rb
402
468
  - lib/eco/api/usecases/default_cases/to_csv_case.rb
403
469
  - lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb
@@ -443,6 +509,16 @@ files:
443
509
  - lib/eco/data/files/directory.rb
444
510
  - lib/eco/data/files/file_pattern.rb
445
511
  - lib/eco/data/files/helpers.rb
512
+ - lib/eco/data/fuzzy_match.rb
513
+ - lib/eco/data/fuzzy_match/array_helpers.rb
514
+ - lib/eco/data/fuzzy_match/chars_position_score.rb
515
+ - lib/eco/data/fuzzy_match/ngrams_score.rb
516
+ - lib/eco/data/fuzzy_match/pairing.rb
517
+ - lib/eco/data/fuzzy_match/result.rb
518
+ - lib/eco/data/fuzzy_match/results.rb
519
+ - lib/eco/data/fuzzy_match/score.rb
520
+ - lib/eco/data/fuzzy_match/stop_words.rb
521
+ - lib/eco/data/fuzzy_match/string_helpers.rb
446
522
  - lib/eco/data/mapper.rb
447
523
  - lib/eco/language.rb
448
524
  - 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