kitty_policy 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -6
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/kitty_policy/graphql/field_authorization.rb +11 -0
- data/lib/kitty_policy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bb0e98df928a03bb4e18761f8e23e7b7868da05d15bb70f81425d76f936da1
|
4
|
+
data.tar.gz: 6a00a72433c6cc7016f5d62427395d52914bab78fea76e2cdd1faf3b6f526924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc35eeb00ba8e1ec5d43ed4a20fa710fc2e1c347dea3d3f8424809f8eaf5a80300a99bb760d08660cb3ae5a9a32909fd61e6e2336bf95df27af3fdc59f5219ee
|
7
|
+
data.tar.gz: 81905f36f0b2cc4f2b007b53b5599d05f9be8777818a713706ec93c687fad1fcb76a9f49f27a651c2542e1323c4e389219ea2129e870b0e2d5f97a93d9bd7c2a
|
data/.rubocop.yml
CHANGED
@@ -15,8 +15,8 @@ Style/PercentLiteralDelimiters:
|
|
15
15
|
'%w': '()'
|
16
16
|
'%r': '()'
|
17
17
|
|
18
|
-
LineLength:
|
19
|
-
Max:
|
18
|
+
Layout/LineLength:
|
19
|
+
Max: 150
|
20
20
|
|
21
21
|
Metrics/MethodLength:
|
22
22
|
Max: 20
|
@@ -24,7 +24,10 @@ Metrics/MethodLength:
|
|
24
24
|
Metrics/AbcSize:
|
25
25
|
Max: 40
|
26
26
|
|
27
|
-
|
27
|
+
Metrics/BlockLength:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/Documentation:
|
28
31
|
Enabled: false
|
29
32
|
|
30
33
|
Style/ModuleFunction:
|
@@ -51,9 +54,6 @@ Style/TrailingCommaInArguments:
|
|
51
54
|
Style/DoubleNegation:
|
52
55
|
Enabled: false
|
53
56
|
|
54
|
-
BlockLength:
|
55
|
-
Enabled: false
|
56
|
-
|
57
57
|
RSpec/MultipleExpectations:
|
58
58
|
Enabled: false
|
59
59
|
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -20,6 +20,17 @@ module KittyPolicy
|
|
20
20
|
|
21
21
|
if policy.can?(context[current_user_key], field.metadata[:authorize], object)
|
22
22
|
old_resolve.call(type_or_object, arguments, context)
|
23
|
+
elsif field.connection?
|
24
|
+
# NOTE(rstankov): When field is connection we need to wrap it with connection option as done here:
|
25
|
+
# https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/relay/connection_resolve.rb#L37-L38
|
26
|
+
#
|
27
|
+
# Normally GraphQL gem will handle this, however this instrument is bypassing it
|
28
|
+
nodes = field.metadata[:fallback]
|
29
|
+
|
30
|
+
parent = parent.is_a?(::GraphQL::Schema::Object) ? context.object.object : context.object
|
31
|
+
|
32
|
+
connection_class = ::GraphQL::Relay::BaseConnection.connection_for_nodes(nodes)
|
33
|
+
connection_class.new(nodes, arguments, field: field, max_page_size: field.connection_max_page_size, parent: parent, context: context)
|
23
34
|
else
|
24
35
|
field.metadata[:fallback]
|
25
36
|
end
|
data/lib/kitty_policy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitty_policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radoslav Stankov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|