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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b194593cf43cb152738a7a45f748af7ebebcdc8e1eef0e65cb4e66cb5afead0b
4
- data.tar.gz: c64a30a21918ad72e44269e652962ac73c11129b7a43b8ae8fe430e1ff081dd9
3
+ metadata.gz: 66699a186572baa00ca20f983f1fe7462ee35e59785c2c73d98a9d4502036890
4
+ data.tar.gz: 29406a1d5a62da44de4a744f8cc55c99d74e0d186f5c44459f067ce02e38e302
5
5
  SHA512:
6
- metadata.gz: 0cbc2b6412e32c94173f074d205d5d04b8b24f50acaa036e5ec6aa9faa70edda2cd5811ee9b07dfc72e5e1dae59b7b8386a97a83f53cf6bca989d005cffff1d4
7
- data.tar.gz: 206e06dbbb0fa9991acb0ac8dac8ce14f2348b7aa57d7cb79688312d3c0f073ede6570605e1db49f216b1ae52e9225ce1879d6b3a4cba9c77e0be87ad2136277
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
- actor = "#{user.class.name} with id '#{user.id}'"
21
- target = scope[:type].classify
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
- target += " with id '#{scope[:scope][:arguments].first}'"
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
- msg = "#{actor} is not authorized to #{scope[:scope_type]} #{target}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepUnrest
4
- VERSION = '0.1.71'
4
+ VERSION = '0.1.72'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_unrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.71
4
+ version: 0.1.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley