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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a5ca7980f0c3e5418bbd8b34d277421c00bbe709870ca1f17088c16e65a7454
4
- data.tar.gz: 5465170884c82258888725799568a8d43e70ddceb968652c284335397023875f
3
+ metadata.gz: 689c9d74cda46ebd41a5d98dba982700dd365fa3746378276ceb0da4f5d0c493
4
+ data.tar.gz: 719e7beb03b156986160f8fa881960a7b7231b706c9a6bcd50af1788d622a125
5
5
  SHA512:
6
- metadata.gz: 623b63683caba7ac18d08da2fba2b9d5db96eb24b9d0e0b833b85d4d707a2f2c34f1dc687248b9e034271cae4a4f402e0a78ce227cecfbbf9e467de07189771f
7
- data.tar.gz: 2f27d2fe72ad6abe199a49b8872c6ed1e581257d62a62576452331e215f46f48ec17a88c13d75491573c27a71d151d3c1b0bb2f9258d3e1cd458213ed3f5b1b4
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
- 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,
@@ -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
@@ -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-d"
4
+ VERSION = "3.1.0"
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.d
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-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
@@ -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: 1.3.1
457
+ version: '0'
458
458
  requirements: []
459
459
  rubygems_version: 3.3.7
460
460
  signing_key: