dscf-banking 0.5.0 → 0.5.1

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: 2b754b36bf6ebf7d81d2aa27b41afaba55e13243dd6480d181975ead1308d070
4
- data.tar.gz: 4bc4c26afed1d059067b644ff78670fca050c5445d009e7854e70989288c60b9
3
+ metadata.gz: f558728cc00fd36f502cc21c0f342a1db0102f7c2b08b92b4fdc224e7a3a4839
4
+ data.tar.gz: 47c41262ad655e43365f13a974cd253474e3dbf4ac0abdb46e03564288f20b42
5
5
  SHA512:
6
- metadata.gz: c6a6a1d6cae6a552e2051764ea1a8e223b2560db876e708fe83b0b2662f5378e380dfad4d0d6bea261ae8b9ca3e4337297340b41fe9125a46d731394c92fbe6f
7
- data.tar.gz: 8ece386566d110156443f0ef3824878012bd2206965b3b3497e89e7646f5290494d099e0991c19099e0b4e759e8de08a9b33a5f9a00f258e7f65a82a752a68c6
6
+ metadata.gz: c2c57799b26eb5bbe257e20c9a044298021268e55689fbb62e32157dc1b674595b0406f603f95e82356bc865c63a313a662d1266588d967700846579341ae465
7
+ data.tar.gz: 8d04ca7ec5e9ead3fa0d026999962fd5026a1cfb98825465ee455ba961f4606b406175bfe9152943cb5c2dbc19b1579ea5301b235e642116a34dc2eb0759da47
@@ -0,0 +1,44 @@
1
+ module Dscf
2
+ module Banking
3
+ module DemoPermissionBypass
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ before_action :demo_bypass_permissions!
8
+ end
9
+
10
+ def bypass_permissions_for_demo?
11
+ true
12
+ end
13
+
14
+ def pundit_user
15
+ user = current_user
16
+ return nil unless user
17
+
18
+ bypass_permissions_on_user!(user)
19
+ end
20
+
21
+ def authorize_review_action!
22
+ skip_authorization if respond_to?(:skip_authorization, true)
23
+ end
24
+
25
+ private
26
+
27
+ def demo_bypass_permissions!
28
+ skip_authorization if respond_to?(:skip_authorization, true)
29
+ skip_policy_scope if respond_to?(:skip_policy_scope, true)
30
+ end
31
+
32
+ def bypass_permissions_on_user!(user)
33
+ return user if user.instance_variable_defined?(:@_banking_demo_permission_bypass)
34
+
35
+ user.define_singleton_method(:has_permission?) { |_permission_code| true }
36
+ user.define_singleton_method(:can?) { |permission_code| has_permission?(permission_code) }
37
+ user.define_singleton_method(:super_admin?) { true }
38
+ user.instance_variable_set(:@_banking_demo_permission_bypass, true)
39
+
40
+ user
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class AccountsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  def index
6
7
  accounts = Dscf::Banking::Account.all
@@ -3,6 +3,40 @@ module Dscf
3
3
  class ApplicationController < ActionController::API
4
4
  include Dscf::Core::Authenticatable
5
5
  include Dscf::Core::JsonResponse
6
+ before_action :authenticate_user
7
+ before_action :demo_bypass_permissions!
8
+
9
+ # TEMPORARY DEMO BYPASS:
10
+ # Bypass banking authorization checks for authenticated users only.
11
+ # Remove after the demo.
12
+ def bypass_permissions_for_demo?
13
+ true
14
+ end
15
+
16
+ def pundit_user
17
+ user = current_user
18
+ return nil unless user
19
+
20
+ bypass_permissions_on_user!(user)
21
+ end
22
+
23
+ private
24
+
25
+ def demo_bypass_permissions!
26
+ skip_authorization if respond_to?(:skip_authorization, true)
27
+ skip_policy_scope if respond_to?(:skip_policy_scope, true)
28
+ end
29
+
30
+ def bypass_permissions_on_user!(user)
31
+ return user if user.instance_variable_defined?(:@_banking_demo_permission_bypass)
32
+
33
+ user.define_singleton_method(:has_permission?) { |_permission_code| true }
34
+ user.define_singleton_method(:can?) { |permission_code| has_permission?(permission_code) }
35
+ user.define_singleton_method(:super_admin?) { true }
36
+ user.instance_variable_set(:@_banking_demo_permission_bypass, true)
37
+
38
+ user
39
+ end
6
40
  end
7
41
  end
8
42
  end
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class ApplicationsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
  include Dscf::Core::ReviewableController
5
6
 
6
7
  # Custom default context for applications
@@ -22,6 +23,11 @@ module Dscf::Banking
22
23
  resubmit: { status: "submitted", update_model: true }
23
24
  }
24
25
 
26
+ # TEMPORARY DEMO BYPASS: remove after demo.
27
+ def authorize_review_action!
28
+ skip_authorization
29
+ end
30
+
25
31
  private
26
32
 
27
33
  def application_data(application)
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class DocumentsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  before_action :find_application
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class InterestConfigurationsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  private
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class InterestRateTiersController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  private
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class InterestRateTypesController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  private
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class ProductApprovalsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  private
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class ProductCategoriesController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  private
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class TransactionTypesController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  private
6
7
 
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class TransactionsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
 
5
6
  rescue_from ActiveRecord::RecordNotFound do |exception|
6
7
  render json: {
@@ -1,6 +1,7 @@
1
1
  module Dscf::Banking
2
2
  class VirtualAccountProductsController < ApplicationController
3
3
  include Dscf::Core::Common
4
+ include Dscf::Banking::DemoPermissionBypass
4
5
  include Dscf::Core::ReviewableController
5
6
 
6
7
  # Custom default context with request_modification status
@@ -20,6 +21,11 @@ module Dscf::Banking
20
21
  resubmit: { status: "pending_approval", update_model: true }
21
22
  }
22
23
 
24
+ # TEMPORARY DEMO BYPASS: remove after demo.
25
+ def authorize_review_action!
26
+ skip_authorization
27
+ end
28
+
23
29
  def audit_logs
24
30
  product = Dscf::Banking::VirtualAccountProduct.find(params[:id])
25
31
  audit_logs = Dscf::Banking::ProductAuditLog.by_product(product.id).recent
@@ -2,6 +2,7 @@ module Dscf
2
2
  module Banking
3
3
  class VouchersController < ApplicationController
4
4
  include Dscf::Core::Common
5
+ include Dscf::Banking::DemoPermissionBypass
5
6
  skip_before_action :set_object, only: :show
6
7
 
7
8
  def create
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Banking
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-banking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat Efrem
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-03-10 00:00:00.000000000 Z
10
+ date: 2026-03-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -425,6 +425,7 @@ files:
425
425
  - MIT-LICENSE
426
426
  - README.md
427
427
  - Rakefile
428
+ - app/controllers/concerns/dscf/banking/demo_permission_bypass.rb
428
429
  - app/controllers/dscf/banking/accounts_controller.rb
429
430
  - app/controllers/dscf/banking/application_controller.rb
430
431
  - app/controllers/dscf/banking/applications_controller.rb