action_policy-graphql 0.3.0 → 0.5.1
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 +4 -4
- data/CHANGELOG.md +46 -0
- data/README.md +36 -8
- data/lib/action_policy-graphql.rb +1 -0
- data/lib/action_policy/graphql.rb +21 -0
- data/lib/action_policy/graphql/authorized_field.rb +77 -21
- data/lib/action_policy/graphql/behaviour.rb +25 -1
- data/lib/action_policy/graphql/fields.rb +6 -15
- data/lib/action_policy/graphql/version.rb +1 -1
- metadata +22 -60
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -54
- data/.travis.yml +0 -33
- data/Gemfile +0 -16
- data/Rakefile +0 -10
- data/action_policy-graphql.gemspec +0 -44
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/gemfiles/graphqlmaster.gemfile +0 -5
- data/gemfiles/jruby.gemfile +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb2f4793062ddef25c116e0591d97613174a3c39e18a62e7982f4a41d9f9afc1
|
4
|
+
data.tar.gz: 2e776a3a49781309094a4cee8d3824391913b57d5fcdef64edc6425eb476b280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02980395258ccf616d7508d24615d54162045e2f9abbea4cebcdd5d8976a19213f04ca8b0a7775fe99b03741ea91213dbe27e3e0994ae645e1656abb76212cd
|
7
|
+
data.tar.gz: 892b01138e996004cd1a218e06af56435f0f6cd662af14b295fa4162204da350d8a4fb2d192d014b30bd06f9f1e8798f580f272a203fbdbc75813e107463ac14
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,49 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.5.1 (2020-10-08)
|
6
|
+
|
7
|
+
- Fix mutations authorization (clean up around `authorize_mutation_raise_exception` configuration parameter). ([@rzaharenkov][])
|
8
|
+
|
9
|
+
- Add deprecation for using `authorize` for mutation fields. ([@rzaharenkov][])
|
10
|
+
|
11
|
+
## 0.5.0 (2020-10-07)
|
12
|
+
|
13
|
+
- Add `preauthorize_mutation_raise_exception` configuration parameter. ([@palkan][])
|
14
|
+
|
15
|
+
Similar to `preauthorize_raise_exception` but only for mutations.
|
16
|
+
Fallbacks to `preauthorize_raise_exception` unless explicitly specified.
|
17
|
+
|
18
|
+
- Add `preauthorize_raise_exception` configuration parameter. ([@palkan][])
|
19
|
+
|
20
|
+
Similar to `authorize_raise_exception` but for `preauthorize: true` fields.
|
21
|
+
Fallbacks to `authorize_raise_exception` unless explicitly specified.
|
22
|
+
|
23
|
+
- Add ability to specify custom field options for `expose_authorization_rules`. ([@bibendi][])
|
24
|
+
|
25
|
+
Now you can add additional options for underflying `field` call via `field_options` parameter:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
expose_authorization_rules :show?, field_options: {camelize: false}
|
29
|
+
|
30
|
+
# equals to
|
31
|
+
field :can_show, ActionPolicy::GraphQL::Types::AuthorizationResult, null: false, camelize: false
|
32
|
+
```
|
33
|
+
|
34
|
+
## 0.4.0 (2020-03-11)
|
35
|
+
|
36
|
+
- **Require Ruby 2.5+**. ([@palkan][])
|
37
|
+
|
38
|
+
- Add `authorized_field: *` option to perform authorization on the base of the upper object policy prior to resolving fields. ([@sponomarev][])
|
39
|
+
|
40
|
+
## 0.3.2 (2019-12-12)
|
41
|
+
|
42
|
+
- Fix compatibility with Action Policy 0.4.0 ([@haines][])
|
43
|
+
|
44
|
+
## 0.3.1 (2019-10-23)
|
45
|
+
|
46
|
+
- Add support for using Action Policy methods in `self.authorized?`. ([@palkan][])
|
47
|
+
|
5
48
|
## 0.3.0 (2019-10-21)
|
6
49
|
|
7
50
|
- Add `preauthorize: *` option to perform authorization prior to resolving fields. ([@palkan][])
|
@@ -26,3 +69,6 @@ Action Policy helpers there.
|
|
26
69
|
- Initial version. ([@palkan][])
|
27
70
|
|
28
71
|
[@palkan]: https://github.com/palkan
|
72
|
+
[@haines]: https://github.com/haines
|
73
|
+
[@sponomarev]: https://github.com/sponomarev
|
74
|
+
[@bibendi]: https://github.com/bibendi
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://badge.fury.io/rb/action_policy-graphql)
|
2
|
-
|
2
|
+

|
3
|
+

|
3
4
|
[](https://actionpolicy.evilmartians.io/#/graphql)
|
4
5
|
|
5
6
|
# Action Policy GraphQL
|
@@ -7,6 +8,7 @@
|
|
7
8
|
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)).
|
8
9
|
|
9
10
|
This integration includes the following features:
|
11
|
+
|
10
12
|
- Fields & mutations authorization
|
11
13
|
- List and connections scoping
|
12
14
|
- [**Exposing permissions/authorization rules in the API**](https://evilmartians.com/chronicles/exposing-permissions-in-graphql-apis-with-action-policy).
|
@@ -21,13 +23,9 @@ This integration includes the following features:
|
|
21
23
|
Add this line to your application's Gemfile:
|
22
24
|
|
23
25
|
```ruby
|
24
|
-
gem "action_policy-graphql"
|
26
|
+
gem "action_policy-graphql"
|
25
27
|
```
|
26
28
|
|
27
|
-
And then execute:
|
28
|
-
|
29
|
-
$ bundle
|
30
|
-
|
31
29
|
## Usage
|
32
30
|
|
33
31
|
**NOTE:** this is a quick overview of the functionality provided by the gem. For more information see the [documentation](https://actionpolicy.evilmartians.io/#/graphql).
|
@@ -80,6 +78,10 @@ end
|
|
80
78
|
|
81
79
|
You can customize the authorization options, e.g. `authorize: {to: :preview?, with: CustomPolicy}`.
|
82
80
|
|
81
|
+
If you don't want to raise an exception but return a null instead, you should set a `raise: false` option.
|
82
|
+
|
83
|
+
Note: it does not make too much sense to use `authorize` in mutations since it's checking authorization rules after mutation is executed. Therefore `authorize` marked as deprecated when used in mutations and will raise error in future releases.
|
84
|
+
|
83
85
|
### `authorized_scope: *`
|
84
86
|
|
85
87
|
You can add `authorized_scope: true` option to the field (list or _connection_ field) to
|
@@ -96,7 +98,7 @@ class CityType < ::Common::Graphql::Type
|
|
96
98
|
end
|
97
99
|
```
|
98
100
|
|
99
|
-
**NOTE:** you cannot use `authorize: *` and `authorized_scope: *` at the same time but you can combine `preauthorize: *` with `authorized_scope: *`.
|
101
|
+
**NOTE:** you cannot use `authorize: *` and `authorized_scope: *` at the same time but you can combine `preauthorize: *` or `authorize_field: *` with `authorized_scope: *`.
|
100
102
|
|
101
103
|
### `preauthorize: *`
|
102
104
|
|
@@ -124,7 +126,7 @@ end
|
|
124
126
|
**NOTE:** we pass the field's name as the `record` to the policy rule. We assume that preauthorization rules do not depend on
|
125
127
|
the record itself and pass the field's name for debugging purposes only.
|
126
128
|
|
127
|
-
You can customize the authorization options, e.g. `
|
129
|
+
You can customize the authorization options, e.g. `preauthorize: {to: :preview?, with: CustomPolicy}`.
|
128
130
|
|
129
131
|
**NOTE:** unlike `authorize: *` you MUST specify the `with: SomePolicy` option.
|
130
132
|
The default authorization rule depends on the type of the field:
|
@@ -132,6 +134,32 @@ The default authorization rule depends on the type of the field:
|
|
132
134
|
- for lists we use `index?` (configured by `ActionPolicy::GraphQL.default_preauthorize_list_rule` parameter)
|
133
135
|
- for _singleton_ fields we use `show?` (configured by `ActionPolicy::GraphQL.default_preauthorize_node_rule` parameter)
|
134
136
|
|
137
|
+
### `authorize_field: *`
|
138
|
+
|
139
|
+
If you want to perform authorization before resolving the field value _on the base of the upper object_, you can use `authorize_field: *` option:
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
field :homes, Home, null: false, authorize_field: true
|
143
|
+
|
144
|
+
def homes
|
145
|
+
Home.all
|
146
|
+
end
|
147
|
+
```
|
148
|
+
|
149
|
+
The code above is equal to:
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
field :homes, [Home], null: false
|
153
|
+
|
154
|
+
def homes
|
155
|
+
authorize! object, to: :homes?
|
156
|
+
Home.all
|
157
|
+
end
|
158
|
+
```
|
159
|
+
By default we use `#{underscored_field_name}?` authorization rule.
|
160
|
+
|
161
|
+
You can customize the authorization options, e.g. `authorize_field: {to: :preview?, with: CustomPolicy}`.
|
162
|
+
|
135
163
|
### `expose_authorization_rules`
|
136
164
|
|
137
165
|
You can add permissions/authorization exposing fields to "tell" clients which actions could be performed against the object or not (and why).
|
@@ -30,12 +30,33 @@ module ActionPolicy
|
|
30
30
|
# Which prefix to use for authorization fields
|
31
31
|
# Defaults to `"can_"`
|
32
32
|
attr_accessor :default_authorization_field_prefix
|
33
|
+
|
34
|
+
attr_writer :preauthorize_raise_exception
|
35
|
+
|
36
|
+
# Whether to raise an exception if preauthorization fails
|
37
|
+
# Equals to authorize_raise_exception unless explicitly set
|
38
|
+
def preauthorize_raise_exception
|
39
|
+
return authorize_raise_exception if @preauthorize_raise_exception.nil?
|
40
|
+
@preauthorize_raise_exception
|
41
|
+
end
|
42
|
+
|
43
|
+
# Whether to raise an exception if preauthorization fails
|
44
|
+
# Equals to preauthorize_raise_exception unless explicitly set
|
45
|
+
attr_writer :preauthorize_mutation_raise_exception
|
46
|
+
|
47
|
+
def preauthorize_mutation_raise_exception
|
48
|
+
return preauthorize_raise_exception if @preauthorize_mutation_raise_exception.nil?
|
49
|
+
|
50
|
+
@preauthorize_mutation_raise_exception
|
51
|
+
end
|
33
52
|
end
|
34
53
|
|
35
54
|
self.default_authorize_rule = :show?
|
36
55
|
self.default_preauthorize_list_rule = :index?
|
37
56
|
self.default_preauthorize_node_rule = :show?
|
38
57
|
self.authorize_raise_exception = true
|
58
|
+
self.preauthorize_raise_exception = nil
|
59
|
+
self.preauthorize_mutation_raise_exception = nil
|
39
60
|
self.default_authorization_field_prefix = "can_"
|
40
61
|
end
|
41
62
|
end
|
@@ -13,52 +13,107 @@ module ActionPolicy
|
|
13
13
|
# field :comments, null: false, authorized: { type: :relation, with: MyPostPolicy }
|
14
14
|
# end
|
15
15
|
module AuthorizedField
|
16
|
-
class
|
17
|
-
def
|
18
|
-
|
19
|
-
options
|
20
|
-
|
16
|
+
class Extension < ::GraphQL::Schema::FieldExtension
|
17
|
+
def extract_option(key, &default)
|
18
|
+
value = options.fetch(key, &default)
|
19
|
+
options.delete key
|
20
|
+
value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class AuthorizeExtension < Extension
|
25
|
+
DEPRECATION_MESSAGE = "`authorize: *` for mutation fields is deprecated. Please use `preauthorize: *` instead."
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def show_authorize_mutation_deprecation
|
29
|
+
return if defined?(@authorize_mutation_deprecation_shown)
|
30
|
+
|
31
|
+
if defined?(ActiveSupport::Deprecation)
|
32
|
+
ActiveSupport::Deprecation.warn(DEPRECATION_MESSAGE)
|
33
|
+
else
|
34
|
+
warn(DEPRECATION_MESSAGE)
|
35
|
+
end
|
36
|
+
|
37
|
+
@authorize_mutation_deprecation_shown = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def apply
|
42
|
+
self.class.show_authorize_mutation_deprecation if field.mutation
|
43
|
+
|
44
|
+
@to = extract_option(:to) { ::ActionPolicy::GraphQL.default_authorize_rule }
|
45
|
+
@raise = extract_option(:raise) { ::ActionPolicy::GraphQL.authorize_raise_exception }
|
21
46
|
end
|
22
47
|
|
23
48
|
def after_resolve(value:, context:, object:, **_rest)
|
24
49
|
return value if value.nil?
|
25
50
|
|
26
|
-
if
|
27
|
-
object.authorize! value, **options
|
51
|
+
if @raise
|
52
|
+
object.authorize! value, to: @to, **options
|
28
53
|
value
|
29
54
|
else
|
30
|
-
object.allowed_to?(
|
55
|
+
object.allowed_to?(@to, value, **options) ? value : nil
|
31
56
|
end
|
32
57
|
end
|
33
58
|
end
|
34
59
|
|
35
|
-
class PreauthorizeExtension <
|
36
|
-
def
|
37
|
-
super
|
60
|
+
class PreauthorizeExtension < Extension
|
61
|
+
def apply
|
38
62
|
if options[:with].nil?
|
39
63
|
raise ArgumentError, "You must specify the policy for preauthorization: " \
|
40
64
|
"`field :#{field.name}, preauthorize: {with: SomePolicy}`"
|
41
65
|
end
|
42
|
-
|
66
|
+
|
67
|
+
@to = extract_option(:to) do
|
43
68
|
if field.type.list?
|
44
69
|
::ActionPolicy::GraphQL.default_preauthorize_list_rule
|
45
70
|
else
|
46
71
|
::ActionPolicy::GraphQL.default_preauthorize_node_rule
|
47
72
|
end
|
48
|
-
|
73
|
+
end
|
74
|
+
|
75
|
+
@raise = extract_option(:raise) do
|
76
|
+
if field.mutation
|
77
|
+
::ActionPolicy::GraphQL.preauthorize_mutation_raise_exception
|
78
|
+
else
|
79
|
+
::ActionPolicy::GraphQL.preauthorize_raise_exception
|
80
|
+
end
|
81
|
+
end
|
49
82
|
end
|
50
83
|
|
51
84
|
def resolve(context:, object:, arguments:, **_rest)
|
52
|
-
if
|
53
|
-
object.authorize! field.name, **options
|
85
|
+
if @raise
|
86
|
+
object.authorize! field.name, to: @to, **options
|
54
87
|
yield object, arguments
|
55
|
-
elsif object.allowed_to?(
|
88
|
+
elsif object.allowed_to?(@to, field.name, **options)
|
56
89
|
yield object, arguments
|
57
90
|
end
|
58
91
|
end
|
59
92
|
end
|
60
93
|
|
61
|
-
class
|
94
|
+
class AuthorizeFieldExtension < Extension
|
95
|
+
def apply
|
96
|
+
@to = extract_option(:to) { underscored_field_name }
|
97
|
+
@raise = extract_option(:raise) { ::ActionPolicy::GraphQL.authorize_raise_exception }
|
98
|
+
end
|
99
|
+
|
100
|
+
def resolve(context:, object:, arguments:, **_rest)
|
101
|
+
if @raise
|
102
|
+
object.authorize! object.object, to: @to, **options
|
103
|
+
yield object, arguments
|
104
|
+
elsif object.allowed_to?(@to, object.object, **options)
|
105
|
+
yield object, arguments
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def underscored_field_name
|
112
|
+
"#{field.instance_variable_get(:@underscored_name)}?".to_sym
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
class ScopeExtension < Extension
|
62
117
|
def after_resolve(value:, context:, object:, **_rest)
|
63
118
|
return value if value.nil?
|
64
119
|
|
@@ -66,14 +121,14 @@ module ActionPolicy
|
|
66
121
|
end
|
67
122
|
end
|
68
123
|
|
69
|
-
def initialize(*args, preauthorize: nil, authorize: nil, authorized_scope: nil, **kwargs, &block)
|
124
|
+
def initialize(*args, preauthorize: nil, authorize: nil, authorized_scope: nil, authorize_field: nil, **kwargs, &block)
|
70
125
|
if authorize && authorized_scope
|
71
126
|
raise ArgumentError, "Only one of `authorize` and `authorized_scope` " \
|
72
|
-
"options could be specified. You can use `preauthorize` along with scoping"
|
127
|
+
"options could be specified. You can use `preauthorize` or `authorize_field` along with scoping"
|
73
128
|
end
|
74
129
|
|
75
|
-
if authorize
|
76
|
-
raise ArgumentError, "Only one of `authorize`
|
130
|
+
if !!authorize == !!preauthorize ? authorize : authorize_field
|
131
|
+
raise ArgumentError, "Only one of `authorize`, `preauthorize` or `authorize_field` " \
|
77
132
|
"options could be specified."
|
78
133
|
end
|
79
134
|
|
@@ -82,6 +137,7 @@ module ActionPolicy
|
|
82
137
|
add_extension! extensions, AuthorizeExtension, authorize
|
83
138
|
add_extension! extensions, ScopeExtension, authorized_scope
|
84
139
|
add_extension! extensions, PreauthorizeExtension, preauthorize
|
140
|
+
add_extension! extensions, AuthorizeFieldExtension, authorize_field
|
85
141
|
|
86
142
|
super(*args, **kwargs, &block)
|
87
143
|
end
|
@@ -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
|
@@ -14,10 +36,12 @@ module ActionPolicy
|
|
14
36
|
|
15
37
|
base.authorize :user, through: :current_user
|
16
38
|
|
17
|
-
if base.respond_to?(:field_class)
|
39
|
+
if base.respond_to?(:field_class) && !(base.field_class < ActionPolicy::GraphQL::AuthorizedField)
|
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
|
@@ -3,10 +3,7 @@
|
|
3
3
|
require "action_policy/graphql/types/authorization_result"
|
4
4
|
|
5
5
|
module ActionPolicy
|
6
|
-
|
7
|
-
require "action_policy/ext/yield_self_then"
|
8
|
-
using ActionPolicy::Ext::YieldSelfThen
|
9
|
-
end
|
6
|
+
using RubyNext
|
10
7
|
|
11
8
|
module GraphQL
|
12
9
|
# Add DSL to add policy rules as fields
|
@@ -26,26 +23,20 @@ module ActionPolicy
|
|
26
23
|
base.extend ClassMethods
|
27
24
|
end
|
28
25
|
|
29
|
-
def allowance_to(rule, target = object, **options)
|
30
|
-
policy_for(record: target, **options).then do |policy|
|
31
|
-
policy.apply(authorization_rule_for(policy, rule))
|
32
|
-
policy.result
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
26
|
module ClassMethods
|
37
|
-
def expose_authorization_rules(*rules, field_name: nil, prefix: ::ActionPolicy::GraphQL.default_authorization_field_prefix, **options)
|
27
|
+
def expose_authorization_rules(*rules, field_name: nil, prefix: ::ActionPolicy::GraphQL.default_authorization_field_prefix, field_options: {}, **options)
|
38
28
|
raise ArgumentError, "Cannot specify field_name for multiple rules" if rules.size > 1 && !field_name.nil?
|
39
29
|
|
40
30
|
rules.each do |rule|
|
41
31
|
gql_field_name = field_name || "#{prefix}#{rule.to_s.delete("?")}"
|
42
32
|
|
43
33
|
field gql_field_name,
|
44
|
-
|
45
|
-
|
34
|
+
ActionPolicy::GraphQL::Types::AuthorizationResult,
|
35
|
+
null: false,
|
36
|
+
**field_options
|
46
37
|
|
47
38
|
define_method(gql_field_name) do
|
48
|
-
allowance_to(rule, options)
|
39
|
+
allowance_to(rule, object, **options)
|
49
40
|
end
|
50
41
|
end
|
51
42
|
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.
|
4
|
+
version: 0.5.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:
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: action_policy
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
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.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ruby-next
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.10.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.10.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: graphql
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +72,14 @@ dependencies:
|
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '13.0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '13.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,48 +94,6 @@ dependencies:
|
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '3.8'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.67.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.67.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-md
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.3'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.3'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: standard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.0.39
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.0.39
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
98
|
name: i18n
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,19 +115,9 @@ executables: []
|
|
143
115
|
extensions: []
|
144
116
|
extra_rdoc_files: []
|
145
117
|
files:
|
146
|
-
- ".gitignore"
|
147
|
-
- ".rubocop.yml"
|
148
|
-
- ".travis.yml"
|
149
118
|
- CHANGELOG.md
|
150
|
-
- Gemfile
|
151
119
|
- LICENSE.txt
|
152
120
|
- README.md
|
153
|
-
- Rakefile
|
154
|
-
- action_policy-graphql.gemspec
|
155
|
-
- bin/console
|
156
|
-
- bin/setup
|
157
|
-
- gemfiles/graphqlmaster.gemfile
|
158
|
-
- gemfiles/jruby.gemfile
|
159
121
|
- lib/action_policy-graphql.rb
|
160
122
|
- lib/action_policy/graphql.rb
|
161
123
|
- lib/action_policy/graphql/authorized_field.rb
|
@@ -181,14 +143,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
143
|
requirements:
|
182
144
|
- - ">="
|
183
145
|
- !ruby/object:Gem::Version
|
184
|
-
version: 2.
|
146
|
+
version: 2.5.0
|
185
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
148
|
requirements:
|
187
149
|
- - ">="
|
188
150
|
- !ruby/object:Gem::Version
|
189
151
|
version: '0'
|
190
152
|
requirements: []
|
191
|
-
rubygems_version: 3.0.
|
153
|
+
rubygems_version: 3.0.6
|
192
154
|
signing_key:
|
193
155
|
specification_version: 4
|
194
156
|
summary: Action Policy integration for GraphQL-Ruby
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- standard/cop/semantic_blocks
|
3
|
-
- rubocop-md
|
4
|
-
|
5
|
-
inherit_gem:
|
6
|
-
standard: config/base.yml
|
7
|
-
|
8
|
-
AllCops:
|
9
|
-
Exclude:
|
10
|
-
- 'bin/*'
|
11
|
-
- 'tmp/**/*'
|
12
|
-
- 'Gemfile'
|
13
|
-
- 'vendor/**/*'
|
14
|
-
- 'gemfiles/**/*'
|
15
|
-
DisplayCopNames: true
|
16
|
-
TargetRubyVersion: 2.4
|
17
|
-
|
18
|
-
Standard/SemanticBlocks:
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
Style/FrozenStringLiteralComment:
|
22
|
-
Enabled: true
|
23
|
-
|
24
|
-
Style/TrailingCommaInArrayLiteral:
|
25
|
-
EnforcedStyleForMultiline: no_comma
|
26
|
-
|
27
|
-
Style/TrailingCommaInHashLiteral:
|
28
|
-
EnforcedStyleForMultiline: no_comma
|
29
|
-
|
30
|
-
Layout/AlignParameters:
|
31
|
-
EnforcedStyle: with_first_parameter
|
32
|
-
|
33
|
-
Lint/Void:
|
34
|
-
Exclude:
|
35
|
-
- '**/*.md'
|
36
|
-
|
37
|
-
# See https://github.com/rubocop-hq/rubocop/issues/4222
|
38
|
-
Lint/AmbiguousBlockAssociation:
|
39
|
-
Exclude:
|
40
|
-
- 'spec/**/*'
|
41
|
-
- '**/*.md'
|
42
|
-
|
43
|
-
Lint/DuplicateMethods:
|
44
|
-
Exclude:
|
45
|
-
- '**/*.md'
|
46
|
-
|
47
|
-
Naming/FileName:
|
48
|
-
Exclude:
|
49
|
-
- 'lib/action_policy-graphql.rb'
|
50
|
-
- '**/*.md'
|
51
|
-
|
52
|
-
Layout/InitialIndentation:
|
53
|
-
Exclude:
|
54
|
-
- 'CHANGELOG.md'
|
data/.travis.yml
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
notifications:
|
5
|
-
email: false
|
6
|
-
|
7
|
-
before_install:
|
8
|
-
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
9
|
-
- gem install bundler -v '< 2'
|
10
|
-
|
11
|
-
script:
|
12
|
-
- bundle exec rake
|
13
|
-
|
14
|
-
matrix:
|
15
|
-
fast_finish: true
|
16
|
-
include:
|
17
|
-
- rvm: ruby-head
|
18
|
-
gemfile: gemfiles/graphqlmaster.gemfile
|
19
|
-
- rvm: 2.6
|
20
|
-
gemfile: gemfiles/graphqlmaster.gemfile
|
21
|
-
- rvm: jruby-9.2.5.0
|
22
|
-
gemfile: gemfiles/jruby.gemfile
|
23
|
-
- rvm: 2.6
|
24
|
-
gemfile: Gemfile
|
25
|
-
- rvm: 2.5
|
26
|
-
gemfile: Gemfile
|
27
|
-
- rvm: 2.4
|
28
|
-
gemfile: Gemfile
|
29
|
-
allow_failures:
|
30
|
-
- rvm: ruby-head
|
31
|
-
gemfile: gemfiles/graphqlmaster.gemfile
|
32
|
-
- rvm: 2.6
|
33
|
-
gemfile: gemfiles/graphqlmaster.gemfile
|
data/Gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in action_policy-graphql.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem "pry-byebug", platform: :mri
|
7
|
-
|
8
|
-
local_gemfile = File.join(__dir__, "Gemfile.local")
|
9
|
-
|
10
|
-
if File.exist?(local_gemfile)
|
11
|
-
# Specify custom action_policy/graphql-ruby version in Gemfile.local
|
12
|
-
eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
|
13
|
-
else
|
14
|
-
gem "action_policy", "~> 0.3.0"
|
15
|
-
gem "graphql", "~> 1.9.3"
|
16
|
-
end
|
data/Rakefile
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("../lib", __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "action_policy/graphql/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "action_policy-graphql"
|
9
|
-
spec.version = ActionPolicy::GraphQL::VERSION
|
10
|
-
spec.authors = ["Vladimir Dementyev"]
|
11
|
-
spec.email = ["dementiev.vm@gmail.com"]
|
12
|
-
|
13
|
-
spec.summary = "Action Policy integration for GraphQL-Ruby"
|
14
|
-
spec.description = "Action Policy integration for GraphQL-Ruby"
|
15
|
-
spec.homepage = "https://github.com/palkan/action_policy-graphql"
|
16
|
-
spec.license = "MIT"
|
17
|
-
|
18
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
-
f.match(%r{^(test|spec|features)/})
|
20
|
-
end
|
21
|
-
|
22
|
-
spec.metadata = {
|
23
|
-
"bug_tracker_uri" => "https://github.com/palkan/action_policy-graphql/issues",
|
24
|
-
"changelog_uri" => "https://github.com/palkan/action_policy-graphql/blob/master/CHANGELOG.md",
|
25
|
-
"documentation_uri" => "https://actionpolicy.evilmartians.io/#/graphql",
|
26
|
-
"homepage_uri" => "https://github.com/palkan/action_policy-graphql",
|
27
|
-
"source_code_uri" => "https://github.com/palkan/action_policy-graphql"
|
28
|
-
}
|
29
|
-
|
30
|
-
spec.require_paths = ["lib"]
|
31
|
-
|
32
|
-
spec.required_ruby_version = ">= 2.4.0"
|
33
|
-
|
34
|
-
spec.add_dependency "action_policy", ">= 0.3.0"
|
35
|
-
spec.add_dependency "graphql", ">= 1.9.3"
|
36
|
-
|
37
|
-
spec.add_development_dependency "bundler", ">= 1.15"
|
38
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
-
spec.add_development_dependency "rspec", "~> 3.8"
|
40
|
-
spec.add_development_dependency "rubocop", "~> 0.67.0"
|
41
|
-
spec.add_development_dependency "rubocop-md", "~> 0.3"
|
42
|
-
spec.add_development_dependency "standard", "~> 0.0.39"
|
43
|
-
spec.add_development_dependency "i18n"
|
44
|
-
end
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "action_policy/graphql"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/gemfiles/jruby.gemfile
DELETED