dscf-credit 0.4.55 → 0.4.57
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/policies/dscf/credit/facilitator_application_policy.rb +1 -25
- data/db/seeds.rb +31 -0
- data/lib/dscf/credit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9dd97d9f175fb7a5ca199d3936aac923a3dade3a884f3104ede5b3e360ca9eec
|
|
4
|
+
data.tar.gz: ceef5ac266b5c3098cc04dd7fc2fd5aa1b42a96a454fe2b58e29cb5eb483fe3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 195cb6e222088619ac2fd418886f59045960f3b315aab843108284894ddad9d20e69bae9d1405ffde8bf974e9b1f5d498bf64c4feac8f43cdab8d04e796a4c46
|
|
7
|
+
data.tar.gz: 6c06c6031927a07554603dbe1030614a4e5cc195493dc2874ed796ad393b3e7baf41148a0c8547ab9c76576fb9ed89711521f6c7cf0fb692efc6f3dfc17672bc
|
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
module Dscf
|
|
2
2
|
module Credit
|
|
3
3
|
class FacilitatorApplicationPolicy < ApplicationPolicy
|
|
4
|
-
|
|
5
|
-
def resolve
|
|
6
|
-
return scope.none unless user.has_permission?(index_permission_code)
|
|
7
|
-
return scope.all if user.super_admin?
|
|
8
|
-
return scope.all if admin_role?
|
|
9
|
-
|
|
10
|
-
if user.has_role?("USER") || user.has_role?("FACILITATOR")
|
|
11
|
-
scope.where(user_id: user.id)
|
|
12
|
-
else
|
|
13
|
-
scope.none
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def bulk_create?
|
|
19
|
-
user.has_permission?("facilitator_applications.bulk_create")
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def owned_record?
|
|
23
|
-
if user.has_role?("USER") || user.has_role?("FACILITATOR")
|
|
24
|
-
record.user_id == user.id
|
|
25
|
-
else
|
|
26
|
-
true
|
|
27
|
-
end
|
|
28
|
-
end
|
|
4
|
+
|
|
29
5
|
end
|
|
30
6
|
end
|
|
31
7
|
end
|
data/db/seeds.rb
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
puts "Starting minimal DSCF Credit seed..."
|
|
2
2
|
|
|
3
|
+
puts "Seeding business types..."
|
|
4
|
+
if defined?(Dscf::Core::BusinessType)
|
|
5
|
+
wholesaler = Dscf::Core::BusinessType.find_or_create_by(name: 'wholesaler')
|
|
6
|
+
puts "✓ Business types created/found"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
puts "Registering dscf_credit permissions..."
|
|
4
11
|
if defined?(Dscf::Core::PermissionRegistry)
|
|
5
12
|
Dscf::Core::PermissionRegistry.register("dscf_credit") do
|
|
@@ -83,5 +90,29 @@ bunna_bank = Dscf::Credit::Bank.find_or_create_by!(registration_number: 'BUN001'
|
|
|
83
90
|
bank.status = 'active'
|
|
84
91
|
end
|
|
85
92
|
|
|
93
|
+
bunna_head_office = Dscf::Credit::BankBranch.find_or_create_by(bank: bunna_bank, branch_name: 'Head Office') do |branch|
|
|
94
|
+
branch.branch_code = 'BUN-HO-001'
|
|
95
|
+
branch.branch_address = 'Churchill Avenue, Addis Ababa'
|
|
96
|
+
branch.city = 'Addis Ababa'
|
|
97
|
+
branch.country = 'Ethiopia'
|
|
98
|
+
branch.contact_email = 'headoffice@bunnabank.com'
|
|
99
|
+
branch.contact_phone = '+251115510001'
|
|
100
|
+
branch.status = 'active'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if defined?(Dscf::Core::Business) && defined?(Dscf::Core::BusinessType)
|
|
104
|
+
business1 = Dscf::Core::Business.find_or_create_by(
|
|
105
|
+
user_id: admin_user.id,
|
|
106
|
+
business_type_id: wholesaler.id
|
|
107
|
+
) do |business|
|
|
108
|
+
business.name = 'Individual Trading Business'
|
|
109
|
+
business.description = 'Individual business for trading services'
|
|
110
|
+
business.contact_email = admin_user.email
|
|
111
|
+
business.contact_phone = admin_user.phone
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
puts "✓ Businesses created/found"
|
|
115
|
+
end
|
|
116
|
+
|
|
86
117
|
puts "✓ Bank created/found: #{bunna_bank.name}"
|
|
87
118
|
puts "Minimal seed completed successfully."
|
data/lib/dscf/credit/version.rb
CHANGED