zuora_connect 3.0.2.pre.h → 3.0.2.pre.l
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39316ba478576ec6b9a8686b172a335ee14e91780af31761330599f1010df069
|
4
|
+
data.tar.gz: 8612977375f206da41b17f9f5ca732791cc0e84076613af28a17f1f1ada9a02f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c53a4986aa08336e6ce4be91b7dd329bf84c6b4eda1aa6b3e2f8c8573cb4a5fc5c205f1d0f3b1d4a3abf2dfe09dad8c02e4ed2a93c5f6b653ac80b81a3e48f86
|
7
|
+
data.tar.gz: 70094dc8bae6ceaa40a7d1a8e49476d3e80127d9416a224c55e242983d0539d7b76384cf45ad2cf5bf2df631aab40c1a8f20ef3fd377811b3f0bad5edfaa54aa
|
@@ -12,6 +12,9 @@ module ZuoraConnect
|
|
12
12
|
before_update :set_updated_by_id
|
13
13
|
before_destroy :set_updated_by_id
|
14
14
|
|
15
|
+
belongs_to :updated_by, class_name: 'ZuoraConnect::ZuoraUser', foreign_key: 'updated_by_id', primary_key: "zuora_user_id", optional: true
|
16
|
+
belongs_to :created_by, class_name: 'ZuoraConnect::ZuoraUser', foreign_key: 'created_by_id', primary_key: "zuora_user_id", optional: true
|
17
|
+
|
15
18
|
private
|
16
19
|
|
17
20
|
def set_created_by_id
|
@@ -128,7 +128,7 @@ module ZuoraConnect
|
|
128
128
|
raise
|
129
129
|
end
|
130
130
|
end
|
131
|
-
if migrate
|
131
|
+
if migrate
|
132
132
|
Apartment::Migrator.migrate(self.id)
|
133
133
|
end
|
134
134
|
end
|
@@ -267,6 +267,7 @@ module ZuoraConnect
|
|
267
267
|
params = {
|
268
268
|
name: self.task_data.dig('name'),
|
269
269
|
zuora_entity_ids: (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).select {|entity| !entity['skip'].to_bool}.map{|e| e['id']}.uniq,
|
270
|
+
zuora_global_tenant_id: task_data.dig(LOGIN_TENANT_DESTINATION, 'entities', 0, 'globalEntityId').to_i, # tenant id of the global/parent entity, 0 if nil
|
270
271
|
zuora_tenant_ids: tenants.map(&:to_s).uniq,
|
271
272
|
organizations: organizations
|
272
273
|
}
|
@@ -277,6 +278,9 @@ module ZuoraConnect
|
|
277
278
|
params.merge!({zuora_domain: client.rest_domain, environment: client.environment })
|
278
279
|
end
|
279
280
|
end
|
281
|
+
|
282
|
+
# makes it safe to add elements to params which don't correspond to existing columns in an app's schema
|
283
|
+
# rejects those elements which do not correspond to model attributes for your app
|
280
284
|
params = params.reject{|k,v| !self.attributes.keys.member?(k.to_s) || self[k] == v}
|
281
285
|
self.update_columns(params) if params.present?
|
282
286
|
end
|
@@ -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
|
-
|
17
|
-
|
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
|
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.
|
4
|
+
version: 3.0.2.pre.l
|
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-
|
11
|
+
date: 2021-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|