eco-helpers 2.0.55 → 2.0.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -3
- data/eco-helpers.gemspec +1 -1
- data/lib/eco/api/common/loaders/base.rb +8 -0
- data/lib/eco/api/common/people/default_parsers/boolean_parser.rb +1 -1
- data/lib/eco/api/common/people/entry_factory.rb +1 -0
- data/lib/eco/api/common/session/file_manager.rb +2 -2
- data/lib/eco/api/common/session/sftp.rb +8 -2
- data/lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb +17 -0
- data/lib/eco/api/microcases/set_supervisor.rb +1 -1
- data/lib/eco/api/organization/login_providers.rb +25 -11
- data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +30 -8
- data/lib/eco/api/session/config/people.rb +13 -1
- data/lib/eco/api/session/config.rb +5 -0
- data/lib/eco/api/usecases/default_cases/clear_abilities_case.rb +22 -0
- data/lib/eco/api/usecases/default_cases/hris_case.rb +1 -1
- data/lib/eco/api/usecases/default_cases.rb +1 -0
- data/lib/eco/api/usecases/ooze_samples/helpers/shortcuts.rb +29 -2
- data/lib/eco/api/usecases/ooze_samples/ooze_base_case.rb +17 -4
- data/lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb +14 -12
- data/lib/eco/api/usecases/ooze_samples/register_update_case.rb +2 -2
- data/lib/eco/cli/config/default/usecases.rb +4 -0
- data/lib/eco/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6c0a28540154a0421d36734a7b0a7f1d7e52b54082390804f696968b8a24d7c
|
4
|
+
data.tar.gz: 5f046e1b94bca34335551f14d5be2e7082ee91d131200609a8d0d517b0342334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 175e05b1799c9231570b9cd69cd25aafbef5f3db65e48be20c070fef5535d7679c04f032ab885d1cad2ea85fa1191b93d151d903b880821b5d2ad4db482d71ca
|
7
|
+
data.tar.gz: 4fa3671f1519440527d99aa4123aa287642cd8f1e535bba0a0a0201d1a23b15a902d4beca2e5994826746d28fd1b0e3e21fcdb647d3eac462feb067b9434552d
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,68 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.0.
|
4
|
+
## [2.0.57] - 2022-05-31
|
5
5
|
|
6
6
|
### Added
|
7
|
+
- **Usecase**`Eco::API::UseCases::DefaultCases::ClearAbilitiesTransCase`
|
8
|
+
- invokable with `clear-abilities`
|
9
|
+
- `Eco::API::Session::Config::People` added
|
10
|
+
- `default_login_method` helpers
|
11
|
+
- `Eco::API::Session::Config#default_login_method=` added
|
12
|
+
- `Eco::API::Common::Loaders::Base#abort` method to log an error and raise an exception
|
13
|
+
- **patched** `Ecoportal::API::Internal::Person`
|
14
|
+
- Added a couple of handy helpers: `#replace_doc` and `#replace_original_doc`
|
15
|
+
|
7
16
|
### Changed
|
8
|
-
- `Eco::API::
|
17
|
+
- `Eco::API::Common::Session::SFTP#move` new parameter `override:` (default: `true`)
|
18
|
+
- If there was an error, it would delete the destination remote file and retry to move the file
|
19
|
+
- upgraded `ecoportal-api-v2` gem to `0.8.28`
|
20
|
+
- `Eco::API::Organization::LoginProviders#login_provider`
|
21
|
+
- Added support to fetch based on type (i.e. password, sso)
|
22
|
+
- `Eco::API::Policies::DefaultPolicies::UserAccess`
|
23
|
+
- Added support for `config.default_login_method`
|
9
24
|
|
10
25
|
### Fixed
|
26
|
+
- `Eco::API::Common::People::EntryFactory`
|
27
|
+
- Max allowed enconding errors was not working (it was just fixing all).
|
28
|
+
|
29
|
+
## [2.0.57] - 2022-04-29
|
30
|
+
|
31
|
+
### Changed
|
32
|
+
- `Eco::API::UseCases::DefaultCases::HrisCase`
|
33
|
+
- Made it so the `leavers` batch runs first
|
34
|
+
- This aims to prevent some errors such as `cyclic supervisor` or `email already taken`
|
35
|
+
|
36
|
+
## [2.0.56] - 2022-04-25
|
37
|
+
|
38
|
+
### Added
|
39
|
+
- `Eco::API::UseCases::OozeSamples::OozeBaseCase#add_field_by_doc`
|
40
|
+
- Same as `#add_field` but using an existing _**doc**_ as a model
|
41
|
+
|
42
|
+
### Changed
|
43
|
+
- `ecoportal-api-v2` dependency upgrade
|
44
|
+
- `Eco::API::Common::Session::FileManager#file_content`
|
45
|
+
- added parameter `mode:` to options can be used as well
|
46
|
+
- `Eco::API::UseCases::OozeSamples::Helpers::Shortcuts#same_string?`
|
47
|
+
- Added parameter `mild:` to compare the strings with only alphabetic characters
|
48
|
+
- `Eco::API::UseCases::OozeSamples::OozeRunBaseCase`
|
49
|
+
- `#main` and `#process_ooze` methods were not obvious to use
|
50
|
+
- `Eco::API::UseCases::OozeSamples::RegisterUpdateCase` slight change on the **`run` summary message**
|
51
|
+
|
52
|
+
### Fixed
|
53
|
+
- `Eco::API::UseCases::OozeSamples::OozeBaseCase#update_ooze`
|
54
|
+
- Added call to `validate` also when we are on `dry-run` **mode**
|
55
|
+
|
56
|
+
## [2.0.55] - 2022-04-04
|
57
|
+
|
58
|
+
### Fixed
|
59
|
+
- `Eco::API::UseCases::DefaultCases::Samples::Sftp` should move the basename to Windows compatible chars.
|
11
60
|
|
12
61
|
## [2.0.54] - 2022-04-04
|
13
62
|
|
14
63
|
### Added
|
15
64
|
- `Eco::API::UseCases::DefaultCases::Samples::Sftp` should tell where the files went in the local.
|
16
65
|
|
17
|
-
|
18
66
|
## [2.0.53] - 2022-04-04
|
19
67
|
|
20
68
|
### Added
|
data/eco-helpers.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
|
32
32
|
|
33
33
|
spec.add_dependency 'ecoportal-api', '>= 0.8.5', '< 0.9'
|
34
|
-
spec.add_dependency 'ecoportal-api-v2', '>= 0.8.
|
34
|
+
spec.add_dependency 'ecoportal-api-v2', '>= 0.8.28', '< 0.9'
|
35
35
|
spec.add_dependency 'aws-sdk-s3', '>= 1.83.0', '< 2'
|
36
36
|
spec.add_dependency 'aws-sdk-ses', '>= 1.36.0', '< 2'
|
37
37
|
spec.add_dependency 'dotenv', '>= 2.7.6', '< 2.8'
|
@@ -38,14 +38,14 @@ module Eco
|
|
38
38
|
dir.newest_file(file: filename)
|
39
39
|
end
|
40
40
|
|
41
|
-
def file_content(filename)
|
41
|
+
def file_content(filename, mode: nil)
|
42
42
|
file = dir.file(filename, should_exist: true)
|
43
43
|
if !file
|
44
44
|
logger.error("Can't read from file '#{filename}' because it does not exist.")
|
45
45
|
return nil
|
46
46
|
end
|
47
47
|
logger.debug("Reading from file '#{file}'")
|
48
|
-
File.read(file)
|
48
|
+
mode ? File.read(file, mode: mode) : File.read(file)
|
49
49
|
end
|
50
50
|
|
51
51
|
def load_json(filename)
|
@@ -56,8 +56,14 @@ module Eco
|
|
56
56
|
end
|
57
57
|
|
58
58
|
# @see Net::SFTP::Session#rename
|
59
|
-
def move(fullname_source, fullname_dest, flags=0x0001, &callback)
|
60
|
-
|
59
|
+
def move(fullname_source, fullname_dest, flags=0x0001, override: true, &callback)
|
60
|
+
begin
|
61
|
+
sftp_session.rename!(fullname_source, fullname_dest, flags, &callback)
|
62
|
+
rescue Net::SFTP::StatusException => e
|
63
|
+
raise unless override
|
64
|
+
sftp_session.remove(fullname_dest)
|
65
|
+
sftp_session.rename!(fullname_source, fullname_dest, flags, &callback)
|
66
|
+
end
|
61
67
|
end
|
62
68
|
|
63
69
|
# Downloads the files specified to a local folder
|
@@ -14,6 +14,23 @@ module Ecoportal
|
|
14
14
|
account && !ref_doc["account"]
|
15
15
|
end
|
16
16
|
|
17
|
+
# It replaces `doc` by `new_doc`
|
18
|
+
# @return [Hash] `doc` before change
|
19
|
+
def replace_doc!(new_doc)
|
20
|
+
raise UnlinkedModel.new(from: "#{self.class}#replace_doc", key: _key) unless linked?
|
21
|
+
@doc.tap do
|
22
|
+
@doc = new_doc
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# It replaces `original_doc` by `new_doc`
|
27
|
+
# @return [Hash] `original_doc` before change
|
28
|
+
def replace_original_doc!(new_doc)
|
29
|
+
raise UnlinkedModel.new(from: "#{self.class}#replace_original_doc", key: _key) unless linked?
|
30
|
+
@original_doc.tap do
|
31
|
+
@original_doc = new_doc
|
32
|
+
end
|
33
|
+
end
|
17
34
|
end
|
18
35
|
end
|
19
36
|
end
|
@@ -3,7 +3,7 @@ module Eco
|
|
3
3
|
class MicroCases
|
4
4
|
# Unique access point to set the `supervisor_id` value on a person.
|
5
5
|
# @note
|
6
|
-
# - It prevents the basic cyclic supervisor case (supervisor to be supervisor of
|
6
|
+
# - It prevents the basic cyclic supervisor case (supervisor to be supervisor of themselves)
|
7
7
|
# @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
|
8
8
|
# @param sup_id [nil, String] the **supervisor id** we should set on the `person`.
|
9
9
|
# @param people [Eco::API::Organization::People] _People_ involved in the current update.
|
@@ -56,27 +56,41 @@ module Eco
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
# @param id_name_type [String, Symbol]
|
60
|
+
# - `String` to refer to the login provider `name` or `id`
|
61
|
+
# - `Symbol` to refer to the login providr type (i.e. `:password`, `:sso`)
|
62
|
+
def login_provider(id_name_type)
|
63
|
+
@by_id[login_provider_id(id_name_type)]
|
61
64
|
end
|
62
65
|
|
63
66
|
private
|
64
67
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
def login_provider_id(value)
|
69
|
+
case value
|
70
|
+
when Symbol
|
71
|
+
value = value.to_s.downcase.to_sym
|
72
|
+
@by_type[value]&.id
|
73
|
+
when String
|
74
|
+
value = value.strip.downcase
|
75
|
+
@by_name[value]&.id || @by_id[value]&.id
|
76
|
+
end
|
71
77
|
end
|
72
78
|
|
73
79
|
def init_caches
|
74
80
|
return if @caches_init
|
75
|
-
|
76
|
-
@
|
81
|
+
enabled_lps = self.select {|lp| lp.enabled_for != "disabled"}
|
82
|
+
@by_id = enabled_lps.each_with_object({}) do |lp, hash|
|
83
|
+
hash[lp.id.downcase] = lp
|
84
|
+
end
|
85
|
+
@by_name = enabled_lps.each_with_object({}) do |lp, hash|
|
86
|
+
hash[lp.name.downcase] = lp
|
87
|
+
end
|
88
|
+
@by_type = enabled_lps.each_with_object({}) do |lp, hash|
|
89
|
+
hash[lp.type.downcase.to_sym] = lp
|
90
|
+
hash[:sso] = lp if (!hash.key?(:sso) && lp.type == "saml")
|
91
|
+
end
|
77
92
|
@caches_init = true
|
78
93
|
end
|
79
|
-
|
80
94
|
end
|
81
95
|
end
|
82
96
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# Default policy:
|
2
|
+
# 1. Removes the account if the email is empty
|
3
|
+
# 2. Adds the defined default_usergroup if user does not have policy groups
|
4
|
+
# 3. Adds the defined default_login_method if update includes empty login methods
|
1
5
|
class Eco::API::Policies::DefaultPolicies::UserAccess < Eco::API::Common::Loaders::Policy
|
2
6
|
name "default-user-access"
|
3
7
|
|
@@ -10,8 +14,12 @@ class Eco::API::Policies::DefaultPolicies::UserAccess < Eco::API::Common::Loader
|
|
10
14
|
self.account_removed_count = 0
|
11
15
|
|
12
16
|
people.each do |person|
|
13
|
-
remove_account_when_no_email!(person)
|
14
|
-
|
17
|
+
remove_account_when_no_email!(person) if person.email.to_s.empty?
|
18
|
+
next unless account = person.account
|
19
|
+
if account.policy_group_ids.empty? && def_pg
|
20
|
+
account.policy_group_ids = [def_pg]
|
21
|
+
end
|
22
|
+
add_login_method_if_applicable!(account)
|
15
23
|
end
|
16
24
|
|
17
25
|
warn_account_removal!
|
@@ -39,20 +47,34 @@ class Eco::API::Policies::DefaultPolicies::UserAccess < Eco::API::Common::Loader
|
|
39
47
|
return !!person.original_doc["account"]
|
40
48
|
end
|
41
49
|
|
42
|
-
def
|
43
|
-
|
50
|
+
def add_login_method_if_applicable!(account)
|
51
|
+
return unless account.as_update.key?("login_provider_ids")
|
52
|
+
if account.login_provider_ids.empty? && def_login
|
53
|
+
account.login_provider_ids = [def_login]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def def_pg
|
58
|
+
@def_pg ||= policy_groups.to_id(default_group)
|
44
59
|
end
|
45
60
|
|
46
|
-
def
|
47
|
-
@
|
61
|
+
def def_login
|
62
|
+
@def_login ||= login_providers.to_id(default_login)
|
48
63
|
end
|
49
64
|
|
50
65
|
def default_group
|
51
|
-
|
66
|
+
config.people.default_usergroup
|
67
|
+
end
|
68
|
+
|
69
|
+
def default_login
|
70
|
+
config.people.default_login_method
|
71
|
+
end
|
72
|
+
|
73
|
+
def login_providers
|
74
|
+
session.login_providers
|
52
75
|
end
|
53
76
|
|
54
77
|
def policy_groups
|
55
78
|
session.policy_groups
|
56
79
|
end
|
57
|
-
|
58
80
|
end
|
@@ -86,7 +86,19 @@ module Eco
|
|
86
86
|
def default_schema?
|
87
87
|
!!self["default_schema"]
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
|
+
def default_login_method=(name)
|
91
|
+
self["default_login_method"] = name
|
92
|
+
end
|
93
|
+
|
94
|
+
def default_login_method
|
95
|
+
self["default_login_method"]
|
96
|
+
end
|
97
|
+
|
98
|
+
def default_login_method?
|
99
|
+
!!self["default_login_method"]
|
100
|
+
end
|
101
|
+
|
90
102
|
# @return [Hash] with defined pairs format `key` and Person parsers.
|
91
103
|
def parsers
|
92
104
|
self["parsers"] ||= {}
|
@@ -297,6 +297,11 @@ module Eco
|
|
297
297
|
people.default_schema = name
|
298
298
|
end
|
299
299
|
|
300
|
+
# Set the **default login method** that users should acquire.
|
301
|
+
def default_login_method=(name)
|
302
|
+
people.default_login_method = name
|
303
|
+
end
|
304
|
+
|
300
305
|
# @see Eco::API::Session::Config::People
|
301
306
|
# @param (see Eco::API::Session::Config::People)
|
302
307
|
# @return [Eco::API::Common::People::PersonParser] parser/serializer for the defined `format`.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Eco::API::UseCases::DefaultCases::ClearAbilitiesTransCase < Eco::API::Common::Loaders::UseCase
|
2
|
+
name "clear-abilities"
|
3
|
+
type :transform
|
4
|
+
|
5
|
+
def main(people, session, options, usecase)
|
6
|
+
clear_abilities(people.users, session, options, usecase)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def clear_abilities(users, session, options, usecase)
|
12
|
+
update = session.new_job("main", "clear-abilities", :update, usecase, :account)
|
13
|
+
users.each do |person|
|
14
|
+
person.account.permissions_custom = nil_abilities.dup
|
15
|
+
update.add(person)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def nil_abilities
|
20
|
+
@nil_abilities ||= Eco::API::Organization::PresetsFactory.all_abilities
|
21
|
+
end
|
22
|
+
end
|
@@ -9,10 +9,10 @@ class Eco::API::UseCases::DefaultCases::HrisCase < Eco::API::Common::Loaders::Us
|
|
9
9
|
@session = session; @options = options; @people = people
|
10
10
|
require_only_one_schema!
|
11
11
|
micro = session.micro
|
12
|
+
@leavers = session.new_job("pre", "leavers", :update, usecase, :account)
|
12
13
|
@creation = session.new_job("main", "create", :create, usecase)
|
13
14
|
@update = session.new_job("main", "update", :update, usecase)
|
14
15
|
@supers = session.new_job("post", "supers", :update, usecase, :core)
|
15
|
-
@leavers = session.new_job("post", "leavers", :update, usecase, :account)
|
16
16
|
|
17
17
|
micro.with_each_leaver(entries, people, options) do |person|
|
18
18
|
leavers.add(person, &method(:leavers_callback))
|
@@ -15,6 +15,7 @@ require_relative 'default_cases/analyse_people_case'
|
|
15
15
|
require_relative 'default_cases/append_usergroups_case'
|
16
16
|
require_relative 'default_cases/change_email_case'
|
17
17
|
require_relative 'default_cases/clean_unknown_tags_case'
|
18
|
+
require_relative 'default_cases/clear_abilities_case'
|
18
19
|
require_relative 'default_cases/codes_to_tags_case'
|
19
20
|
require_relative 'default_cases/create_case'
|
20
21
|
require_relative 'default_cases/create_details_case'
|
@@ -6,13 +6,20 @@ module Eco
|
|
6
6
|
module Shortcuts
|
7
7
|
|
8
8
|
# Offers multiple ways to compare two strings
|
9
|
-
def same_string?(value1, value2, exact: false)
|
9
|
+
def same_string?(value1, value2, exact: false, mild: false)
|
10
10
|
case
|
11
11
|
when value1.is_a?(String) && value2.is_a?(String)
|
12
12
|
if exact
|
13
13
|
value1 == value2
|
14
14
|
else
|
15
|
-
|
15
|
+
v1 = value1.to_s.strip.downcase
|
16
|
+
v2 = value2.to_s.strip.downcase
|
17
|
+
|
18
|
+
if mild
|
19
|
+
v1 = v1.gsub(/[^a-z ]+/, ' ').gsub(/\s+/, ' ').strip
|
20
|
+
v2 = v2.gsub(/[^a-z ]+/, ' ').gsub(/\s+/, ' ').strip
|
21
|
+
end
|
22
|
+
v1 == v2
|
16
23
|
end
|
17
24
|
when value1.is_a?(Regexp) && value2.is_a?(String)
|
18
25
|
value2 =~ value1
|
@@ -64,11 +71,31 @@ module Eco
|
|
64
71
|
ref << "Page (#{obj.id}) (#{object_reference(obj.current_stage)})"
|
65
72
|
when Ecoportal::API::V2::Page
|
66
73
|
ref << "Page"
|
74
|
+
when Ecoportal::API::V2::Page::Section
|
75
|
+
ref << "Section '#{obj.heading || "(unnamed)"}'"
|
76
|
+
when Ecoportal::API::V2::Page::Component
|
77
|
+
ref << "Component '#{obj.label || "(unnamed of type '#{obj.type}')"}' in #{object_reference(obj.section)}"
|
78
|
+
when Ecoportal::API::V2::Page::Force
|
79
|
+
ref << "Force '#{obj.name}'"
|
80
|
+
when Ecoportal::API::V2::Page::Force::Binding
|
81
|
+
ref << "Binding '#{obj.name}' in #{object_reference(obj.force)}"
|
67
82
|
end
|
68
83
|
ref << " '#{obj.name}'" if obj.respond_to?(:name)
|
69
84
|
end
|
70
85
|
end
|
71
86
|
|
87
|
+
def to_i
|
88
|
+
Float(value).to_i
|
89
|
+
end
|
90
|
+
|
91
|
+
# https://stackoverflow.com/a/5661695/4352306
|
92
|
+
def is_number?(value)
|
93
|
+
begin
|
94
|
+
true if Float(value)
|
95
|
+
rescue ArgumentError => e
|
96
|
+
false
|
97
|
+
end
|
98
|
+
end
|
72
99
|
end
|
73
100
|
end
|
74
101
|
end
|
@@ -29,7 +29,18 @@ class Eco::API::UseCases::OozeSamples::OozeBaseCase < Eco::API::Common::Loaders:
|
|
29
29
|
|
30
30
|
protected
|
31
31
|
|
32
|
-
def
|
32
|
+
def add_field_by_doc(doc, section, after: nil, before: nil, side: :left)
|
33
|
+
unless section.is_a?(Ecoportal::API::V2::Page::Section)
|
34
|
+
raise "You need to specify a section for a new field. Given: #{section.class}"
|
35
|
+
end
|
36
|
+
target.components.add(doc: doc) do |field|
|
37
|
+
section.add_component(field, after: after, before: before, side: side)
|
38
|
+
end.tap do |field|
|
39
|
+
yield(field) if block_given?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def add_field(name, type, section, after: nil, before: nil, side: :left)
|
33
44
|
unless section.is_a?(Ecoportal::API::V2::Page::Section)
|
34
45
|
raise "You need to specify a section for a new field. Given: #{section.class}"
|
35
46
|
end
|
@@ -92,7 +103,7 @@ class Eco::API::UseCases::OozeSamples::OozeBaseCase < Eco::API::Common::Loaders:
|
|
92
103
|
if ooze_id = ooze && ooze.id
|
93
104
|
exit_error "#{object_reference(ooze)} does not have stages!" unless ooze.stages?
|
94
105
|
else
|
95
|
-
exit_error "There's no target ooze to
|
106
|
+
exit_error "There's no target ooze to retrieve stages from"
|
96
107
|
end
|
97
108
|
|
98
109
|
if stg = ooze.stages[id_name] || ooze.stages.get_by_name(id_name)
|
@@ -129,11 +140,15 @@ class Eco::API::UseCases::OozeSamples::OozeBaseCase < Eco::API::Common::Loaders:
|
|
129
140
|
end
|
130
141
|
end
|
131
142
|
else
|
143
|
+
ooze.validate.tap do |validation|
|
144
|
+
logger.error(validation) if validation.is_a?(String)
|
145
|
+
end
|
132
146
|
unless options.dig(:feedback, :only_stats)
|
133
147
|
if patch = (patch_doc(ooze) || {})["page"]
|
134
148
|
pp patch
|
135
149
|
end
|
136
150
|
end
|
151
|
+
|
137
152
|
backup_patch!(ooze)
|
138
153
|
exit(0) if dirty?(ooze) && dry_count > DRY_COUNT
|
139
154
|
false
|
@@ -189,6 +204,4 @@ class Eco::API::UseCases::OozeSamples::OozeBaseCase < Eco::API::Common::Loaders:
|
|
189
204
|
logger.error(msg)
|
190
205
|
exit(1)
|
191
206
|
end
|
192
|
-
|
193
|
-
|
194
207
|
end
|
@@ -3,24 +3,26 @@ class Eco::API::UseCases::OozeSamples::OozeRunBaseCase < Eco::API::UseCases::Ooz
|
|
3
3
|
name "ooze-run-base"
|
4
4
|
type :other
|
5
5
|
|
6
|
-
attr_reader :session, :options, :usecase
|
7
|
-
|
8
6
|
SAVE_PATCH = "ooze_patch_update.json"
|
9
7
|
|
10
|
-
def main(session, options, usecase
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
yield(ooze)
|
8
|
+
def main(session, options, usecase)
|
9
|
+
super(session, options, usecase) do
|
10
|
+
if method(:process_ooze).parameters.count == 0
|
11
|
+
ooze # retrieve ooze
|
12
|
+
process_ooze
|
13
|
+
else
|
14
|
+
process_ooze(ooze)
|
15
|
+
end
|
16
|
+
yield(target) if block_given?
|
20
17
|
exit_if_no_changes!
|
18
|
+
update_ooze(target)
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
22
|
+
def process_ooze(page = target)
|
23
|
+
raise "You need to redefine this method"
|
24
|
+
end
|
25
|
+
|
24
26
|
private
|
25
27
|
|
26
28
|
def ooze
|
@@ -39,7 +39,8 @@ class Eco::API::UseCases::OozeSamples::RegisterUpdateCase < Eco::API::UseCases::
|
|
39
39
|
msg += " • Duplicated search results #{dupped_search_oozes}\n"
|
40
40
|
msg += " • Retrieved a total of #{retrieved_oozes}\n"
|
41
41
|
msg += " • Could not get #{non_retrieved_oozes} oozes.\n"
|
42
|
-
msg += " • Updated #{updated_oozes} oozes
|
42
|
+
msg += " • Updated #{updated_oozes} oozes.\n"
|
43
|
+
msg += " - Failed update on #{failed_update_oozes} oozes.\n"
|
43
44
|
logger.info(msg)
|
44
45
|
end
|
45
46
|
|
@@ -72,7 +73,6 @@ class Eco::API::UseCases::OozeSamples::RegisterUpdateCase < Eco::API::UseCases::
|
|
72
73
|
end
|
73
74
|
|
74
75
|
if pending = queue_shift(page_result.id)
|
75
|
-
|
76
76
|
if dirty?(pending)
|
77
77
|
msg = "Inconsistent search results. "
|
78
78
|
msg << "Launching update on '#{object_reference(pending)}' to be able to queue it back"
|
@@ -196,6 +196,10 @@ ASSETS.cli.config do |cnf|
|
|
196
196
|
options.deep_merge!(force: {invite: true})
|
197
197
|
end
|
198
198
|
|
199
|
+
desc = "Clears the `permissions_custom`, provided that Policy Group abilities alone apply."
|
200
|
+
desc += " Please be mindfull if you use this option (there may be users that have been upgraded in ad-hoc manner)."
|
201
|
+
cases.add("-clear-abilities", :transform, desc, case_name: "clear-abilities")
|
202
|
+
|
199
203
|
desc = "Deletes everybody that has been filtered from the people manager"
|
200
204
|
cases.add("-delete", :transform, desc, case_name: "delete")
|
201
205
|
desc = "Deletes the people specified in the input data"
|
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.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.8.
|
139
|
+
version: 0.8.28
|
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.28
|
150
150
|
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.9'
|
@@ -528,6 +528,7 @@ files:
|
|
528
528
|
- lib/eco/api/usecases/default_cases/append_usergroups_case.rb
|
529
529
|
- lib/eco/api/usecases/default_cases/change_email_case.rb
|
530
530
|
- lib/eco/api/usecases/default_cases/clean_unknown_tags_case.rb
|
531
|
+
- lib/eco/api/usecases/default_cases/clear_abilities_case.rb
|
531
532
|
- lib/eco/api/usecases/default_cases/codes_to_tags_case.rb
|
532
533
|
- lib/eco/api/usecases/default_cases/create_case.rb
|
533
534
|
- lib/eco/api/usecases/default_cases/create_details_case.rb
|