action_policy-graphql 0.3.0 → 0.3.1

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: af986a07ebe7dbdfa82c22e7c5977562fe950297e9d7a1a73f3b3350df2985e7
4
- data.tar.gz: 1c9f5b334f632827e9221b327fe622d91be5f92c871f6fb4807a397a73984735
3
+ metadata.gz: a36627f17b3f0ed75370d60052cfc7f62fff25520c9bb58ba98289c1f3480903
4
+ data.tar.gz: 45f7c8b1e3a2401113f90fa3b5cf002f6efba4647a9df98209b77c4123691100
5
5
  SHA512:
6
- metadata.gz: 7d98d44c4c349789b58d463dc1b447e9181f6fadcdd5a3e09b7c47835b4b9a154b000e5c39ac96cce98a8e09e91e1560a4bb8a6d3263753a59362bd352102692
7
- data.tar.gz: 6aad6769bbea6aae1137b158a6c54d6f12742a443227f43de6ad28471ce2add320349a671c196dada9d304238f2bdaa8ab201437b526e8cb6a51d9ccc31fbf4c
6
+ metadata.gz: 800c62024be3fb01378ebe900e62bd5fbc9343f27857dfa4c20125dd007ce6260e037599880df2e3d97cdab136466c272f6d3756f994595d46b4dbd3514ed330
7
+ data.tar.gz: 37287ca3abcf008b787f8b9e504db6f4f396f22e4aab5c628524b8d2f543f99e043730ff2ec7455dbce106c7820578040576275e85f546d80f2ea0671d1fd642
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.3.1 (2019-10-23)
6
+
7
+ - Add support for using Action Policy methods in `self.authorized?`. ([@palkan][])
8
+
5
9
  ## 0.3.0 (2019-10-21)
6
10
 
7
11
  - Add `preauthorize: *` option to perform authorization prior to resolving fields. ([@palkan][])
@@ -6,6 +6,28 @@ require "action_policy/graphql/authorized_field"
6
6
  module ActionPolicy
7
7
  module GraphQL
8
8
  module Behaviour
9
+ require "action_policy/ext/module_namespace"
10
+ using ActionPolicy::Ext::ModuleNamespace
11
+
12
+ # When used with self.authorized?
13
+ def self.extended(base)
14
+ base.extend ActionPolicy::Behaviour
15
+ base.extend ActionPolicy::Behaviours::ThreadMemoized
16
+ base.extend ActionPolicy::Behaviours::Memoized
17
+ base.extend ActionPolicy::Behaviours::Namespaced
18
+
19
+ # Authorization context could't be defined for the class
20
+ def base.authorization_context
21
+ {}
22
+ end
23
+
24
+ # Override authorization_namespace to use the class itself
25
+ def base.authorization_namespace
26
+ return @authorization_namespace if instance_variable_defined?(:@authorization_namespace)
27
+ @authorization_namespace = namespace
28
+ end
29
+ end
30
+
9
31
  def self.included(base)
10
32
  base.include ActionPolicy::Behaviour
11
33
  base.include ActionPolicy::Behaviours::ThreadMemoized
@@ -18,6 +40,8 @@ module ActionPolicy
18
40
  base.field_class.prepend(ActionPolicy::GraphQL::AuthorizedField)
19
41
  base.include ActionPolicy::GraphQL::Fields
20
42
  end
43
+
44
+ base.extend self
21
45
  end
22
46
 
23
47
  def current_user
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActionPolicy
4
4
  module GraphQL
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_policy-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-21 00:00:00.000000000 Z
11
+ date: 2019-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: action_policy