zuora_connect 3.1.0.pre.e → 3.1.0.pre.g
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/zuora_connect/application_controller.rb +5 -3
- data/app/models/zuora_connect/app_instance_base.rb +1 -0
- 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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e2a1cd708b1c3c361604650519282a485b16b9995bc9b4f202025483241686
|
4
|
+
data.tar.gz: 9c74913350e9fecc2c09221145bb3a17d99406fc869c7dfbd6d905f681f4dff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb9acf273feece3615c01183118fc8c3848d0e75019dfcf02da9d94e0d5d51fbd27bebde5832c86ff0fb3fcb77394b57189ea19003f1d122baf76749f577ad57
|
7
|
+
data.tar.gz: e4a24d248536c517797499550bc107f07c7bee479dd7621fc0d051b97f7ba10de40bd8d6490d08b66b9a1743a86c5cb415b4337257cbc26e6b9bcc309bcf29b2
|
@@ -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,
|
@@ -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.pre.
|
4
|
+
version: 3.1.0.pre.g
|
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
|