zuora_connect 3.1.4 → 3.1.5.pre.a

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: 493dd9cc489602b3f459c2eb71bf944ae8e4d48dd5179a68836e6b6586ce02de
4
- data.tar.gz: 79dfe48b44bf8c8fd9f95931ae8d7b9db43d4194cc62172a3ca08778678e003d
3
+ metadata.gz: 19aedfac159e02a6098ddd1d40b8c05c76ed0198a31fefb059fc1efee21f9680
4
+ data.tar.gz: 1e404cfa4449dca2f20380fb25252178739a694115b7335909dd20f500a4cf72
5
5
  SHA512:
6
- metadata.gz: 887d066e13ff882c1b2a96290d88207359d710a1b87989a5442aa45e152e4312213c936e14adbc6c1b0f11c29edaaf8107803a4733b55684279803ae55e3a2ac
7
- data.tar.gz: d774d37dc4adab8073d88521c59bb4d58a994626f81e17c1b9421b9273b56f5f7903c50375614d613c5961846fd0f52de94eb19b58a2d0ec956051668f41b0b0
6
+ metadata.gz: e0b52c5b8639d0ead9c33ea46951eb71f6f543bb01e911ef140fa3c55bab38d3c7cbc3445f38ec5064d91093fc1d39427cc0f7be52e4d27652d82a436a708e04
7
+ data.tar.gz: 0a73154220907b992dcf750a036e654c64989f16e45ecb3d24bb89f894da008516efd0ab7853190852dd2ea22ec3edd2490184194d38d877aad29150a40aa377
@@ -4,10 +4,9 @@ module ZuoraConnect
4
4
  before_action :clear_connect_app_session, :only => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
5
5
  after_action :persist_connect_app_session, :except => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
6
6
 
7
- skip_before_action :verify_authenticity_token, :only => [:initialize_app, :provision]
7
+ skip_before_action :verify_authenticity_token, :only => [:initialize_app, :provision, :instance_drop]
8
8
  http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision, :instance_user, :instance_drop]
9
9
 
10
-
11
10
  def health
12
11
  if params[:error].present?
13
12
  begin
@@ -52,6 +51,10 @@ module ZuoraConnect
52
51
  end
53
52
 
54
53
  def provision
54
+ if ZuoraConnect.configuration.disable_provisioning
55
+ render(json: { status: 403, message: 'Provisioning is suspended until 2022-08-17' }, status: 403) && return
56
+ end
57
+
55
58
  create_new_instance
56
59
  unless performed?
57
60
  render json: {
@@ -120,25 +123,30 @@ module ZuoraConnect
120
123
  end
121
124
 
122
125
  def instance_drop
123
- ZuoraConnect::AppInstance.read_master_db do
124
- instance_id = params[:id]
125
- @appinstance = ZuoraConnect::AppInstance.find(instance_id)
126
- if @appinstance.drop_instance
127
- ZuoraConnect::AppInstance.destroy(instance_id)
128
- msg = Apartment::Tenant.drop(instance_id)
129
-
130
- if msg.error_message.present?
131
- render json: { "message" => msg.error_message }, status: :bad_request
126
+ host = request.headers.fetch("HOST", nil)
127
+ if host.present? && ZuoraConnect::AppInstance::INTERNAL_HOSTS.include?(host)
128
+ ZuoraConnect::AppInstance.read_master_db do
129
+ instance_id = params[:id]
130
+ @appinstance = ZuoraConnect::AppInstance.find(instance_id)
131
+ if @appinstance.drop_instance
132
+ ZuoraConnect::AppInstance.destroy(instance_id)
133
+ msg = Apartment::Tenant.drop(instance_id)
134
+
135
+ if msg.error_message.present?
136
+ render json: { "message" => msg.error_message }, status: :bad_request
137
+ else
138
+ render json: {
139
+ status: 200,
140
+ message: 'Success',
141
+ app_instance_id: instance_id
142
+ }, status: 200
143
+ end
132
144
  else
133
- render json: {
134
- status: 200,
135
- message: 'Success',
136
- app_instance_id: instance_id
137
- }, status: 200
145
+ render json: { "message" => @appinstance.drop_message }, status: :bad_request
138
146
  end
139
- else
140
- render json: { "message" => @appinstance.drop_message }, status: :bad_request
141
147
  end
148
+ else
149
+ render json: { "message" => "Host #{host} is not internal" }, status: :bad_request
142
150
  end
143
151
  rescue StandardError => e
144
152
  message = 'Failed to drop instance'
@@ -7,7 +7,7 @@ module ZuoraConnect
7
7
 
8
8
  attr_accessor :oauth_client_id, :oauth_client_secret, :oauth_client_redirect_uri
9
9
 
10
- attr_accessor :dev_mode_logins, :dev_mode_options, :dev_mode_mode, :dev_mode_appinstance, :dev_mode_user, :dev_mode_pass, :dev_mode_admin, :dev_mode_secret_access_key,:dev_mode_access_key_id,:aws_region, :s3_bucket_name, :s3_folder_name, :insert_migrations, :skip_connect, :encryption_type, :local_task_data
10
+ attr_accessor :dev_mode_logins, :dev_mode_options, :dev_mode_mode, :dev_mode_appinstance, :dev_mode_user, :dev_mode_pass, :dev_mode_admin, :dev_mode_secret_access_key,:dev_mode_access_key_id,:aws_region, :s3_bucket_name, :s3_folder_name, :insert_migrations, :skip_connect, :encryption_type, :local_task_data, :disable_provisioning
11
11
 
12
12
  def initialize
13
13
  @default_locale = :en
@@ -23,6 +23,7 @@ module ZuoraConnect
23
23
  @skip_connect = false
24
24
  @encryption_type = :direct
25
25
  @local_task_data = false
26
+ @disable_provisioning = false
26
27
 
27
28
  # Setting the app name for telegraf write
28
29
  @enable_metrics = false
@@ -446,6 +446,10 @@ module ZuoraConnect
446
446
 
447
447
  #We have no deployed instance for this tenant
448
448
  else
449
+ if ZuoraConnect.configuration.disable_provisioning
450
+ raise ZuoraConnect::Exceptions::AccessDenied.new("Provisioning is suspended")
451
+ end
452
+
449
453
  #Ensure user can access oauth creation API
450
454
  if !session["ZuoraCurrentUserInfo"]['permissions'].include?("permission.userManagement")
451
455
  Thread.current[:appinstance] = nil
@@ -601,6 +605,10 @@ module ZuoraConnect
601
605
  @appinstance = ZuoraConnect::AppInstance.find_by(:id => values["appInstance"].to_i)
602
606
 
603
607
  if @appinstance.blank?
608
+ if ZuoraConnect.configuration.disable_provisioning
609
+ raise ZuoraConnect::Exceptions::AccessDenied.new("Provisioning is suspended")
610
+ end
611
+
604
612
  Apartment::Tenant.switch!("public")
605
613
  begin
606
614
  Apartment::Tenant.create(values["appInstance"].to_s)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.1.4"
4
+ VERSION = "3.1.5-a"
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.4
4
+ version: 3.1.5.pre.a
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-08-03 00:00:00.000000000 Z
11
+ date: 2022-08-10 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: '0'
457
+ version: 1.3.1
458
458
  requirements: []
459
459
  rubygems_version: 3.3.7
460
460
  signing_key: