bscf-core 0.5.0 → 0.5.2

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: 225894f65a8e151960ff603ac227cc575754eae6ab1c146ee20542091fa129a5
4
- data.tar.gz: e9f6a8a6f912ef97dcfe6fc718deae1204d26a17a93995abc369604b6fa4aab2
3
+ metadata.gz: 6255829ced53f0037ef89fbdd21e174278e45e529177aaa22b82273c52d0e99e
4
+ data.tar.gz: 020eaa10c3a76b98567cb07d83a839e2c5c9bb695f391e45d14a30580cc8f43e
5
5
  SHA512:
6
- metadata.gz: 3c1d6726242a8153d72662522730397733670e19ace435ac032521bfab747ee559bcdd9ae3a65d8480d80676a22e907b68504b1f2b6a8a1af76107c8da69e2f9
7
- data.tar.gz: 01ad96461f4a1f3de25e67b6b361079de48411cdb6748ffc9654040fc67db27bdbba1928e572ef1066ee875834ed73e6652154badf7d68a6a413f94624a8376b
6
+ metadata.gz: b512af848cd267c9e8aacabecb924b3644238d50ac521c5a83e7ac496db07c09fae19e8a71fa84856e53380124b188e36472c8688289615e97319376eef5a59a
7
+ data.tar.gz: 390a3268dd83adb8402ac5f5794e60cab41b9344af35098b3e71c21b0adfc7d6fb24dde068ea6665a5b3b298bf75675d392dc89e15a11ea7c4c4f53f47b41cb9
@@ -0,0 +1,26 @@
1
+ module Bscf
2
+ module Core
3
+ class ApplicationPolicy
4
+ attr_reader :user, :record
5
+
6
+ def initialize(user, record)
7
+ @user = user
8
+ @record = record
9
+ end
10
+
11
+ private
12
+
13
+ def admin?
14
+ user.user_roles.any? { |ur| ur.role.name == "Admin" }
15
+ end
16
+
17
+ def driver?
18
+ user.user_roles.any? { |ur| ur.role.name == "Driver" }
19
+ end
20
+
21
+ def user_role?
22
+ user.user_roles.any? { |ur| ur.role.name == "User" }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ module Bscf
2
+ module Core
3
+ class UserPolicy < Bscf::Core::ApplicationPolicy
4
+ def index?
5
+ admin?
6
+ end
7
+
8
+ def show?
9
+ admin?
10
+ end
11
+
12
+ def by_role?
13
+ admin?
14
+ end
15
+
16
+ def has_virtual_account?
17
+ true
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ module Bscf
2
+ module Core
3
+ class UserProfilePolicy < Bscf::Core::ApplicationPolicy
4
+ def show?
5
+ true
6
+ end
7
+
8
+ def update_kyc?
9
+ admin?
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module Bscf
2
+ module Core
3
+ class UserRolePolicy < Bscf::Core::ApplicationPolicy
4
+ def assign_driver?
5
+ admin?
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Bscf
2
2
  module Core
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bscf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
@@ -330,10 +330,10 @@ files:
330
330
  - app/models/bscf/core/virtual_account_transaction.rb
331
331
  - app/models/bscf/core/voucher.rb
332
332
  - app/models/bscf/core/wholesaler_product.rb
333
- - app/policies/application_policy.rb
334
- - app/policies/user_policy.rb
335
- - app/policies/user_profile_policy.rb
336
- - app/policies/user_role_policy.rb
333
+ - app/policies/bscf/core/application_policy.rb
334
+ - app/policies/bscf/core/user_policy.rb
335
+ - app/policies/bscf/core/user_profile_policy.rb
336
+ - app/policies/bscf/core/user_role_policy.rb
337
337
  - app/services/bscf/core/gebeta_maps_service.rb
338
338
  - app/services/bscf/core/token_service.rb
339
339
  - app/services/bscf/core/transaction_service.rb
@@ -1,22 +0,0 @@
1
- class ApplicationPolicy
2
- attr_reader :user, :record
3
-
4
- def initialize(user, record)
5
- @user = user
6
- @record = record
7
- end
8
-
9
- private
10
-
11
- def admin?
12
- user.user_roles.any? { |ur| ur.role.name == "Admin" }
13
- end
14
-
15
- def driver?
16
- user.user_roles.any? { |ur| ur.role.name == "Driver" }
17
- end
18
-
19
- def user_role?
20
- user.user_roles.any? { |ur| ur.role.name == "User" }
21
- end
22
- end
@@ -1,17 +0,0 @@
1
- class UserPolicy < ApplicationPolicy
2
- def index?
3
- admin?
4
- end
5
-
6
- def show?
7
- admin?
8
- end
9
-
10
- def by_role?
11
- admin?
12
- end
13
-
14
- def has_virtual_account?
15
- true
16
- end
17
- end
@@ -1,9 +0,0 @@
1
- class UserProfilePolicy < ApplicationPolicy
2
- def show?
3
- true
4
- end
5
-
6
- def update_kyc?
7
- admin?
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- class UserRolePolicy < ApplicationPolicy
2
- def assign_driver?
3
- admin?
4
- end
5
- end