pundit-resources 1.0.1 → 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
  SHA1:
3
- metadata.gz: 83ed65ad31c7f9d50aa2bc1fa4f7a1682f999b62
4
- data.tar.gz: 800f0caa6caf805f4245718f6e0b1ccec494ba42
3
+ metadata.gz: 6137d7adc753176bdf0b684e5030f9dd9863b1f8
4
+ data.tar.gz: edc5c2f2165be0020e305648decbcbeb80a72c12
5
5
  SHA512:
6
- metadata.gz: 5294401c2ed0c81a816c00b878f81a74af6875348645a4810b4c4acfed810ca29d726a548e33c6e049efdc95f0a34e3717d8b3cb73aa831ccc36f86ba2e951d1
7
- data.tar.gz: 51a8ddcf155a373252a159ef3694a982bd8fb4e47a920b212dfd1f436a8ba892f815b8e226f2f1454d8cd0a7b0748e6e8c635594c0d3bad9e521d700439e0e73
6
+ metadata.gz: 45e3b829bcf02ea33640597469b9a4e440505ec6419f705d430f2523fbeff622dfaaca11205611a743358daf08f84306005f7670a29f62158dc267353189e9fa
7
+ data.tar.gz: 3ec8f3504f1debe139b6ebfd3f5594af521c2d0ef0cdb0432ffd0cc1f48c74ba69deef79fc4da3d934ab735fd717464023e66cccfaa091fc786aa1fe91921413
@@ -5,6 +5,8 @@ module Pundit
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
+ define_jsonapi_resources_callbacks :policy_authorize
9
+
8
10
  before_save :authorize_create_or_update
9
11
  before_remove :authorize_destroy
10
12
  end
@@ -32,8 +34,10 @@ module Pundit
32
34
  protected
33
35
 
34
36
  def can(method)
35
- context[:policy_used]&.call
36
- policy.public_send(method)
37
+ run_callbacks :policy_authorize do
38
+ context[:policy_used]&.call
39
+ policy.public_send(method)
40
+ end
37
41
  end
38
42
 
39
43
  def current_user
@@ -1,5 +1,5 @@
1
1
  module Pundit
2
2
  module Resources
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pundit-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Penman