jsonapi-authorization 0.4.0 → 0.5.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: af758844e145dc016dca6a62a4ff24aa6875dec6
4
- data.tar.gz: c2db139f822d5715e89eb7d4765155df6f6fbb04
3
+ metadata.gz: 29b3ceafd8c61b2dfe1d2ac684714569d8cb70a2
4
+ data.tar.gz: 5fc76942b71575e6cfd4b0700c0d26572d681c65
5
5
  SHA512:
6
- metadata.gz: af34e3b306341ea6f0871f7bb56013183aa555fe7e6bb3a4d67a21ae2b6d1f3851b6d852fb5c6ae09671dba5db06f713b11ecf912cb168c0367be8f906ac1720
7
- data.tar.gz: 40e7c48af85cf62f14451836c0fa2b14da5710e29beb475b625dd8df42a347b5413a49c91db0750682c8beecb1aabf767ae8d6cb28db9ec3ade26dd66165112d
6
+ metadata.gz: 037b2a7cb5a7418d18c848a0044ca1c93d81386c897253713137323221ebdfdedc9b69609d0e177299939ce0b83ce2ab541bad9a53ffa29a3a72750483ce19e8
7
+ data.tar.gz: 51fb54f0056bfedd6caf847cd00012cf1c45cc04897004c4e6546c78d25fa38177fcfbf1e7e02f0ff17b293679bfea85f88d9b67e490f2883c9f35a1db0b04ae
data/README.md CHANGED
@@ -31,11 +31,11 @@ Make sure you have a Pundit policy specified for every backing model that your J
31
31
 
32
32
  ```ruby
33
33
  JSONAPI.configure do |config|
34
- config.operations_processor = '::JSONAPI::Authorization::Pundit'
34
+ config.operations_processor = :jsonapi_authorization
35
35
  end
36
36
  ```
37
37
 
38
- Make all your JR controllers specify the following in the `context`:
38
+ Make all your JR controllers specify the user in the `context` if you are using the default authorizer class (see [Configuration](#configuration) below):
39
39
 
40
40
  ```ruby
41
41
  class BaseResourceController < ActionController::Base
@@ -44,7 +44,7 @@ class BaseResourceController < ActionController::Base
44
44
  private
45
45
 
46
46
  def context
47
- {user: current_user, action: action_name}
47
+ {user: current_user}
48
48
  end
49
49
  end
50
50
  ```
@@ -2,7 +2,7 @@ require 'pundit'
2
2
 
3
3
  module JSONAPI
4
4
  module Authorization
5
- class PunditOperationsProcessor < ::ActiveRecordOperationsProcessor
5
+ class AuthorizingOperationsProcessor < ::ActiveRecordOperationsProcessor
6
6
  set_callback :find_operation, :before, :authorize_find
7
7
  set_callback :show_operation, :before, :authorize_show
8
8
  set_callback :show_relationship_operation, :before, :authorize_show_relationship
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Authorization
3
- VERSION = "0.4.0".freeze
3
+ VERSION = "0.5.0".freeze
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  require "jsonapi-resources"
2
+ require "jsonapi/authorization/authorizing_operations_processor"
2
3
  require "jsonapi/authorization/configuration"
3
4
  require "jsonapi/authorization/default_pundit_authorizer"
4
- require "jsonapi/authorization/pundit_operations_processor"
5
5
  require "jsonapi/authorization/pundit_scoped_resource"
6
6
  require "jsonapi/authorization/version"
7
7
 
@@ -10,3 +10,6 @@ module JSONAPI
10
10
  # Your code goes here...
11
11
  end
12
12
  end
13
+
14
+ # Allows JSONAPI configuration of operations_processor using the symbol :jsonapi_authorization
15
+ JsonapiAuthorizationOperationsProcessor = JSONAPI::Authorization::AuthorizingOperationsProcessor
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vesa Laakso
@@ -174,9 +174,9 @@ files:
174
174
  - jsonapi-authorization.gemspec
175
175
  - lib/jsonapi-authorization.rb
176
176
  - lib/jsonapi/authorization.rb
177
+ - lib/jsonapi/authorization/authorizing_operations_processor.rb
177
178
  - lib/jsonapi/authorization/configuration.rb
178
179
  - lib/jsonapi/authorization/default_pundit_authorizer.rb
179
- - lib/jsonapi/authorization/pundit_operations_processor.rb
180
180
  - lib/jsonapi/authorization/pundit_scoped_resource.rb
181
181
  - lib/jsonapi/authorization/version.rb
182
182
  homepage: https://github.com/venuu/jsonapi-authorization