eco-helpers 0.9.3 → 0.9.4

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: c71b81aaf2b40c4f9388fc87176a3ca7b5cd4c274a760546aaae8e98b00abea5
4
- data.tar.gz: cfefc68eed3bfbfd1767ca222bf3c7dfca2d7ce77d94fa6cf5b0b406754ae0aa
3
+ metadata.gz: c80ae3aadfdbce22868e7a60c6c6a979bfcad0169fffccb47a6a412bbd7c5788
4
+ data.tar.gz: ec19d4b61fe40b33e4fc1b7ac1deba98110c901e573c4c3c421c6f28409e0b46
5
5
  SHA512:
6
- metadata.gz: 14234f90a41da5093e8f1af208edc9aea7f454c8f15b8a19dcbbfce63559d3e82b47de850160d3f843d30ab0fac0fc9c44bd3f60a56e056c7b8922f64624da29
7
- data.tar.gz: 6c8d9cf5e0311591601be6e1f211c23667b5ea7902e8704edaa53eeb1d3e1123780b0bc7fee44b85d39792e2bbe7cf23c43b5a8dc815db69fc16e5e3daa9fe88
6
+ metadata.gz: 2732b578b4f14b62442d525ca028d11fbba6c888614a85975b3a01f4fc988e7c967b187fe7289e1a3506e56c6067d28ad40a97ecf8c5d52641d2232e504a88db
7
+ data.tar.gz: 55a0ef82cfa791f4fb7c88588a9dc90b082cc162aeb208bb22c835e2d2d4c1171ce576378e7c13bdb4e9d64632f97dd00ba1346667b3ae91198f40da6f35c7c8
@@ -11,6 +11,22 @@ module Ecoportal
11
11
  original_doc["account"] = JSON.parse(doc["account"])
12
12
  end
13
13
 
14
+ def account=(value)
15
+ case value
16
+ when NilClass
17
+ doc["account"] = nil
18
+ when Internal::Account
19
+ doc["account"] = JSON.parse(value.to_json)
20
+ when Hash
21
+ doc["account"] = value.slice(*%w[policy_group_ids landing_page_id permissions_preset permissions_custom preferences prefilter filter_tags login_provider_ids starred_ids])
22
+ else
23
+ # TODO
24
+ raise "Invalid set on account: Need nil, Account or Hash; got #{value.class}"
25
+ end
26
+ remove_instance_variable("@account") if defined?(@account)
27
+ return account
28
+ end
29
+
14
30
  end
15
31
  end
16
32
  end
@@ -18,8 +18,12 @@ module Eco
18
18
  if !person
19
19
  session.logger.error("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}")
20
20
  else
21
- unless entry.email.downcase == person.email
22
- account = person.account
21
+ unless entry.email.to_s.strip.downcase == person.email
22
+
23
+ super_id = person.supervisor_id
24
+ s_account_doc = person.account&.doc
25
+ account_doc = s_account_doc ? JSON.parse(s_account_doc.to_json) : nil
26
+
23
27
  person.account = nil
24
28
  remove.add(person)
25
29
 
@@ -29,7 +33,10 @@ module Eco
29
33
  end
30
34
 
31
35
  add_account.add(person) do |person|
32
- person.account = account
36
+ if account_doc
37
+ person.account = account_doc
38
+ end
39
+ person.supervisor_id = super_id
33
40
  end
34
41
  end
35
42
 
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
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: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura