zuora_connect 3.0.0.pre.x → 3.0.1.pre.c
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 +4 -4
- data/app/helpers/zuora_connect/application_helper.rb +1 -1
- data/app/models/concerns/zuora_connect/auditable.rb +25 -0
- data/app/models/zuora_connect/login.rb +2 -2
- data/config/initializers/object_method_hooks.rb +2 -2
- data/config/initializers/postgresql_adapter.rb +1 -1
- data/lib/metrics/net.rb +1 -1
- data/lib/zuora_connect.rb +11 -5
- data/lib/zuora_connect/configuration.rb +1 -1
- data/lib/zuora_connect/controllers/helpers.rb +4 -4
- data/lib/zuora_connect/version.rb +2 -2
- metadata +5 -5
- data/lib/zuora_connect/zuora_audit.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad647d03e32b321e138c9adac68f251170483f170801baa94017ba70e920b8e8
|
4
|
+
data.tar.gz: 80fcbbb2144cbb89e2f79a28dc425350337199528e9a47adaa2f677bfd4be7ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d1f9ce5e3958d4c88f0480158c857cf1dcdce12f72af62c8f11c1a7caf03551b5a1be34fd30b404072058b57ef1a6b3c9834fafa7cea40615e5d5ddc992af6e
|
7
|
+
data.tar.gz: e3a4ac9e3994c489fe4c21e3f2ae313d58dad157a8629965c68032f8a77d4578d7076a90f22ba8bc71c195df9e97cb07cb0160452546c5a16eacdce1e96c9a53
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
module ApplicationHelper
|
3
3
|
def is_app_admin?
|
4
|
-
return @appinstance.blank? ? false : session["#{@appinstance.id}::admin"]
|
4
|
+
return @appinstance.blank? ? false : session["#{@appinstance.id}::admin"] || @appinstance.zuora_tenant_ids.include?("9")
|
5
5
|
end
|
6
6
|
|
7
7
|
def zuora_user
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ZuoraConnect
|
4
|
+
# Added by @Vina
|
5
|
+
# Description: This automatically stamp user created/updated the record for DataQuery Audit
|
6
|
+
# Usage: add 'include ZuoraConnect::Auditable' to your model.rb that you would like to track
|
7
|
+
module Auditable
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
before_create :set_created_by_id
|
12
|
+
before_update :set_updated_by_id
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def set_created_by_id
|
17
|
+
self.created_by_id = ZuoraUser.current_user_id if defined?(created_by_id)
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_updated_by_id
|
21
|
+
self.updated_by_id = ZuoraUser.current_user_id if defined?(updated_by_id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -8,12 +8,12 @@ module ZuoraConnect
|
|
8
8
|
login_type = fields.dig("authentication_type").blank? ? 'Basic' : fields.dig("authentication_type").capitalize
|
9
9
|
|
10
10
|
raise ZuoraConnect::Exceptions::InvalidCredentialSet.new("Cannot setup application with ZSession Login.") if login_type == "Session"
|
11
|
-
@clients["Default"] = "::ZuoraAPI::#{login_type}".constantize.new(login_fields)
|
11
|
+
@clients["Default"] = "::ZuoraAPI::#{login_type}".constantize.new(**login_fields)
|
12
12
|
@default_entity = fields["entities"][0]["id"] if (fields.dig("entities") || []).size == 1
|
13
13
|
if fields["entities"] && fields["entities"].size > 0
|
14
14
|
fields["entities"].each do |entity|
|
15
15
|
params = {:entity_id => entity["id"]}.merge(login_fields)
|
16
|
-
@clients[entity["id"]] = "::ZuoraAPI::#{login_type}".constantize.new(params)
|
16
|
+
@clients[entity["id"]] = "::ZuoraAPI::#{login_type}".constantize.new(**params)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
self.attr_builder("available_entities", @clients.keys)
|
@@ -5,7 +5,7 @@ class Object
|
|
5
5
|
args.each do |method_name|
|
6
6
|
old_method = instance_method(method_name) rescue next
|
7
7
|
|
8
|
-
define_method(method_name) do |*args|
|
8
|
+
define_method(method_name) do |*args, **kwords, &block|
|
9
9
|
# invoke before callback
|
10
10
|
if options[:before].present?
|
11
11
|
options[:before].is_a?(Proc) ? options[:before].call(method_name, self):
|
@@ -14,7 +14,7 @@ class Object
|
|
14
14
|
|
15
15
|
# you can modify the code to call after callback
|
16
16
|
# only when the old method returns true etc..
|
17
|
-
old_method.bind(self).call(*args)
|
17
|
+
old_method.bind(self).call(*args, **kwords, &block)
|
18
18
|
|
19
19
|
# invoke after callback
|
20
20
|
if options[:after].present?
|
@@ -10,7 +10,7 @@ module ActiveRecord
|
|
10
10
|
|
11
11
|
return if loaded_from_cache?(initializer)
|
12
12
|
|
13
|
-
if supports_ranges?
|
13
|
+
if Rails::VERSION::MAJOR >= 6 || supports_ranges?
|
14
14
|
query = <<-SQL
|
15
15
|
SELECT DISTINCT on (t.typname) t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
|
16
16
|
FROM pg_type as t
|
data/lib/metrics/net.rb
CHANGED
@@ -85,7 +85,7 @@ class HttpLogger
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def request_url(http, request)
|
88
|
-
|
88
|
+
CGI.unescape("http#{"s" if http.use_ssl?}://#{http.address}:#{http.port}#{request.path}")
|
89
89
|
end
|
90
90
|
|
91
91
|
def log_request_headers(request)
|
data/lib/zuora_connect.rb
CHANGED
@@ -11,10 +11,8 @@ require 'resque/plugins/custom_logger'
|
|
11
11
|
require 'resque/plugins/app_instance_job'
|
12
12
|
require 'metrics/influx/point_value'
|
13
13
|
require 'metrics/net'
|
14
|
-
require 'zuora_connect/zuora_audit'
|
15
14
|
require 'active_record'
|
16
15
|
require 'zuora_observability'
|
17
|
-
::ActiveRecord::Base.send :include, ZuoraConnect::ZuoraAudit
|
18
16
|
|
19
17
|
module ZuoraConnect
|
20
18
|
class << self
|
@@ -31,6 +29,14 @@ module ZuoraConnect
|
|
31
29
|
@logger ||= ZuoraObservability::Logger.custom_logger(name: "Connect", level: Rails.logger.level)
|
32
30
|
end
|
33
31
|
end
|
32
|
+
|
33
|
+
def app_name
|
34
|
+
if Rails::VERSION::MAJOR >= 6
|
35
|
+
Rails.application.class.module_parent_name
|
36
|
+
else
|
37
|
+
Rails.application.class.parent_name
|
38
|
+
end
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
module Controllers
|
@@ -74,7 +80,7 @@ module ZuoraConnect
|
|
74
80
|
}
|
75
81
|
when 'test'
|
76
82
|
defaults = {
|
77
|
-
|
83
|
+
enabled: false,
|
78
84
|
disable_send: true
|
79
85
|
}
|
80
86
|
end
|
@@ -83,10 +89,10 @@ module ZuoraConnect
|
|
83
89
|
disable_start_message: true,
|
84
90
|
pool_size: 1,
|
85
91
|
transaction_max_spans: 500,
|
86
|
-
|
92
|
+
transaction_ignore_urls: ['^\/admin\/resque.*', '^\/admin\/redis.*', '^\/admin\/peek.*', '^\/peek.*'],
|
87
93
|
verify_server_cert: false,
|
88
94
|
log_level: Logger::INFO,
|
89
|
-
service_name: ENV['DEIS_APP'].present? ? ENV['DEIS_APP'] :
|
95
|
+
service_name: ENV['DEIS_APP'].present? ? ENV['DEIS_APP'] : ZuoraConnect.app_name,
|
90
96
|
logger: ZuoraObservability::Logger.custom_logger(name: "ElasticAPM", level: Logger::WARN)
|
91
97
|
})
|
92
98
|
defaults.merge!({disable_send: true}) if defined?(Rails::Console)
|
@@ -193,7 +193,7 @@ module ZuoraConnect
|
|
193
193
|
end
|
194
194
|
|
195
195
|
def check_connect_admin!(raise_error: false)
|
196
|
-
if !session["#{@appinstance.id}::admin"]
|
196
|
+
if !(session["#{@appinstance.id}::admin"] || @appinstance.zuora_tenant_ids.include?("9"))
|
197
197
|
raise ZuoraConnect::Exceptions::AccessDenied.new("User is not an authorized admin for this application") if raise_error
|
198
198
|
|
199
199
|
respond_to do |format|
|
@@ -550,11 +550,11 @@ module ZuoraConnect
|
|
550
550
|
final_error = output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text
|
551
551
|
session.clear
|
552
552
|
if final_error.blank?
|
553
|
-
ZuoraConnect.logger.warn("UI Authorization Error", ex,
|
553
|
+
ZuoraConnect.logger.warn("UI Authorization Error", ex, response: { params: response.body })
|
554
554
|
elsif final_error != "INVALID_SESSION"
|
555
|
-
ZuoraConnect.logger.warn("UI Authorization Error", ex,
|
555
|
+
ZuoraConnect.logger.warn("UI Authorization Error", ex, response: { params: final_error })
|
556
556
|
else
|
557
|
-
ZuoraConnect.logger.info("UI Authorization Error", ex,
|
557
|
+
ZuoraConnect.logger.info("UI Authorization Error", ex, response: { params: final_error })
|
558
558
|
end
|
559
559
|
redirect_to "https://#{zuora_host}/apps/newlogin.do?retURL=#{request.fullpath}"
|
560
560
|
return
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module ZuoraConnect
|
2
|
-
VERSION = "3.0.
|
3
|
-
end
|
2
|
+
VERSION = "3.0.1-c"
|
3
|
+
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.0.
|
4
|
+
version: 3.0.1.pre.c
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: 4.1.0
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: '
|
112
|
+
version: '6.1'
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ dependencies:
|
|
119
119
|
version: 4.1.0
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
122
|
+
version: '6.1'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: raindrops
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -352,6 +352,7 @@ files:
|
|
352
352
|
- app/controllers/zuora_connect/static_controller.rb
|
353
353
|
- app/helpers/zuora_connect/api/v1/app_instance_helper.rb
|
354
354
|
- app/helpers/zuora_connect/application_helper.rb
|
355
|
+
- app/models/concerns/zuora_connect/auditable.rb
|
355
356
|
- app/models/zuora_connect/app_instance.rb
|
356
357
|
- app/models/zuora_connect/app_instance_base.rb
|
357
358
|
- app/models/zuora_connect/login.rb
|
@@ -411,7 +412,6 @@ files:
|
|
411
412
|
- lib/zuora_connect/exceptions.rb
|
412
413
|
- lib/zuora_connect/railtie.rb
|
413
414
|
- lib/zuora_connect/version.rb
|
414
|
-
- lib/zuora_connect/zuora_audit.rb
|
415
415
|
homepage:
|
416
416
|
licenses: []
|
417
417
|
metadata: {}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Added by @Vina
|
2
|
-
# Description: This automatically stamp user created/updated the record for DataQuery Audit
|
3
|
-
# Usage: add 'zuora_audit' to your model.rb that you would like to track
|
4
|
-
|
5
|
-
module ZuoraConnect
|
6
|
-
module ZuoraAudit
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
def zuora_audit
|
11
|
-
include ZuoraConnect::ZuoraAudit::ZuoraAuditInstanceMethods
|
12
|
-
before_create :set_created_by_id
|
13
|
-
before_update :set_updated_by_id
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module ZuoraAuditInstanceMethods
|
18
|
-
def set_created_by_id
|
19
|
-
self.created_by_id = current_user_id if defined?(self.created_by_id)
|
20
|
-
end
|
21
|
-
|
22
|
-
def set_updated_by_id
|
23
|
-
self.updated_by_id = current_user_id if defined?(self.updated_by_id)
|
24
|
-
end
|
25
|
-
|
26
|
-
def current_user_id
|
27
|
-
return ZuoraConnect::ZuoraUser.current_user_id
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|