nexus_cqrs_auth 1.0.0 → 1.1.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94d379370fd1bbf839449f70e7e1cd89c9b25329b676c1677af766fa367f0c50
|
|
4
|
+
data.tar.gz: e4d381029b3088546bee61e8cfa025c186389d9f45a2dc41cc115f0ccc101f24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87b9c424f4f467ffcd0ea920055f38233ba76b0fb44347efb02b9c8673fbac46117b4b81509dc97c475451f0d68fd36125fd8590dc8ad60bbababdc853e16163
|
|
7
|
+
data.tar.gz: 17a6d172b728387267afe182d2259b7d76000fd9a9486619265046704d265e02b8bbbf7b9482bf9222ad72e9e670d2aa2169fb22be8f92e2aa09cb6a551781a2
|
|
@@ -14,6 +14,12 @@ module NexusCqrsAuth
|
|
|
14
14
|
super_
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Helper method for creating a permissions provider object from a query object. This allows certain permissions
|
|
18
|
+
# to be checked inside the command handler, as opposed to inside the policy
|
|
19
|
+
def permission_provider(query)
|
|
20
|
+
PermissionProvider.new(query.metadata[:current_user], query.metadata[:global_permissions])
|
|
21
|
+
end
|
|
22
|
+
|
|
17
23
|
def pundit_user
|
|
18
24
|
UserContext.new(@command_user, @global_permissions)
|
|
19
25
|
end
|
|
@@ -12,6 +12,8 @@ module NexusCqrsAuth
|
|
|
12
12
|
# has_permission? 'collection:edit', CollectionPermission, collection.id
|
|
13
13
|
#
|
|
14
14
|
def has_permission?(permission_key, permission_model = nil, entity_id = nil)
|
|
15
|
+
return false if @user_id.nil?
|
|
16
|
+
|
|
15
17
|
return true if @global_permissions.include?(permission_key)
|
|
16
18
|
|
|
17
19
|
# check entity-specific permissions
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nexus_cqrs_auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Harrison
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-10-
|
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nexus_cqrs
|