zuora_connect 3.0.2.pre.j → 3.0.2.pre.k

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: 6076d2cb4ef722656e4d859dc07cf9c6d83686de560a7dad15b469a0bf9a1927
4
- data.tar.gz: 3b887a62765842aff5f68d6974b885555431331eb63f2b8355d7dfa312bbc307
3
+ metadata.gz: 6b4a4c2927c6b81722708d1a63d756c904baaa5a8476851bce38da0e45d6215f
4
+ data.tar.gz: ed4dfa6c6e9c70b6c22af27904b9688f814504ad17caf2ee6fe31ad6417b7135
5
5
  SHA512:
6
- metadata.gz: 51576691c2fc86fbfb2b2e790b6b21723aaac21daba261a66f91229a1ba2c31b4fa58be7a7180a1c86f3efaabcd214adee863ad29a8dc4134eaedf02eef04864
7
- data.tar.gz: d6ca9183643151b4a196e3feb4c38422862225b6e02446c75ea08a31fdcab2bfc18a8b6d7795ad63764c88a9834c4b7ed02b43856c6c683c8e3c9f487cfdab13
6
+ metadata.gz: 8ce54ad080c6a485e5b20bedb43989646a97460891819666409fbedb0192ad36e6efeddf5a8a2259d740222137cdd51ceacc72df77de326334cd451746ceaa75
7
+ data.tar.gz: 3c5adcb73a7b967dd4335af2ebbb0a91202313632fdc9beebe25e58da7278646aedf48eb6178ee3ce5385549d5269f9a4f95629441cd8e144eb5432062727894
@@ -8,13 +8,16 @@ module ZuoraConnect
8
8
  # zuora_user_id/zuora_entity_id both come from cookie or headers
9
9
  # zuora_current_identity comes from session
10
10
  # app_instance is only needed to try to migrate :/
11
- def self.update_id_response(zuora_user_id, zuora_entity_id, zuora_current_identity, app_instance)
11
+ def self.update_id_response(zuora_user_id, zuora_entity_id, zuora_current_identity, app_instance, permissions)
12
12
  zuora_user = find_or_create_by!(zuora_user_id: zuora_user_id) do |user|
13
13
  user.zuora_identity_response = { zuora_entity_id => zuora_current_identity }
14
+ user.app_permissions = permissions
14
15
  end
15
16
 
16
- if zuora_user.stale_identity?
17
- zuora_user.zuora_identity_response[zuora_entity_id] = zuora_current_identity
17
+ zuora_user.zuora_identity_response[zuora_entity_id] = zuora_current_identity
18
+ zuora_user.app_permissions = permissions
19
+
20
+ if zuora_user.changed?
18
21
  zuora_user.save!
19
22
  end
20
23
 
@@ -28,11 +31,5 @@ module ZuoraConnect
28
31
  app_instance.apartment_switch(nil, true)
29
32
  retry
30
33
  end
31
-
32
- # NOTE(hartley): this value was extracted from original usage in helper,
33
- # need to investigate when exactly the identity_response should be updated
34
- def stale_identity?
35
- updated_at < Time.now - 1.day
36
- end
37
34
  end
38
35
  end
@@ -64,6 +64,8 @@ module ZuoraConnect
64
64
  else
65
65
  check_instance
66
66
  end
67
+
68
+ @zuora_user = ZuoraConnect::ZuoraUser.find_by(zuora_user_id: ZuoraConnect::ZuoraUser.current_user_id)
67
69
  end
68
70
  end
69
71
 
@@ -419,7 +421,8 @@ module ZuoraConnect
419
421
  if defined?(@appinstance) && !@appinstance['zuora_logins'].nil?
420
422
  @zuora_user = ZuoraConnect::ZuoraUser.update_id_response(
421
423
  zuora_user_id, zuora_entity_id, session["ZuoraCurrentIdentity"],
422
- @appinstance
424
+ @appinstance,
425
+ session['ZuoraCurrentUserInfo']['permissions']
423
426
  )
424
427
  @zuora_user.session = session
425
428
  ZuoraConnect::ZuoraUser.current_user_id = zuora_user_id
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.0.2-j"
4
+ VERSION = "3.0.2-k"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2.pre.j
4
+ version: 3.0.2.pre.k
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-04 00:00:00.000000000 Z
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment