eco-helpers 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eco/api/common/people/entries.rb +1 -0
- data/lib/eco/api/common/version_patches/ecoportal_api.rb +1 -0
- data/lib/eco/api/common/version_patches/ecoportal_api/account_preferences.rb +51 -0
- data/lib/eco/api/organization/presets_values.json +1 -1
- data/lib/eco/api/organization/tag_tree.rb +9 -9
- data/lib/eco/api/usecases/default_cases.rb +2 -0
- data/lib/eco/api/usecases/default_cases/refresh_case.rb +23 -0
- data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +2 -0
- data/lib/eco/cli/config/default/usecases.rb +1 -0
- data/lib/eco/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9831e1570b2ad8b1dd11128af4bf1c141dd76ead7e7d7c9fa315c089e25a866
|
4
|
+
data.tar.gz: 0e328fe606aa425c68ef609c7385fe9d62500ac020769bd78a8840f5dce915fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76fdbb40780576960262ee427d3ec563e72da484e398f0593811d5fd773f8ec31e07ae2183d58f6a6a26fa3fb135ccb4d5515113868b49fcb182ba06a35c3a40
|
7
|
+
data.tar.gz: 7853f924a6b514f476c7470c6748a9bf47137ecd68b2b1541cb52d600eb6692091705e7be23cdfdb9bedb339c6c0d1812d5000bb3771804bae65d566c3eb027e
|
@@ -29,6 +29,7 @@ module Eco
|
|
29
29
|
|
30
30
|
def entry(id: nil, external_id: nil, email: nil)
|
31
31
|
init_caches
|
32
|
+
pers = nil
|
32
33
|
pers = @by_id[id]&.first if id
|
33
34
|
pers = @by_external_id[external_id&.strip]&.first if !pers && !external_id.to_s.strip.empty?
|
34
35
|
pers = @by_email[email&.downcase.strip]&.first if !pers && !email.to_s.strip.empty?
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class Internal
|
4
|
+
class Preferences
|
5
|
+
[
|
6
|
+
:show_sidebar,
|
7
|
+
:show_shortcuts,
|
8
|
+
:show_coming_soon,
|
9
|
+
:show_recently_visited_forms,
|
10
|
+
:show_tasks,
|
11
|
+
].each do |field|
|
12
|
+
key = field.to_s
|
13
|
+
define_method(field) do
|
14
|
+
if doc.key?(key)
|
15
|
+
doc[key]
|
16
|
+
else
|
17
|
+
true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
define_method("#{field}=") do |value|
|
21
|
+
doc[key] = !!value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
[
|
26
|
+
:kiosk_enabled,
|
27
|
+
:kiosk_workflow_message,
|
28
|
+
:kiosk_create_button_label,
|
29
|
+
:kiosk_create_button_help,
|
30
|
+
:kiosk_return_button_label,
|
31
|
+
:kiosk_return_button_help,
|
32
|
+
:kiosk_dashboard_button_label,
|
33
|
+
:kiosk_dashboard_button_help
|
34
|
+
].each do |field|
|
35
|
+
key = field.to_s
|
36
|
+
define_method(field) do
|
37
|
+
if doc.key?(key)
|
38
|
+
doc[key]
|
39
|
+
else
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
define_method("#{field}=") do |value|
|
44
|
+
doc[key] = !!value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"data": [null, "view", "update", "administrate", "implement"],
|
4
4
|
"reports": [null, "view", "edit", "administrate"],
|
5
5
|
"organization": [null, "view", "administrate", "implement"],
|
6
|
-
"people": [null, "attach", "view", "view_private", "edit"],
|
6
|
+
"people": [null, "attach", "view", "view_private", "edit", "dashboard"],
|
7
7
|
"pages": [null, "view", "update", "create", "administrate"],
|
8
8
|
"page_editor": [null, "basic", "intermediate", "advanced", "implement"],
|
9
9
|
"registers": [null, "view", "dashboard", "administrate", "implement"]
|
@@ -36,7 +36,7 @@ module Eco
|
|
36
36
|
@path.push(@tag) unless !@tag
|
37
37
|
|
38
38
|
nodes = @source.is_a?(Array) ? @source : @source.dig('nodes') || []
|
39
|
-
@nodes = nodes.map {|
|
39
|
+
@nodes = nodes.map {|cnode| TagTree.new(cnode, depth: @depth + 1, path: @path.dup, enviro: @enviro)}
|
40
40
|
|
41
41
|
init_hashes
|
42
42
|
end
|
@@ -68,7 +68,7 @@ module Eco
|
|
68
68
|
# Finds a subtree node.
|
69
69
|
# @param key [String] parent node of subtree.
|
70
70
|
# @return [TagTree, nil] if the tag `key` is a node, returns that node.
|
71
|
-
def
|
71
|
+
def node(key)
|
72
72
|
return nil unless tag?(key)
|
73
73
|
@hash_tags[key.upcase]
|
74
74
|
end
|
@@ -137,19 +137,19 @@ module Eco
|
|
137
137
|
values = filter_tags(values)
|
138
138
|
nodes = []; depth = -1
|
139
139
|
values.each do |tag|
|
140
|
-
raise("Couldn't find the node of #{tag} in the tag-tree definition") unless
|
140
|
+
raise("Couldn't find the node of #{tag} in the tag-tree definition") unless cnode = node(tag)
|
141
141
|
|
142
|
-
if
|
143
|
-
nodes = [
|
144
|
-
depth =
|
145
|
-
elsif
|
146
|
-
nodes.push(
|
142
|
+
if cnode.depth > depth
|
143
|
+
nodes = [cnode]
|
144
|
+
depth = cnode.depth
|
145
|
+
elsif cnode.depth == depth
|
146
|
+
nodes.push(cnode)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
150
|
default_tag = nil
|
151
151
|
if nodes.length > 1
|
152
|
-
common = nodes.reduce(self.tags.reverse) {|com,
|
152
|
+
common = nodes.reduce(self.tags.reverse) {|com, cnode| com & cnode.path.reverse}
|
153
153
|
default_tag = common.first if common.length > 0 && depth > 0
|
154
154
|
end
|
155
155
|
default_tag = nodes.first&.tag if !default_tag && depth > 0
|
@@ -27,6 +27,7 @@ module Eco
|
|
27
27
|
RemoveAccountCase.new(self).process
|
28
28
|
RecoverDBCase.new(self).process
|
29
29
|
RefreshPresets.new(self).process
|
30
|
+
Refresh.new(self).process
|
30
31
|
ChangeEMailCase.new(self).process
|
31
32
|
SetDefaultTagCase.new(self).process
|
32
33
|
CreateCase.new(self).process
|
@@ -53,6 +54,7 @@ require_relative 'default_cases/create_details_with_supervisor_case'
|
|
53
54
|
require_relative 'default_cases/reinvite_case'
|
54
55
|
require_relative 'default_cases/delete_case'
|
55
56
|
require_relative 'default_cases/remove_account_case'
|
57
|
+
require_relative 'default_cases/refresh_case'
|
56
58
|
require_relative 'default_cases/refresh_presets_case'
|
57
59
|
require_relative 'default_cases/recover_db_case'
|
58
60
|
require_relative 'default_cases/change_email_case'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Eco
|
2
|
+
module API
|
3
|
+
class UseCases
|
4
|
+
class DefaultCases
|
5
|
+
class Refresh < DefaultCase
|
6
|
+
|
7
|
+
def process
|
8
|
+
@cases.define("refresh", type: :transform) do |people, session, options, usecase|
|
9
|
+
job = session.job_group("main").new("update", usecase: usecase, type: :update, sets: :account)
|
10
|
+
|
11
|
+
people.each_with_index do |person, i|
|
12
|
+
job.add(person)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -26,6 +26,7 @@ module Eco
|
|
26
26
|
header = session.new_entry(people.first, dependencies: deps).to_hash.keys
|
27
27
|
header += abilities
|
28
28
|
header += ["Login Methods"] if login_providers.any_optional?
|
29
|
+
header += ["Subordinates"]
|
29
30
|
|
30
31
|
csv << header
|
31
32
|
people.each do |person|
|
@@ -36,6 +37,7 @@ module Eco
|
|
36
37
|
logins = (person.account && person.account.login_provider_ids) || []
|
37
38
|
data.push(login_providers.to_name(logins).join("|"))
|
38
39
|
end
|
40
|
+
data.push(person.subordinates)
|
39
41
|
csv << data
|
40
42
|
end
|
41
43
|
end
|
@@ -53,6 +53,7 @@ ASSETS.cli.config do |cnf|
|
|
53
53
|
|
54
54
|
cases.add("-create-from", :sync, case_name: "create")
|
55
55
|
cases.add("-update-from", :sync, case_name: "update")
|
56
|
+
cases.add("-refresh", :transform, case_name: "refresh")
|
56
57
|
cases.add("-refresh-presets", :transform, case_name: "refresh-presets")
|
57
58
|
cases.add("-remove-account", :transform, case_name: "remove-account")
|
58
59
|
cases.add("-remove-account-from", :sync, case_name: "remove-account")
|
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: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- lib/eco/api/common/session/s3_uploader.rb
|
263
263
|
- lib/eco/api/common/version_patches.rb
|
264
264
|
- lib/eco/api/common/version_patches/ecoportal_api.rb
|
265
|
+
- lib/eco/api/common/version_patches/ecoportal_api/account_preferences.rb
|
265
266
|
- lib/eco/api/common/version_patches/ecoportal_api/base_model.rb
|
266
267
|
- lib/eco/api/common/version_patches/ecoportal_api/external_person.rb
|
267
268
|
- lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb
|
@@ -317,6 +318,7 @@ files:
|
|
317
318
|
- lib/eco/api/usecases/default_cases/new_email_case.rb
|
318
319
|
- lib/eco/api/usecases/default_cases/new_id_case.rb
|
319
320
|
- lib/eco/api/usecases/default_cases/recover_db_case.rb
|
321
|
+
- lib/eco/api/usecases/default_cases/refresh_case.rb
|
320
322
|
- lib/eco/api/usecases/default_cases/refresh_presets_case.rb
|
321
323
|
- lib/eco/api/usecases/default_cases/reinvite_case.rb
|
322
324
|
- lib/eco/api/usecases/default_cases/remove_account_case.rb
|