eco-helpers 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fe8fa73efd298f498da1a2dd233cb40b3c4f3810a24762d6d60ca3d29f04786
4
- data.tar.gz: e377424f7424d88548674f29c742250d75adadcd9c9b49d96d8f9593a6d90fd5
3
+ metadata.gz: 4ab57a6eb9ae88d667354760cf6b2253c31dd2f0eefdac131319481005d6ce6e
4
+ data.tar.gz: ac353abcc15fbaa889657aaad28b7ddb81db825575e2388d1f4b7873b98fdeb0
5
5
  SHA512:
6
- metadata.gz: c76d0d688292fcff201bea5e447c53a97939153c1a9a65c7d840ab9dede00e9b55cc08e9feb02f8e16744f6c051737624769d34ae59d1f476c50c5ed8e57782b
7
- data.tar.gz: 6db7c8ccfacd19e2edf056b63cb6280aed96a70c26bdef4943e89e108927e2d1f8b8ffdecea7f93e493fccf8c04096e0549ef93554be313063b07e81dc11fcf0
6
+ metadata.gz: 9ef95889230b88cd10529ec3b92aa2704fae334ea33d1e183319184f63996c772de2060f3eff1fd4d9746432d67decce6a960d2dee992e179ad41bce2ced0624
7
+ data.tar.gz: c0bfdfb7d970a74855ba60fb85867ea191fca3580321234a816582712a5b578f9e279b555677ce7ca7353b0e4ed11d31fe1fd7ae7a71a97637f12cf2760c1704
@@ -33,6 +33,7 @@ module Eco
33
33
  ChangeEMailCase.new(self).process
34
34
  SetDefaultTagCase.new(self).process
35
35
  CreateCase.new(self).process
36
+ AppendUsergroupsCase.new(self).process
36
37
  UpdateCase.new(self).process
37
38
  UpsertCase.new(self).process
38
39
  HrisCase.new(self).process
@@ -64,6 +65,7 @@ require_relative 'default_cases/recover_db_case'
64
65
  require_relative 'default_cases/change_email_case'
65
66
  require_relative 'default_cases/set_default_tag_case'
66
67
  require_relative 'default_cases/create_case'
68
+ require_relative 'default_cases/append_usergroups_case'
67
69
  require_relative 'default_cases/update_case'
68
70
  require_relative 'default_cases/upsert_case'
69
71
  require_relative 'default_cases/hris_case'
@@ -0,0 +1,36 @@
1
+ module Eco
2
+ module API
3
+ class UseCases
4
+ class DefaultCases
5
+ class AppendUsergroupsCase < DefaultCase
6
+
7
+ def process
8
+ @cases.define("append-usergroups", type: :sync) do |entries, people, session, options, usecase|
9
+ update = session.job_group("main").new("update", usecase: usecase, type: :update, sets: [:core, :details, :account])
10
+
11
+ strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict))
12
+ pgs = session.policy_groups
13
+
14
+ entries.each.with_index do |entry, i|
15
+ if person = people.find(entry, strict: strict_search)
16
+ if person.account
17
+ ini_pg_ids = person.account&.policy_group_ids || []
18
+ add = entry.internal_entry["policy_group_ids"].split("|").compact
19
+ person.account.policy_group_ids = (ini_pg_ids | add).uniq
20
+
21
+ person.account.permissions_custom = session.new_preset(person) unless options.dig(:exclude, :abilities)
22
+ update.add(person)
23
+ end
24
+ else
25
+ session.logger.error("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}")
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -63,6 +63,7 @@ ASSETS.cli.config do |cnf|
63
63
  end
64
64
 
65
65
  cases.add("-create-from", :sync, case_name: "create")
66
+ cases.add("-append-usergroups-from", :sync, case_name: "append-usergroups")
66
67
  cases.add("-update-from", :sync, case_name: "update")
67
68
  cases.add("-refresh", :transform, case_name: "refresh")
68
69
  cases.add("-refresh-presets", :transform, case_name: "refresh-presets")
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "1.3.4"
2
+ VERSION = "1.3.5"
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: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -299,6 +299,7 @@ files:
299
299
  - lib/eco/api/usecases/base_io.rb
300
300
  - lib/eco/api/usecases/default_case.rb
301
301
  - lib/eco/api/usecases/default_cases.rb
302
+ - lib/eco/api/usecases/default_cases/append_usergroups_case.rb
302
303
  - lib/eco/api/usecases/default_cases/change_email_case.rb
303
304
  - lib/eco/api/usecases/default_cases/codes_to_tags_case.rb
304
305
  - lib/eco/api/usecases/default_cases/create_case.rb