action_policy-graphql 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +3 -0
- data/lib/action_policy/graphql/authorized_field.rb +6 -2
- data/lib/action_policy/graphql/behaviour.rb +1 -1
- data/lib/action_policy/graphql/version.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7642906ab346f7d8dbc1df8a74fb9c3357fc385920fc02cc2c0fcbf49b1ba94
|
4
|
+
data.tar.gz: 899162aa41e240bf9f5e09203faa4a53f4103a45a38cceba164b95e28cfb8f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 167d81b9844a337b023df20ccdad4a26272f04438449ada1b881e2bf162f3060fff04c80d512c75302b5fcc16a1ebbb8644eccac79d8e2119dde34b01a40dd64
|
7
|
+
data.tar.gz: b6c3ec027f5b686454a8d3fd7a20c546381c20b2d8ef59bc8a01f484ad0a42c481baf6db565b87c5596730c730f2cb8541547bf381a70584c9003c1a43a2d476
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.6.0 (2024-07-08)
|
6
|
+
|
7
|
+
- Fix compatibility with Action Policy 0.7.0. ([@palkan][])
|
8
|
+
|
9
|
+
## 0.5.4 (2023-12-22)
|
10
|
+
|
11
|
+
- Do not mutate passed field options. ([@palkan][])
|
12
|
+
|
13
|
+
Fixes compatibility with `with_options` approach.
|
14
|
+
|
5
15
|
## 0.5.3 (2021-02-26)
|
6
16
|
|
7
17
|
- Fix compatibility with graphql-ruby 1.12.4 ([@haines][])
|
@@ -80,3 +90,4 @@ Action Policy helpers there.
|
|
80
90
|
[@haines]: https://github.com/haines
|
81
91
|
[@sponomarev]: https://github.com/sponomarev
|
82
92
|
[@bibendi]: https://github.com/bibendi
|
93
|
+
[@rzaharenkov]: https://github.com/rzaharenkov
|
data/README.md
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
|
6
6
|
# Action Policy GraphQL
|
7
7
|
|
8
|
+
<img align="right" height="150" width="129"
|
9
|
+
title="Action Policy logo" src="./assets/logo.svg">
|
10
|
+
|
8
11
|
This gem provides an integration for using [Action Policy](https://github.com/palkan/action_policy) as an authorization framework for GraphQL applications (built with [`graphql` ruby gem](https://graphql-ruby.org)).
|
9
12
|
|
10
13
|
This integration includes the following features:
|
@@ -14,6 +14,10 @@ module ActionPolicy
|
|
14
14
|
# end
|
15
15
|
module AuthorizedField
|
16
16
|
class Extension < ::GraphQL::Schema::FieldExtension
|
17
|
+
def initialize(field:, options:)
|
18
|
+
super(field: field, options: options&.dup || {})
|
19
|
+
end
|
20
|
+
|
17
21
|
def extract_option(key, &default)
|
18
22
|
value = options.fetch(key, &default)
|
19
23
|
options.delete key
|
@@ -109,7 +113,7 @@ module ActionPolicy
|
|
109
113
|
private
|
110
114
|
|
111
115
|
def underscored_field_name
|
112
|
-
"#{field.instance_variable_get(:@underscored_name)}?"
|
116
|
+
:"#{field.instance_variable_get(:@underscored_name)}?"
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
@@ -128,7 +132,7 @@ module ActionPolicy
|
|
128
132
|
"options could be specified. You can use `preauthorize` or `authorize_field` along with scoping"
|
129
133
|
end
|
130
134
|
|
131
|
-
if !!authorize == !!preauthorize ? authorize : authorize_field
|
135
|
+
if (!!authorize == !!preauthorize) ? authorize : authorize_field
|
132
136
|
raise ArgumentError, "Only one of `authorize`, `preauthorize` or `authorize_field` " \
|
133
137
|
"options could be specified."
|
134
138
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_policy-graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: action_policy
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: '0.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-next-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: graphql
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,28 +70,28 @@ dependencies:
|
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '13.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.8'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.8'
|
97
97
|
- !ruby/object:Gem::Dependency
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
153
|
+
rubygems_version: 3.4.19
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Action Policy integration for GraphQL-Ruby
|