dscf-credit 0.4.54 → 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: 664b2af8bd89a05c8241bac8799263916a3c61f9670daa9f3af64f1cbb3af8c5
4
- data.tar.gz: d7b27f18e57c8073ee3c0cfa0a3b32e3e5676f6b6aac522beef897855c14b926
3
+ metadata.gz: 8d03d8c1db12a3dddd204a85a1584050c51e268e1533ca2b24ee9ca9c680145c
4
+ data.tar.gz: 0c55a66f160d74298f48fd1aff8b50a782e8c439fa09ba71bd910decbf47b5f4
5
5
  SHA512:
6
- metadata.gz: 3942f65c54066fc02898260c4975169c684969e92b7e4744ddfabda5dc66850e6b2542bcfca562c45005148b717dc81441738e846d164db7136474870d2d93f0
7
- data.tar.gz: c30e3b5c3cd0d5e51c8d86be44294c00d864da7bf418794bba8152a2db054101bcc6c77d07865a6678ef254a0431540ef0093824f32c6d96a63d9a864c3c91be
6
+ metadata.gz: ccbe643cd93d1145184999edcbfd8eb45faa8c0902e7cfaa8e6c11811d583f283b957ced5144bebed30eb4cbcd79a7c6b507dc2ee39d45072833582812928d1b
7
+ data.tar.gz: 832270b58285a20fd5952d5e8ff6c97418d55b2548abb8cd584c4ada48ea8d47df73869e45aa9701589bdcb9fd2eca633019f54c4a0c867bb9239353b8a70a0d
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.54"
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.54
4
+ version: 0.4.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adoniyas