zuora_connect 2.0.58a → 2.0.60b
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f6d2a40d21ec315aaaac1859582bc689d24d6ef0ee3e42fabc640d171cb6944
|
4
|
+
data.tar.gz: 8793132888e45c9fa532ebb92c11205da312ac88df1e43dbd89f38faab9d8e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbd7542971dfedb9b2470094cde902c8b147c9f406cd864bb60e7beafa306b5f29b2c70aab457ea12b22b5dffd726a21a870c5bb238acaeeda64641b5cfd6ad9
|
7
|
+
data.tar.gz: a5adffbf1799fef7bf31db82eeba2fb648ea9c1ba3c34149c6c7f4b06ca7a02a6dd6c05a5e934e9aebbc974905737848ed40c8296e172226941d0fa1e7dc172c
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
class StaticController < ApplicationController
|
3
|
-
before_action :authenticate_connect_app_request, :except => [:metrics, :health, :initialize_app, :provision]
|
4
|
-
before_action :clear_connect_app_session, :only => [:metrics, :health, :initialize_app, :provision]
|
5
|
-
after_action :persist_connect_app_session, :except => [:metrics, :health, :initialize_app, :provision]
|
3
|
+
before_action :authenticate_connect_app_request, :except => [:metrics, :health, :initialize_app, :provision, :instance_user]
|
4
|
+
before_action :clear_connect_app_session, :only => [:metrics, :health, :initialize_app, :provision, :instance_user]
|
5
|
+
after_action :persist_connect_app_session, :except => [:metrics, :health, :initialize_app, :provision, :instance_user]
|
6
6
|
|
7
7
|
skip_before_action :verify_authenticity_token, :only => [:initialize_app, :provision]
|
8
|
-
http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision]
|
8
|
+
http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision, :instance_user]
|
9
9
|
|
10
10
|
def metrics
|
11
11
|
type = params[:type].present? ? params[:type] : "versions"
|
@@ -14,11 +14,11 @@ module ZuoraConnect
|
|
14
14
|
|
15
15
|
def health
|
16
16
|
if params[:error].present?
|
17
|
-
begin
|
17
|
+
begin
|
18
18
|
raise ZuoraConnect::Exceptions::Error.new('This is an error')
|
19
19
|
rescue => ex
|
20
20
|
case params[:error]
|
21
|
-
when 'Log'
|
21
|
+
when 'Log'
|
22
22
|
Rails.logger.error("Error in Health", ex)
|
23
23
|
when 'Exception'
|
24
24
|
raise
|
@@ -77,6 +77,52 @@ module ZuoraConnect
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
def instance_user
|
81
|
+
ZuoraConnect::AppInstance.read_master_db do
|
82
|
+
ZuoraConnect.logger.with_fields = {} if ZuoraConnect.logger.is_a?(Ougai::Logger)
|
83
|
+
Rails.logger.with_fields = {} if Rails.logger.is_a?(Ougai::Logger)
|
84
|
+
|
85
|
+
if defined?(ElasticAPM) && ElasticAPM.running? && ElasticAPM.respond_to?(:set_label)
|
86
|
+
ElasticAPM.set_label(:trace_id, request.uuid)
|
87
|
+
end
|
88
|
+
|
89
|
+
unless params[:id].present?
|
90
|
+
render json: {
|
91
|
+
status: 400,
|
92
|
+
message: 'No app instance id provided'
|
93
|
+
}, status: :bad_request
|
94
|
+
return
|
95
|
+
end
|
96
|
+
|
97
|
+
@appinstance = ZuoraConnect::AppInstance.find(params[:id]).new_session
|
98
|
+
end
|
99
|
+
|
100
|
+
zuora_client = @appinstance.send(ZuoraConnect::AppInstance::LOGIN_TENANT_DESTINATION).client
|
101
|
+
client_describe, = zuora_client.rest_call(
|
102
|
+
url: zuora_client.rest_endpoint('genesis/user/info').gsub('v1/', ''),
|
103
|
+
session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic
|
104
|
+
)
|
105
|
+
|
106
|
+
render json: {
|
107
|
+
status: 200,
|
108
|
+
message: 'Success',
|
109
|
+
user_id: client_describe['coreUserId'],
|
110
|
+
username: client_describe['username'],
|
111
|
+
email: client_describe['workEmail']
|
112
|
+
}, status: 200
|
113
|
+
rescue ActiveRecord::RecordNotFound
|
114
|
+
render json: {
|
115
|
+
status: 400,
|
116
|
+
message: 'No app instance found'
|
117
|
+
}, status: :bad_request
|
118
|
+
rescue StandardError => e
|
119
|
+
Rails.logger.error('Error occurred getting user details', e)
|
120
|
+
render json: {
|
121
|
+
status: 500,
|
122
|
+
message: 'Failed to get user details'
|
123
|
+
}, status: 500
|
124
|
+
end
|
125
|
+
|
80
126
|
private
|
81
127
|
|
82
128
|
def clear_connect_app_session
|
data/config/routes.rb
CHANGED
@@ -47,7 +47,7 @@ module Resque
|
|
47
47
|
raise
|
48
48
|
end
|
49
49
|
rescue PG::ConnectionBad => exception
|
50
|
-
Rails.logger.
|
50
|
+
Rails.logger.warn("Bad Connection Restart", exception)
|
51
51
|
Resque.enqueue_to(self.job.queue, self.job.payload['class'], args)
|
52
52
|
return
|
53
53
|
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => exception
|
@@ -346,7 +346,7 @@ module ZuoraConnect
|
|
346
346
|
##
|
347
347
|
# If the ZSession was refreshed, but it's still the same user and they aren't launching from the side bar,
|
348
348
|
# we don't need to continue
|
349
|
-
is_different_user = identity.slice("entityId", "tenantId", "userId", "userProfileId")
|
349
|
+
is_different_user = identity.slice("entityId", "tenantId", "userId", "userProfileId") != (session["ZuoraCurrentIdentity"] || {}).slice("entityId", "tenantId", "userId", "userProfileId")
|
350
350
|
zuora_details["identity"]["entityId"] = identity['entityId']
|
351
351
|
session["ZuoraCurrentIdentity"] = identity
|
352
352
|
session["ZuoraCurrentEntity"] = identity['entityId']
|
@@ -408,7 +408,7 @@ module ZuoraConnect
|
|
408
408
|
end
|
409
409
|
|
410
410
|
# One deployed instance with credentials
|
411
|
-
if defined?(@appinstance) &&
|
411
|
+
if defined?(@appinstance) && !@appinstance['zuora_logins'].nil?
|
412
412
|
#Add user/update
|
413
413
|
begin
|
414
414
|
@zuora_user = ZuoraConnect::ZuoraUser.where(:zuora_user_id => zuora_user_id).first
|
@@ -632,12 +632,19 @@ module ZuoraConnect
|
|
632
632
|
:id => id,
|
633
633
|
:api_token => generate_token,
|
634
634
|
:token => generate_token,
|
635
|
-
:zuora_logins => task_data,
|
636
635
|
:oauth_expires_at => Time.now + 1000.years,
|
637
636
|
:zuora_domain => rest_domain,
|
638
637
|
:zuora_entity_ids => [zuora_entity_id]
|
639
638
|
)
|
640
639
|
|
640
|
+
if task_data.nil?
|
641
|
+
# no encryption
|
642
|
+
app_instance['zuora_logins'] = task_data
|
643
|
+
else
|
644
|
+
# kms encrypt
|
645
|
+
app_instance.zuora_logins = task_data
|
646
|
+
end
|
647
|
+
|
641
648
|
begin
|
642
649
|
app_instance.save(:validate => false)
|
643
650
|
rescue ActiveRecord::RecordNotUnique
|
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: 2.0.
|
4
|
+
version: 2.0.60b
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|