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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5214f01edfd6d5be196318459c718b0b654ddf9d94b658860fd5595f834ff59a
4
- data.tar.gz: 0a718fed463c71a7723897f673dd40c2facc742a205b2851f6ede90e20e796da
3
+ metadata.gz: f4e2a1cd708b1c3c361604650519282a485b16b9995bc9b4f202025483241686
4
+ data.tar.gz: 9c74913350e9fecc2c09221145bb3a17d99406fc869c7dfbd6d905f681f4dff3
5
5
  SHA512:
6
- metadata.gz: 3a51ece01655985f0e699eaf0550b0f87f6af2f43dc3ae015982aa6674113e77216d68fc21f98811d6b13ec930e9db01d4e8ab28814be04f2210e11df91c3183
7
- data.tar.gz: 91500dc84ef5cd15efd160cbb885eb022b3861677e66e28f276a37e0a025d27fdbbb4615bff4f1bf8378e2413935fe7ba418b72a9f806b7167f7876e3b6ec470
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
- session['ldapAdmin'] = true
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,
@@ -147,8 +147,9 @@
147
147
  }
148
148
 
149
149
  .error{
150
- color: #D8000C;
151
- background-color: #FFBABA;
150
+ color: white;
151
+ margin: 20px;
152
+ margin-top: 130px;
152
153
  }
153
154
  </style>
154
155
  </head>
@@ -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 = nil
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) && (!session["ldapAdmin"])
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 session["ldapAdmin"]
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
- if session["ldapAdmin"]
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
- raise ZuoraConnect::Exceptions::AccessDenied.new("No application state or session found.")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.1.0-e"
4
+ VERSION = "3.1.0-g"
5
5
  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.e
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-13 00:00:00.000000000 Z
11
+ date: 2022-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment