dscf-credit 0.4.53 → 0.4.55

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: 6cd7b86fafba65100a4ed0ab5c41c589ada83d23f570229aca69fbf6a83d63fb
4
- data.tar.gz: 591f9e67a6cb15426ad218deecbf42e0c88fca60f20b1e06bbb79f270fca3497
3
+ metadata.gz: 8d03d8c1db12a3dddd204a85a1584050c51e268e1533ca2b24ee9ca9c680145c
4
+ data.tar.gz: 0c55a66f160d74298f48fd1aff8b50a782e8c439fa09ba71bd910decbf47b5f4
5
5
  SHA512:
6
- metadata.gz: a858b1d4de7fb4ea0e03f767e93305e5283d0503e307b89e639b36f0183969f8fde5ed9adb12f92938e7b9b0a24d91cfdb7dbb39cb38fd453e0fcff5aa3ec244
7
- data.tar.gz: 66bf53f5e459109da2f6b470e06edd49b671ac5798bad9d67af51c178985343009c6aa3606f5bce696e6909db05b71f860eb24faee4ca3305815a076dbb80dcc
6
+ metadata.gz: ccbe643cd93d1145184999edcbfd8eb45faa8c0902e7cfaa8e6c11811d583f283b957ced5144bebed30eb4cbcd79a7c6b507dc2ee39d45072833582812928d1b
7
+ data.tar.gz: 832270b58285a20fd5952d5e8ff6c97418d55b2548abb8cd584c4ada48ea8d47df73869e45aa9701589bdcb9fd2eca633019f54c4a0c867bb9239353b8a70a0d
@@ -22,7 +22,7 @@ module Dscf::Credit
22
22
  validates :score, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 100 }, allow_nil: true
23
23
 
24
24
  def self.ransackable_attributes(auth_object = nil)
25
- %w[id bank_statement_source score created_at updated_at]
25
+ %w[id user_id bank_id review_branch_id credit_product_id backer_id backer_type bank_statement_source score created_at updated_at]
26
26
  end
27
27
 
28
28
  def self.ransackable_associations(auth_object = nil)
@@ -16,8 +16,12 @@ module Dscf::Credit
16
16
  scope :with_score_range, ->(min, max) { where(score: min..max) }
17
17
  scope :by_total_limit_range, ->(min, max) { where(total_limit: min..max) }
18
18
 
19
+ ransacker :user_id do
20
+ Arel.sql("(SELECT dscf_credit_loan_applications.user_id FROM dscf_credit_loan_applications WHERE dscf_credit_loan_applications.id = dscf_credit_loan_profiles.loan_application_id)")
21
+ end
22
+
19
23
  def self.ransackable_attributes(auth_object = nil)
20
- %w[id code score total_limit created_at updated_at loan_application_id]
24
+ %w[id code score total_limit created_at updated_at loan_application_id user_id]
21
25
  end
22
26
 
23
27
  def self.ransackable_associations(auth_object = nil)
data/db/seeds.rb CHANGED
@@ -1,5 +1,40 @@
1
1
  puts "Starting minimal DSCF Credit seed..."
2
2
 
3
+ puts "Registering dscf_credit permissions..."
4
+ if defined?(Dscf::Core::PermissionRegistry)
5
+ Dscf::Core::PermissionRegistry.register("dscf_credit") do
6
+ resource :banks, actions: %i[index show create update destroy]
7
+ resource :bank_branches, actions: %i[index show create update destroy]
8
+ resource :bank_staffs, actions: %i[index show create update destroy]
9
+ resource :categories, actions: %i[index show create update destroy]
10
+ resource :users, actions: %i[index show create update destroy]
11
+ resource :loans, actions: %i[index show create update destroy]
12
+ resource :loan_accruals, actions: %i[index show create update destroy generate statistics]
13
+ resource :loan_transactions, actions: %i[index show create update destroy]
14
+ resource :loan_application_data, actions: %i[index show create update destroy]
15
+ resource :loan_profiles, actions: %i[index show create update destroy submit approve reject request_modification resubmit calculate_facility_limits]
16
+ resource :loan_applications, actions: %i[index show create update destroy submit approve reject request_modification resubmit submit_source_data scoring_form calculate_credit_score]
17
+ resource :facilitators, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
18
+ resource :facilitator_applications, actions: %i[index show create update destroy submit approve reject request_modification resubmit bulk_create]
19
+ resource :scoring_tables, actions: %i[index show create update destroy submit approve reject request_modification resubmit activate deactivate]
20
+ resource :scoring_parameters, actions: %i[index show create update destroy submit approve reject request_modification resubmit activate deactivate]
21
+ resource :scoring_table_parameters, actions: %i[index show create update destroy]
22
+ resource :scoring_table_normalizers, actions: %i[index show create update destroy]
23
+ resource :information_sources, actions: %i[index show create update destroy submit approve reject request_modification resubmit activate deactivate]
24
+ resource :credit_products, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
25
+ resource :credit_lines, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
26
+ resource :credit_line_specs, actions: %i[index show create update destroy]
27
+ resource :eligible_credit_lines, actions: %i[index show create update destroy apply_risk]
28
+ resource :system_configs, actions: %i[index show create update destroy submit approve reject request_modification resubmit]
29
+ resource :system_config_definitions, actions: %i[index show create update destroy]
30
+ resource :credit_limit_calculations, actions: %i[create]
31
+ resource :disbursements, actions: %i[create]
32
+ resource :repayments, actions: %i[create]
33
+ resource :kyc_reviews, actions: %i[index show]
34
+ end
35
+ puts "✓ dscf_credit permissions registered"
36
+ end
37
+
3
38
  admin_user = nil
4
39
  admin_role = nil
5
40
 
@@ -16,15 +51,25 @@ else
16
51
  end
17
52
 
18
53
  if defined?(Dscf::Core::Role)
19
- admin_role = Dscf::Core::Role.find_or_create_by!(code: 'admin') do |role|
20
- role.name = 'System Administrator'
54
+ super_admin_role = Dscf::Core::Role.find_or_create_by(code: 'SUPER_ADMIN') do |role|
55
+ role.name = 'Super Administrator'
56
+ role.description = 'Full system access — bypasses all permission checks'
57
+ role.active = true
21
58
  end
22
59
  puts "✓ System admin role created/found"
23
60
  end
24
61
 
25
- if admin_user && admin_role && defined?(Dscf::Core::UserRole)
26
- Dscf::Core::UserRole.find_or_create_by!(user: admin_user, role: admin_role)
27
- puts "✓ Admin role assigned to admin user"
62
+ if defined?(Dscf::Core::Permission) && defined?(Dscf::Core::RolePermission)
63
+ all_credit_permissions = Dscf::Core::Permission.where(engine: 'dscf_credit').pluck(:code)
64
+ # SUPER_ADMIN gets all permissions
65
+ Dscf::Core::Permission.where(code: all_credit_permissions).each do |perm|
66
+ Dscf::Core::RolePermission.find_or_create_by!(role: super_admin_role, permission: perm)
67
+ end
68
+ end
69
+
70
+ if admin_user && super_admin_role && defined?(Dscf::Core::UserRole)
71
+ Dscf::Core::UserRole.find_or_create_by!(user: admin_user, role: super_admin_role)
72
+ puts "✓ Super admin role assigned to admin user"
28
73
  end
29
74
 
30
75
  bunna_bank = Dscf::Credit::Bank.find_or_create_by!(registration_number: 'BUN001') do |bank|
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Credit
3
- VERSION = "0.4.53"
3
+ VERSION = "0.4.55"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-credit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.53
4
+ version: 0.4.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adoniyas