zuora_connect 2.0.60a → 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 +4 -4
- data/app/controllers/zuora_connect/static_controller.rb +52 -6
- data/config/routes.rb +1 -0
- data/lib/zuora_connect/version.rb +1 -1
- metadata +2 -2
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
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-07-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|