eco-helpers 2.0.58 → 2.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6c0a28540154a0421d36734a7b0a7f1d7e52b54082390804f696968b8a24d7c
4
- data.tar.gz: 5f046e1b94bca34335551f14d5be2e7082ee91d131200609a8d0d517b0342334
3
+ metadata.gz: aec1ba6cc48e340c576f141bec3e128afcb0fe7e072051c8a6da5a6e0fb9c3b1
4
+ data.tar.gz: a592079366217bd0ec34fbae8a659ed971cc79bdac762a26f5f36e2346f0f944
5
5
  SHA512:
6
- metadata.gz: 175e05b1799c9231570b9cd69cd25aafbef5f3db65e48be20c070fef5535d7679c04f032ab885d1cad2ea85fa1191b93d151d903b880821b5d2ad4db482d71ca
7
- data.tar.gz: 4fa3671f1519440527d99aa4123aa287642cd8f1e535bba0a0a0201d1a23b15a902d4beca2e5994826746d28fd1b0e3e21fcdb647d3eac462feb067b9434552d
6
+ metadata.gz: e612ff67ebd1148cffc40c064bdcb6e61d119c021b5b1261210699d1f1114bf5d42479822a54545f67947b6f0eee6293607a61947d5e245195cd7a60e1c5d56a
7
+ data.tar.gz: 2ff3fd08e0f4780a9f0891081357b1e3723ef341c8d038e2f3b3fa508b59349a21ea4bc30f7b71633cdabd73f8d7bd1032b189c67efd7c1316ae64b955d69e25
data/CHANGELOG.md CHANGED
@@ -1,7 +1,20 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.0.57] - 2022-05-31
4
+ ## [2.0.59] - 2022-06-xx
5
+
6
+ ### Added
7
+ - `Eco::API::Organization::TagTree#leafs` new method to spot tags with no children.
8
+
9
+ ### Changed
10
+ - `Eco::API::MicroCases#core_excluded`
11
+ - when person is `new?`, you should still be able to exclude `filter_tags`
12
+
13
+ ### Fixed
14
+ - `Eco::API::Policies::DefaultPolicies::UserAccess`
15
+ - `-exclude-account` should leave it untouched
16
+
17
+ ## [2.0.58] - 2022-05-31
5
18
 
6
19
  ### Added
7
20
  - **Usecase**`Eco::API::UseCases::DefaultCases::ClearAbilitiesTransCase`
@@ -12,7 +25,7 @@ All notable changes to this project will be documented in this file.
12
25
  - `Eco::API::Common::Loaders::Base#abort` method to log an error and raise an exception
13
26
  - **patched** `Ecoportal::API::Internal::Person`
14
27
  - Added a couple of handy helpers: `#replace_doc` and `#replace_original_doc`
15
-
28
+
16
29
  ### Changed
17
30
  - `Eco::API::Common::Session::SFTP#move` new parameter `override:` (default: `true`)
18
31
  - If there was an error, it would delete the destination remote file and retry to move the file
@@ -7,12 +7,11 @@ module Eco
7
7
  # @return [Array<String>] the core parameters that should not be included.
8
8
  def core_excluded(person, options)
9
9
  ["supervisor_id"].tap do |core_excluded|
10
- unless person.new?
11
- exclusions = ["name", "external_id", "email", "filter_tags"].select do |attr|
12
- options.dig(:exclude, attr.to_sym)
13
- end
14
- core_excluded.concat(exclusions)
10
+ can_exclude = person.new?? ["filter_tags"] : ["name", "external_id", "email", "filter_tags"]
11
+ exclusions = can_exclude.select do |attr|
12
+ options.dig(:exclude, attr.to_sym)
15
13
  end
14
+ core_excluded.concat(exclusions)
16
15
  end
17
16
  end
18
17
  end
@@ -124,6 +124,14 @@ module Eco
124
124
  subtags.include?(key&.upcase)
125
125
  end
126
126
 
127
+ # Returns all the tags with no children
128
+ # @return [Array<String>]
129
+ def leafs
130
+ tags.select do |tag|
131
+ node(tag).children_count == 0
132
+ end
133
+ end
134
+
127
135
  # Verifies if a tag exists in the tree.
128
136
  # @param key [String] tag to verify.
129
137
  # @return [Boolean]
@@ -16,6 +16,7 @@ class Eco::API::Policies::DefaultPolicies::UserAccess < Eco::API::Common::Loader
16
16
  people.each do |person|
17
17
  remove_account_when_no_email!(person) if person.email.to_s.empty?
18
18
  next unless account = person.account
19
+ next if options.dig(:exclude, :account)
19
20
  if account.policy_group_ids.empty? && def_pg
20
21
  account.policy_group_ids = [def_pg]
21
22
  end
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.58"
2
+ VERSION = "2.0.59"
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.58
4
+ version: 2.0.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura