zuora_connect 2.0.57e → 2.0.57f
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: abdb831ee4c52ca77b9d88bc6af7592d4c5675d969972f5df8cad88768da95c3
|
4
|
+
data.tar.gz: 2047383429c6d9aac57602e427e87c75be3bf281998287971b0f4e70c759c266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2fee7867ef23c4057389bc4c9ba97304e4ea29310f8408df18790333fde7eb6709a8e0f02f9610b5ffb9c4354134917f4b2e6fef5e3dc56c8baf6e3dd29e11b
|
7
|
+
data.tar.gz: e69ed51eee1b04b4fd51d51c005b3aabf833fbcb71c8680694bc66406f00ae392e279e4f85c55bf2dd41f33a53c9eeca53e0ffa709c9cb76ebab489efe4e3842
|
@@ -3,12 +3,7 @@
|
|
3
3
|
<title>Select Task ID</title>
|
4
4
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
5
5
|
<style>
|
6
|
-
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
margin: 0;
|
9
|
-
}
|
10
|
-
|
11
|
-
div.connect-dialog {
|
6
|
+
.connect-dialog {
|
12
7
|
width: 95%;
|
13
8
|
max-width: 33em;
|
14
9
|
margin: 4em auto 0;
|
@@ -16,7 +11,11 @@
|
|
16
11
|
text-align: center;
|
17
12
|
}
|
18
13
|
|
19
|
-
|
14
|
+
.connect-dialog div {
|
15
|
+
background-color: white;
|
16
|
+
color: #2E2F30;
|
17
|
+
text-align: center;
|
18
|
+
font-family: arial, sans-serif;
|
20
19
|
margin: 0 0 1em;
|
21
20
|
border: 1px solid #CCC;
|
22
21
|
border-right-color: #999;
|
@@ -27,19 +26,17 @@
|
|
27
26
|
border-top-right-radius: 9px;
|
28
27
|
border-bottom-left-radius: 9px;
|
29
28
|
border-bottom-right-radius: 9px;
|
30
|
-
background-color: white;
|
31
29
|
padding: 7px 12% 0;
|
32
30
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
33
31
|
}
|
34
32
|
|
35
|
-
|
33
|
+
.connect-dialog h1 {
|
36
34
|
font-size: 100%;
|
37
35
|
color: #3D4B5A;
|
38
36
|
line-height: 1.5em;
|
39
37
|
}
|
40
38
|
|
41
|
-
|
42
|
-
div.connect-dialog > div.launch_button {
|
39
|
+
.connect-dialog .launch_button {
|
43
40
|
margin: 1em 0 1em;
|
44
41
|
margin-right: auto;
|
45
42
|
margin-left: auto;
|
@@ -149,24 +149,24 @@ module ZuoraConnect
|
|
149
149
|
ZuoraConnect::AppInstance.destroy(id)
|
150
150
|
Apartment::Tenant.drop(id)
|
151
151
|
render "zuora_connect/static/error_handled", :locals => {
|
152
|
-
:title => "Application Setup Error",
|
152
|
+
:title => "Application Setup Error",
|
153
153
|
:message => "Application cannot be run using Zuora Session. Delete old application \
|
154
154
|
deployment and create new with Zuora Basic or OAuth credentials."
|
155
155
|
}, :layout => false
|
156
|
-
return
|
156
|
+
return
|
157
157
|
rescue ZuoraConnect::Exceptions::AccessDenied => ex
|
158
158
|
respond_to do |format|
|
159
|
-
format.html {
|
159
|
+
format.html {
|
160
160
|
render "zuora_connect/static/error_handled", :locals => {
|
161
|
-
:title => "Application State Error",
|
161
|
+
:title => "Application State Error",
|
162
162
|
:message => ex.message
|
163
|
-
}, status: 401, layout: false
|
163
|
+
}, status: 401, layout: false
|
164
164
|
}
|
165
|
-
format.js {
|
165
|
+
format.js {
|
166
166
|
render "zuora_connect/static/error_handled", :locals => {
|
167
|
-
:title => "Application State Error",
|
167
|
+
:title => "Application State Error",
|
168
168
|
:message => ex.message
|
169
|
-
}, status: 401, layout: false
|
169
|
+
}, status: 401, layout: false
|
170
170
|
}
|
171
171
|
format.json { render json: {'errors' => ex.message}, status: 401 }
|
172
172
|
format.all { render json: ex.message, status: 401 }
|
@@ -196,17 +196,17 @@ module ZuoraConnect
|
|
196
196
|
raise ZuoraConnect::Exceptions::AccessDenied.new("User is not an authorized admin for this application") if raise_error
|
197
197
|
|
198
198
|
respond_to do |format|
|
199
|
-
format.html {
|
199
|
+
format.html {
|
200
200
|
render "zuora_connect/static/error_handled", :locals => {
|
201
|
-
:title => "Unauthorized",
|
201
|
+
:title => "Unauthorized",
|
202
202
|
:message => "User is not an authorized admin for this application"
|
203
203
|
}, status: 401, :layout => false
|
204
204
|
}
|
205
|
-
format.js {
|
205
|
+
format.js {
|
206
206
|
render "zuora_connect/static/error_handled", :locals => {
|
207
|
-
:title => "Unauthorized",
|
207
|
+
:title => "Unauthorized",
|
208
208
|
:message => "User is not an authorized admin for this application"
|
209
|
-
}, status: 401, :layout => false
|
209
|
+
}, status: 401, :layout => false
|
210
210
|
}
|
211
211
|
format.json { render json: {'errors' => ex.message}, status: 401 }
|
212
212
|
format.all { render json: ex.message, status: 401 }
|
@@ -246,7 +246,7 @@ module ZuoraConnect
|
|
246
246
|
auth_headers.merge!({'Authorization' => "ZSession-a3N2w #{zuora_client.get_session(prefix: false, auth_type: :basic)}"})
|
247
247
|
else
|
248
248
|
render "zuora_connect/static/error_handled", :locals => {
|
249
|
-
:title => "Missing Authorization Token",
|
249
|
+
:title => "Missing Authorization Token",
|
250
250
|
:message => "Zuora 'Zuora-Auth-Token' header and 'ZSession' cookie not present."
|
251
251
|
}, :layout => false
|
252
252
|
return
|
@@ -268,27 +268,34 @@ module ZuoraConnect
|
|
268
268
|
if zuora_tenant_id.to_s == "10548"
|
269
269
|
session.clear
|
270
270
|
render "zuora_connect/static/error_handled", :locals => {
|
271
|
-
:title => "Security Testing",
|
271
|
+
:title => "Security Testing",
|
272
272
|
:message => "Ya we know it you"
|
273
273
|
}, :layout => false
|
274
274
|
return
|
275
275
|
else
|
276
|
-
raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.")
|
276
|
+
raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.")
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
+
##
|
281
|
+
# If the ZSession was refreshed, but it's still the same user and they aren't launching from the side bar,
|
282
|
+
# we don't need to continue
|
283
|
+
is_same_user = identity.slice("entityId", "tenantId", "userId", "userProfileId") == session.slice("entityId", "tenantId", "userId", "userProfileId")
|
284
|
+
zuora_details["identity"]["entityId"] = identity['entityId']
|
280
285
|
session["ZuoraCurrentIdentity"] = identity
|
281
286
|
session["ZuoraCurrentEntity"] = identity['entityId']
|
282
287
|
session["ZSession"] = cookies['ZSession']
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
288
|
+
unless is_same_user && !params[:sidebar_launch].to_s.to_bool
|
289
|
+
zuora_instance_id = nil
|
290
|
+
ZuoraConnect.logger.debug("UI Authorization", zuora: zuora_details)
|
291
|
+
|
292
|
+
client_describe, response = zuora_client.rest_call(
|
293
|
+
url: zuora_client.rest_endpoint("genesis/user/info").gsub('v1/', ''),
|
294
|
+
session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic,
|
295
|
+
headers: auth_headers
|
296
|
+
)
|
297
|
+
session["ZuoraCurrentUserInfo"] = client_describe
|
298
|
+
end
|
292
299
|
end
|
293
300
|
|
294
301
|
#Find matching app instances.
|
@@ -296,7 +303,7 @@ module ZuoraConnect
|
|
296
303
|
appinstances = ZuoraConnect::AppInstance.where("zuora_entity_ids ?& array[:entities] = true AND zuora_domain = :host AND id = :id", entities: [zuora_entity_id], host: zuora_client.rest_domain, id: zuora_instance_id.to_i).pluck(:id, :name)
|
297
304
|
else
|
298
305
|
#if app_instance_ids is present then permissions still controlled by connect
|
299
|
-
if params[:app_instance_ids].present?
|
306
|
+
if params[:app_instance_ids].present?
|
300
307
|
navbar, response = zuora_client.rest_call(url: zuora_client.rest_endpoint("navigation"))
|
301
308
|
urls = navbar['menus'].map {|x| x['url']}
|
302
309
|
app_env = ENV["DEIS_APP"] || "xyz123"
|
@@ -304,7 +311,7 @@ module ZuoraConnect
|
|
304
311
|
if url.blank?
|
305
312
|
if navbar['menus'].map {|x| x['label']}.include?('Link Connect Account')
|
306
313
|
render "zuora_connect/static/error_handled", :locals => {
|
307
|
-
:title => "Link Account",
|
314
|
+
:title => "Link Account",
|
308
315
|
:message => "Link Connect account to gain access to application."
|
309
316
|
}, :layout => false
|
310
317
|
return
|
@@ -330,7 +337,7 @@ module ZuoraConnect
|
|
330
337
|
ZuoraConnect.logger.debug("Instance is #{appinstances.to_h.keys.first}")
|
331
338
|
@appinstance = ZuoraConnect::AppInstance.find(appinstances.to_h.keys.first)
|
332
339
|
|
333
|
-
#Add user/update
|
340
|
+
#Add user/update
|
334
341
|
begin
|
335
342
|
@zuora_user = ZuoraConnect::ZuoraUser.where(:zuora_user_id => zuora_user_id).first
|
336
343
|
rescue ActiveRecord::StatementInvalid => ex
|
@@ -350,7 +357,7 @@ module ZuoraConnect
|
|
350
357
|
else
|
351
358
|
ZuoraConnect.logger.debug("New zuora user object for #{zuora_user_id}")
|
352
359
|
@zuora_user = ZuoraConnect::ZuoraUser.create!(:zuora_user_id => zuora_user_id, :zuora_identity_response => {zuora_entity_id => session["ZuoraCurrentIdentity"]})
|
353
|
-
end
|
360
|
+
end
|
354
361
|
@zuora_user.session = session
|
355
362
|
session["#{@appinstance.id}::user::localUserId"] = @zuora_user.id
|
356
363
|
session["#{@appinstance.id}::user::email"] = session['ZuoraCurrentIdentity']["username"]
|
@@ -359,19 +366,19 @@ module ZuoraConnect
|
|
359
366
|
session["appInstance"] = @appinstance.id
|
360
367
|
|
361
368
|
#We have multiple, user must pick
|
362
|
-
elsif appinstances.size > 1
|
369
|
+
elsif appinstances.size > 1
|
363
370
|
ZuoraConnect.logger.debug("User must select instance. #{@names}")
|
364
371
|
render "zuora_connect/static/launch", :locals => {:names => appinstances.to_h}, :layout => false
|
365
372
|
return
|
366
373
|
|
367
374
|
#We have no deployed instance for this tenant
|
368
|
-
else
|
369
|
-
#Ensure user can access oauth creation API
|
375
|
+
else
|
376
|
+
#Ensure user can access oauth creation API
|
370
377
|
if !session["ZuoraCurrentUserInfo"]['permissions'].include?("permission.userManagement")
|
371
378
|
Thread.current[:appinstance] = nil
|
372
379
|
session["appInstance"] = nil
|
373
380
|
render "zuora_connect/static/error_handled", :locals => {
|
374
|
-
:title => "Application can only complete its initial setup via platform administrator",
|
381
|
+
:title => "Application can only complete its initial setup via platform administrator",
|
375
382
|
:message => "Please contact admin who has user managment permissions in tenant and have them click and finish setup."
|
376
383
|
}, :layout => false
|
377
384
|
return
|
@@ -389,20 +396,20 @@ module ZuoraConnect
|
|
389
396
|
next_id = (ZuoraConnect::AppInstance.all.where('id > 24999999').order(id: :desc).limit(1).pluck(:id).first || 24999999) + 1
|
390
397
|
user = (ENV['DEIS_APP'] || "Application").split('-').map(&:capitalize).join(' ')
|
391
398
|
body = {
|
392
|
-
'userId' => zuora_user_id,
|
393
|
-
'entityIds' => [zuora_entity_id.unpack("a8a4a4a4a12").join('-')],
|
394
|
-
'customAuthorities' => [],
|
399
|
+
'userId' => zuora_user_id,
|
400
|
+
'entityIds' => [zuora_entity_id.unpack("a8a4a4a4a12").join('-')],
|
401
|
+
'customAuthorities' => [],
|
395
402
|
'additionalInformation' => {
|
396
|
-
'description' => "This user is for #{user} application.",
|
403
|
+
'description' => "This user is for #{user} application.",
|
397
404
|
'name' => "#{user} API User #{next_id}"
|
398
405
|
}
|
399
406
|
}
|
400
407
|
|
401
408
|
oauth_response, response = zuora_client.rest_call(
|
402
|
-
method: :post,
|
403
|
-
body: body.to_json,
|
404
|
-
url: zuora_client.rest_endpoint("genesis/clients").gsub('v1/', ''),
|
405
|
-
session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic,
|
409
|
+
method: :post,
|
410
|
+
body: body.to_json,
|
411
|
+
url: zuora_client.rest_endpoint("genesis/clients").gsub('v1/', ''),
|
412
|
+
session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic,
|
406
413
|
headers: auth_headers
|
407
414
|
)
|
408
415
|
|
@@ -444,7 +451,7 @@ module ZuoraConnect
|
|
444
451
|
Thread.current[:appinstance] = nil
|
445
452
|
session["appInstance"] = nil
|
446
453
|
render "zuora_connect/static/error_handled", :locals => {
|
447
|
-
:title => "Application could not create unique tokens.",
|
454
|
+
:title => "Application could not create unique tokens.",
|
448
455
|
:message => "Please contact support or retry launching application."
|
449
456
|
}, :layout => false
|
450
457
|
return
|
@@ -477,7 +484,7 @@ module ZuoraConnect
|
|
477
484
|
end
|
478
485
|
redirect_to "https://#{zuora_host}/apps/newlogin.do?retURL=#{request.fullpath}"
|
479
486
|
return
|
480
|
-
|
487
|
+
|
481
488
|
rescue ZuoraAPI::Exceptions::ZuoraAPIError, Exception => ex
|
482
489
|
if ex.message.include?("Referenced User resource(s) not found") && ex.class == ZuoraAPI::Exceptions::ZuoraAPIError
|
483
490
|
locals = {title: "Provisioning Error", message: "New tenats need to be provisioned by API Gateway('#{ex.message}'). Please contact support."}
|
@@ -490,7 +497,7 @@ module ZuoraConnect
|
|
490
497
|
ZuoraConnect.logger.error("UI Authorization Error", ex, zuora: zuora_details)
|
491
498
|
render "zuora_connect/static/error_unhandled", locals: {exception: ex, skip_exception: true}, layout: false, status: 500
|
492
499
|
end
|
493
|
-
return
|
500
|
+
return
|
494
501
|
end
|
495
502
|
elsif request["data"] && /^([A-Za-z0-9+\/\-\_]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/.match(request["data"].to_s)
|
496
503
|
session.clear
|
@@ -529,10 +536,10 @@ module ZuoraConnect
|
|
529
536
|
else
|
530
537
|
raise ZuoraConnect::Exceptions::AccessDenied.new("Authorization mismatch. Possible tampering with session.")
|
531
538
|
end
|
532
|
-
end
|
539
|
+
end
|
533
540
|
else
|
534
541
|
if session["appInstance"].present?
|
535
|
-
@appinstance = ZuoraConnect::AppInstance.find_by(:id => session["appInstance"])
|
542
|
+
@appinstance = ZuoraConnect::AppInstance.find_by(:id => session["appInstance"])
|
536
543
|
else
|
537
544
|
raise ZuoraConnect::Exceptions::AccessDenied.new("No application state or session found.")
|
538
545
|
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: 2.0.
|
4
|
+
version: 2.0.57f
|
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-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|