zuora_connect 3.1.0.pre.d → 3.1.0
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/application_controller.rb +5 -3
- data/app/models/zuora_connect/app_instance_base.rb +3 -2
- data/app/views/zuora_connect/application/ldap_login.html.erb +3 -2
- data/lib/zuora_connect/controllers/helpers.rb +10 -25
- data/lib/zuora_connect/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 689c9d74cda46ebd41a5d98dba982700dd365fa3746378276ceb0da4f5d0c493
|
|
4
|
+
data.tar.gz: 719e7beb03b156986160f8fa881960a7b7231b706c9a6bcd50af1788d622a125
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f905b5518a0b7e556d3cf4a45e73e86b149a4b95d111a315e46a2f91e9a07b43b2e9b77f0bd1c34e6fbf5848d321b64615ec612fc907b7f3fb9fd2f56944be3
|
|
7
|
+
data.tar.gz: a61a9c662b80a4d8af8a98f6eeef2be56b79cc9bc0853ae36a57ce22a59dde8bae5a7ab1b175aedec703743b6ccae8e81f2e565b028a23cdda9b7dce7544eb1a
|
|
@@ -12,7 +12,9 @@ module ZuoraConnect
|
|
|
12
12
|
|
|
13
13
|
begin
|
|
14
14
|
if ZuoraConnect::LDAP::Adapter.valid_credentials?(username, password)
|
|
15
|
-
|
|
15
|
+
id = ZuoraConnect::AppInstance.first.id
|
|
16
|
+
session["appInstance"] = ZuoraConnect::AppInstance.first.id
|
|
17
|
+
session["#{id}::admin"] = true
|
|
16
18
|
respond_to do |format|
|
|
17
19
|
format.html { redirect_to '/admin/app_instances' }
|
|
18
20
|
end
|
|
@@ -20,13 +22,13 @@ module ZuoraConnect
|
|
|
20
22
|
render 'zuora_connect/application/ldap_login', locals: {
|
|
21
23
|
title: 'LDAP Authentication Failed',
|
|
22
24
|
message: 'Invalid username or password'
|
|
23
|
-
}
|
|
25
|
+
}, :layout => false
|
|
24
26
|
end
|
|
25
27
|
rescue Net::LDAP::Error
|
|
26
28
|
render 'zuora_connect/application/ldap_login', locals: {
|
|
27
29
|
title: 'LDAP Authentication Net Error',
|
|
28
30
|
message: 'Failed to connect to server while authenticating the LDAP credentials. Please retry later.'
|
|
29
|
-
}
|
|
31
|
+
}, :layout => false
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
end
|
|
@@ -264,6 +264,7 @@ module ZuoraConnect
|
|
|
264
264
|
end
|
|
265
265
|
end
|
|
266
266
|
|
|
267
|
+
tenants = (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).select {|entity| !entity['skip'].to_bool}.map{|e| e['entityId']}.uniq if tenants.blank?
|
|
267
268
|
params = {
|
|
268
269
|
name: self.task_data.dig('name'),
|
|
269
270
|
zuora_entity_ids: (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).select {|entity| !entity['skip'].to_bool}.map{|e| e['id']}.uniq,
|
|
@@ -351,7 +352,7 @@ module ZuoraConnect
|
|
|
351
352
|
self.id >= 25000000
|
|
352
353
|
end
|
|
353
354
|
|
|
354
|
-
def fetch_connect_data
|
|
355
|
+
def fetch_connect_data(session: {})
|
|
355
356
|
self.check_oauth_state
|
|
356
357
|
response = HTTParty.get(ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json",:body => {:access_token => self.access_token})
|
|
357
358
|
|
|
@@ -377,7 +378,7 @@ module ZuoraConnect
|
|
|
377
378
|
begin
|
|
378
379
|
#Check how app was deployed
|
|
379
380
|
if !self.auto_deployed? && (!skip_connect || self['zuora_logins'].blank?)
|
|
380
|
-
self.fetch_connect_data
|
|
381
|
+
self.fetch_connect_data(session: session)
|
|
381
382
|
else
|
|
382
383
|
self.build_task(task_data: self.zuora_logins, session: session)
|
|
383
384
|
end
|
|
@@ -305,7 +305,7 @@ module ZuoraConnect
|
|
|
305
305
|
private
|
|
306
306
|
def setup_instance_via_prod_mode
|
|
307
307
|
zuora_entity_id = request.headers['ZuoraCurrentEntity'] || cookies['ZuoraCurrentEntity']
|
|
308
|
-
ZuoraConnect::ZuoraUser.current_user_id =
|
|
308
|
+
ZuoraConnect::ZuoraUser.current_user_id = '3'
|
|
309
309
|
|
|
310
310
|
if zuora_entity_id.present?
|
|
311
311
|
zuora_tenant_id = cookies['Zuora-Tenant-Id']
|
|
@@ -320,11 +320,6 @@ module ZuoraConnect
|
|
|
320
320
|
elsif cookies['ZSession'].present?
|
|
321
321
|
zuora_client = ZuoraAPI::Basic.new(url: "https://#{zuora_host}", session: cookies['ZSession'], entity_id: zuora_entity_id)
|
|
322
322
|
auth_headers.merge!({'Authorization' => "ZSession-a3N2w #{zuora_client.get_session(prefix: false, auth_type: :basic)}"})
|
|
323
|
-
elsif session["ldapAdmin"]
|
|
324
|
-
ZuoraConnect::logger.debug("Admin session found")
|
|
325
|
-
elsif ZuoraConnect::AppInstance::INTERNAL_HOSTS.include?(request.headers.fetch("HOST", nil))
|
|
326
|
-
render "zuora_connect/application/ldap_login"
|
|
327
|
-
return
|
|
328
323
|
else
|
|
329
324
|
render "zuora_connect/static/error_handled", :locals => {
|
|
330
325
|
:title => "Missing Authorization Token",
|
|
@@ -341,7 +336,7 @@ module ZuoraConnect
|
|
|
341
336
|
missmatched_entity = session["ZuoraCurrentEntity"] != zuora_entity_id
|
|
342
337
|
missing_identity = session["ZuoraCurrentIdentity"].blank?
|
|
343
338
|
|
|
344
|
-
if (missing_identity || missmatched_entity || different_zsession)
|
|
339
|
+
if (missing_identity || missmatched_entity || different_zsession)
|
|
345
340
|
zuora_details.merge!({'identity' => {'different_zsession' => different_zsession, 'missing_identity' => missing_identity, 'missmatched_entity' => missmatched_entity}})
|
|
346
341
|
identity, response = zuora_client.rest_call(
|
|
347
342
|
url: zuora_client.rest_endpoint("identity"),
|
|
@@ -382,10 +377,7 @@ module ZuoraConnect
|
|
|
382
377
|
end
|
|
383
378
|
end
|
|
384
379
|
|
|
385
|
-
if
|
|
386
|
-
appinstances = ZuoraConnect::AppInstance.pluck(:id, :name)
|
|
387
|
-
#Find matching app instances.
|
|
388
|
-
elsif zuora_instance_id.present?
|
|
380
|
+
if zuora_instance_id.present?
|
|
389
381
|
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)
|
|
390
382
|
else
|
|
391
383
|
#if app_instance_ids is present then permissions still controlled by connect
|
|
@@ -423,23 +415,11 @@ module ZuoraConnect
|
|
|
423
415
|
appinstances ||= ZuoraConnect::AppInstance.where("zuora_entity_ids ?& array[:entities] = true AND zuora_domain = :host", entities: [zuora_entity_id], host: zuora_client.rest_domain).pluck(:id, :name)
|
|
424
416
|
end
|
|
425
417
|
|
|
426
|
-
|
|
427
|
-
zuora_user_id = "3"
|
|
428
|
-
else
|
|
429
|
-
zuora_user_id = cookies['Zuora-User-Id'] || session["ZuoraCurrentIdentity"]['userId'] || request.headers["Zuora-User-Id"]
|
|
430
|
-
end
|
|
418
|
+
zuora_user_id = cookies['Zuora-User-Id'] || session["ZuoraCurrentIdentity"]['userId'] || request.headers["Zuora-User-Id"]
|
|
431
419
|
|
|
432
420
|
if appinstances.size == 1
|
|
433
421
|
ZuoraConnect.logger.debug("Instance is #{appinstances.to_h.keys.first}")
|
|
434
422
|
@appinstance = ZuoraConnect::AppInstance.find(appinstances.to_h.keys.first)
|
|
435
|
-
session["appInstance"] = @appinstance.id
|
|
436
|
-
ZuoraConnect::ZuoraUser.current_user_id = zuora_user_id
|
|
437
|
-
end
|
|
438
|
-
|
|
439
|
-
if session["ldapAdmin"]
|
|
440
|
-
# Maybe error. Should we return because of condition?
|
|
441
|
-
session["#{@appinstance.id}::admin"] = true
|
|
442
|
-
return
|
|
443
423
|
end
|
|
444
424
|
|
|
445
425
|
# One deployed instance with credentials
|
|
@@ -643,7 +623,12 @@ module ZuoraConnect
|
|
|
643
623
|
if session["appInstance"].present?
|
|
644
624
|
@appinstance = ZuoraConnect::AppInstance.find_by(:id => session["appInstance"])
|
|
645
625
|
else
|
|
646
|
-
|
|
626
|
+
if ZuoraConnect::AppInstance::INTERNAL_HOSTS.include?(request.headers.fetch("HOST", nil))
|
|
627
|
+
render "zuora_connect/application/ldap_login", :layout => false
|
|
628
|
+
return
|
|
629
|
+
else
|
|
630
|
+
raise ZuoraConnect::Exceptions::AccessDenied.new("No application state or session found.")
|
|
631
|
+
end
|
|
647
632
|
end
|
|
648
633
|
end
|
|
649
634
|
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.1.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Connect Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-06-
|
|
11
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: apartment
|
|
@@ -452,9 +452,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
452
452
|
version: '0'
|
|
453
453
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
454
454
|
requirements:
|
|
455
|
-
- - "
|
|
455
|
+
- - ">="
|
|
456
456
|
- !ruby/object:Gem::Version
|
|
457
|
-
version:
|
|
457
|
+
version: '0'
|
|
458
458
|
requirements: []
|
|
459
459
|
rubygems_version: 3.3.7
|
|
460
460
|
signing_key:
|