zuora_connect 3.1.5.pre.c → 3.1.5.pre.e

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: 46d27ab8e67bb535b556c6691e8f3e699bede791df15ef15a1017b89044db1f1
4
- data.tar.gz: 5bed177dd9a2974e416b344c70060b22239554c60d0ed078907c0069b6eec230
3
+ metadata.gz: 51ba32eace85675c3714ca6cfd35ad8f838e786f694e5fcb326ac4ca54eed611
4
+ data.tar.gz: bf4eb3dfabc738c02c38e97a6785016be2f5922b79d78530ff01c497ad5ec19b
5
5
  SHA512:
6
- metadata.gz: 72bba22075d8d4990c36206db79ae31683759efa35af50b5338df0b9d93d751e35dbb465a2a399ea512e4b0f9b8fb5e7e5872e2a5f1f2d327b8f7cb427e34f93
7
- data.tar.gz: 53233188e104192526968fc1973f065172e82a6cd637e5d5b9bdf3d4102c7dae2cffd150780c71349803872db9b4e46fc3a547c48c3350b0ac7f6dee31c874e3
6
+ metadata.gz: 0113d1a1344d26b70ee9224edb77c70eb298f1b95319e33359ff5c9d1e60db6b9f794f863f63799bd92b5cc29fae6d040dd61b41441fc44c5ce7a8c7714ba69a
7
+ data.tar.gz: 34b0700883c0032b828f9451bb179f3c658f1f66b8cc3167d1217682648bda8ab84c9ec56b82a33896616c0229929b0bf6ccaf5256aa35459b38f3caa6392057
@@ -518,7 +518,7 @@ module ZuoraConnect
518
518
  end
519
519
  rescue ArgumentError, OpenSSL::Cipher::CipherError => ex
520
520
  if (
521
- ex.is_a?(ArgumentError) && ['invalid base64'].include?(ex.message) ||
521
+ ex.is_a?(ArgumentError) && ['invalid base64', 'data must not be empty'].include?(ex.message) ||
522
522
  ex.is_a?(OpenSSL::Cipher::CipherError) && ['wrong final block length', 'bad decrypt'].include?(ex.message)
523
523
  ) && encryption_type == :envelope && (kms_tries += 1) < 3
524
524
  ZuoraConnect.logger.warn("Fallback to encryption 'direct', from '#{encryption_type}'", ex, self.default_ougai_items)
@@ -3,7 +3,7 @@ module ZuoraConnect
3
3
  self.table_name = "zuora_users"
4
4
  attr_accessor :session
5
5
 
6
- cattr_accessor :current_user_id
6
+ cattr_accessor :current_user_id, :current_org_id
7
7
 
8
8
  # zuora_user_id/zuora_entity_id both come from cookie or headers
9
9
  # zuora_current_identity comes from session
@@ -21,6 +21,7 @@ module ZuoraConnect
21
21
  end
22
22
 
23
23
  ZuoraConnect::ZuoraUser.current_user_id = request.headers["Zuora-User-Id"]
24
+ ZuoraConnect::ZuoraUser.current_org_id = request.headers["Zuora-Org-Id"]
24
25
 
25
26
  if request.headers["API-Token"].present?
26
27
  @appinstance = ZuoraConnect::AppInstance.find_by(:api_token => request.headers["API-Token"])
@@ -415,8 +416,11 @@ module ZuoraConnect
415
416
  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)
416
417
  end
417
418
 
419
+ zuora_org_id = cookies['Zuora-Org-Id'] || request.headers['Zuora-User-Id']
418
420
  zuora_user_id = cookies['Zuora-User-Id'] || session["ZuoraCurrentIdentity"]['userId'] || request.headers["Zuora-User-Id"]
419
421
 
422
+ ZuoraConnect::ZuoraUser.current_org_id = zuora_org_id
423
+
420
424
  if appinstances.size == 1
421
425
  ZuoraConnect.logger.debug("Instance is #{appinstances.to_h.keys.first}")
422
426
  @appinstance = ZuoraConnect::AppInstance.find(appinstances.to_h.keys.first)
@@ -65,5 +65,18 @@ module ZuoraConnect
65
65
  @message || @default_message
66
66
  end
67
67
  end
68
+
69
+ class OrganizationAccessForbidden < Error
70
+ attr_writer :default_message
71
+
72
+ def initialize(message = nil)
73
+ @message = message
74
+ @default_message = "You are not authorized to access this page with the current organization."
75
+ end
76
+
77
+ def to_s
78
+ @message || @default_message
79
+ end
80
+ end
68
81
  end
69
82
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.1.5-c"
4
+ VERSION = "3.1.5-e"
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.5.pre.c
4
+ version: 3.1.5.pre.e
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-09-06 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment