deep_unrest 0.1.71 → 0.1.72
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deep_unrest/authorization/pundit_strategy.rb +11 -4
- data/lib/deep_unrest/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: 66699a186572baa00ca20f983f1fe7462ee35e59785c2c73d98a9d4502036890
|
4
|
+
data.tar.gz: 29406a1d5a62da44de4a744f8cc55c99d74e0d186f5c44459f067ce02e38e302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60c92b8c2f70f1c1e83e28666e01244f1db911c1dd49889f3b38961da959afc71bbd333dddc71fcdf7c07a804d463c9bb91786c5a01742c1524bfbd339f13990
|
7
|
+
data.tar.gz: 6423c1817958c40e37fa27eac897acf599d43131de15c60e05279502df269e8cdc94e969c56156cb9ab673795d9f234939c398341f84d5058a241901d7c1e7f7
|
@@ -17,12 +17,19 @@ module DeepUnrest
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.auth_error_message(user, scope)
|
20
|
-
|
21
|
-
|
20
|
+
if user
|
21
|
+
actor = "#{user.class.name} with id '#{user.id}' is"
|
22
|
+
else
|
23
|
+
actor = "Anonymous users are"
|
24
|
+
end
|
25
|
+
|
26
|
+
target = (scope[:type] || scope[:key]).to_s.classify
|
22
27
|
unless %i[create update_all].include? scope[:scope_type]
|
23
|
-
|
28
|
+
target_id = (scope[:id] || scope.dig(:query, :id)).to_s.gsub('.', '')
|
29
|
+
target += " with id '#{target_id.to_s.gsub('.', '')}'"
|
24
30
|
end
|
25
|
-
|
31
|
+
|
32
|
+
msg = "#{actor} not authorized to #{scope[:scope_type].to_s.downcase} #{target}"
|
26
33
|
|
27
34
|
[{ title: msg,
|
28
35
|
source: { pointer: scope[:path] } }].to_json
|
data/lib/deep_unrest/version.rb
CHANGED