eco-helpers 2.0.16 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -6
- data/eco-helpers.gemspec +6 -4
- data/lib/eco-helpers.rb +1 -0
- data/lib/eco/api/common/base_loader.rb +14 -0
- data/lib/eco/api/common/people/default_parsers/date_parser.rb +11 -1
- data/lib/eco/api/common/people/default_parsers/login_providers_parser.rb +1 -1
- data/lib/eco/api/common/people/default_parsers/policy_groups_parser.rb +11 -11
- data/lib/eco/api/common/people/person_entry.rb +4 -2
- data/lib/eco/api/common/session/mailer.rb +0 -1
- data/lib/eco/api/common/session/s3_uploader.rb +0 -1
- data/lib/eco/api/common/session/sftp.rb +0 -1
- data/lib/eco/api/microcases.rb +3 -1
- data/lib/eco/api/microcases/append_usergroups.rb +0 -1
- data/lib/eco/api/microcases/people_cache.rb +2 -2
- data/lib/eco/api/microcases/people_load.rb +2 -2
- data/lib/eco/api/microcases/people_refresh.rb +2 -2
- data/lib/eco/api/microcases/people_search.rb +6 -6
- data/lib/eco/api/microcases/preserve_default_tag.rb +23 -0
- data/lib/eco/api/microcases/preserve_filter_tags.rb +28 -0
- data/lib/eco/api/microcases/preserve_policy_groups.rb +30 -0
- data/lib/eco/api/microcases/set_account.rb +0 -1
- data/lib/eco/api/organization.rb +1 -0
- data/lib/eco/api/organization/people.rb +7 -0
- data/lib/eco/api/organization/people_analytics.rb +60 -0
- data/lib/eco/api/organization/presets_factory.rb +22 -83
- data/lib/eco/api/organization/presets_integrity.json +6 -0
- data/lib/eco/api/organization/presets_values.json +5 -4
- data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +0 -30
- data/lib/eco/api/session.rb +1 -20
- data/lib/eco/api/session/batch.rb +23 -7
- data/lib/eco/api/session/config.rb +0 -10
- data/lib/eco/api/session/config/people.rb +1 -17
- data/lib/eco/api/usecases/default_cases.rb +1 -1
- data/lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb +1 -1
- data/lib/eco/api/usecases/default_cases/analyse_people_case.rb +76 -0
- data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +2 -3
- data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +11 -1
- data/lib/eco/api/usecases/default_cases/restore_db_case.rb +1 -2
- data/lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb +1 -1
- data/lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb +1 -1
- data/lib/eco/api/usecases/default_cases/to_csv_case.rb +85 -27
- data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +62 -36
- data/lib/eco/cli/config/default/options.rb +19 -17
- data/lib/eco/cli/config/default/people_filters.rb +3 -3
- data/lib/eco/cli/config/default/usecases.rb +66 -32
- data/lib/eco/cli/config/default/workflow.rb +1 -1
- data/lib/eco/cli/config/help.rb +1 -0
- data/lib/eco/cli/config/options_set.rb +106 -13
- data/lib/eco/cli/config/use_cases.rb +33 -33
- data/lib/eco/cli/scripting/args_helpers.rb +30 -3
- data/lib/eco/data.rb +1 -0
- data/lib/eco/data/crypto/encryption.rb +3 -3
- data/lib/eco/data/files/helpers.rb +6 -4
- data/lib/eco/data/fuzzy_match.rb +119 -0
- data/lib/eco/data/fuzzy_match/array_helpers.rb +75 -0
- data/lib/eco/data/fuzzy_match/chars_position_score.rb +37 -0
- data/lib/eco/data/fuzzy_match/ngrams_score.rb +73 -0
- data/lib/eco/data/fuzzy_match/pairing.rb +102 -0
- data/lib/eco/data/fuzzy_match/result.rb +67 -0
- data/lib/eco/data/fuzzy_match/results.rb +53 -0
- data/lib/eco/data/fuzzy_match/score.rb +44 -0
- data/lib/eco/data/fuzzy_match/stop_words.rb +35 -0
- data/lib/eco/data/fuzzy_match/string_helpers.rb +69 -0
- data/lib/eco/version.rb +1 -1
- metadata +82 -10
- data/lib/eco/api/microcases/refresh_abilities.rb +0 -19
- data/lib/eco/api/organization/presets_reference.json +0 -59
- data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +0 -30
data/lib/eco/version.rb
CHANGED
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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/
|
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,13 +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
406
|
- lib/eco/api/organization/presets_integrity.json
|
344
|
-
- lib/eco/api/organization/presets_reference.json
|
345
407
|
- lib/eco/api/organization/presets_values.json
|
346
408
|
- lib/eco/api/organization/tag_tree.rb
|
347
409
|
- lib/eco/api/policies.rb
|
@@ -376,6 +438,7 @@ files:
|
|
376
438
|
- lib/eco/api/usecases/base_io.rb
|
377
439
|
- lib/eco/api/usecases/default_cases.rb
|
378
440
|
- lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb
|
441
|
+
- lib/eco/api/usecases/default_cases/analyse_people_case.rb
|
379
442
|
- lib/eco/api/usecases/default_cases/append_usergroups_case.rb
|
380
443
|
- lib/eco/api/usecases/default_cases/change_email_case.rb
|
381
444
|
- lib/eco/api/usecases/default_cases/codes_to_tags_case.rb
|
@@ -390,7 +453,6 @@ files:
|
|
390
453
|
- lib/eco/api/usecases/default_cases/new_id_case.rb
|
391
454
|
- lib/eco/api/usecases/default_cases/new_id_case0.rb
|
392
455
|
- lib/eco/api/usecases/default_cases/org_data_convert_case.rb
|
393
|
-
- lib/eco/api/usecases/default_cases/refresh_abilities_case.rb
|
394
456
|
- lib/eco/api/usecases/default_cases/refresh_case.rb
|
395
457
|
- lib/eco/api/usecases/default_cases/reinvite_sync_case.rb
|
396
458
|
- lib/eco/api/usecases/default_cases/reinvite_trans_case.rb
|
@@ -447,6 +509,16 @@ files:
|
|
447
509
|
- lib/eco/data/files/directory.rb
|
448
510
|
- lib/eco/data/files/file_pattern.rb
|
449
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
|
450
522
|
- lib/eco/data/mapper.rb
|
451
523
|
- lib/eco/language.rb
|
452
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
|