graphql 1.13.1 → 1.13.2

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: 4f950da72b7fb585a9135dc893b2c2cf41c8a6482a82a0f7401ba913d48c643f
4
- data.tar.gz: 8d5cd615133ca107e38ab18ccc59902c6eaa1f8d7ffeef5c7af474f1e4c5cde9
3
+ metadata.gz: 381cd8cc5f2508805ccc69172566e28577652372b04e44b236ceaf903db1622f
4
+ data.tar.gz: 56c03d754890c85d6a6c7d5df6a50874f3986a1284f2666a256ea51d90028a82
5
5
  SHA512:
6
- metadata.gz: 961ac5fe60ef45ea3eed645bcbef7793363dabe18d676c739188430b95e86887470d93966eccdfe89f0bebe99e0c4e5cfa68b5e697865d8228713a080d28f98d
7
- data.tar.gz: a545feab4e634fc1039c232c43fe45412382b44215fe4038211e19a9fcef44dd02bb0db22eda2c3f78553867b7c3aed1b7630947a83d72741431e6fe2caeffdf
6
+ metadata.gz: 31f7ab242f8b5efa5f2e77a9c79ab3c4a6b3b9d319dcdc4215d676009f472dc59a1fdf3303a3af86ab557c5b7f53ff2610d30dc36a58eb0937962ebe1ce388f9
7
+ data.tar.gz: 8c6295f3cdae55803aad1bb45abb97ec1f6a5b76d60f2150e449c5e8244619096c9462317358a048b9d5045a0246cfd2354b96d6c4de49968995e86dd6b2aafa
@@ -516,7 +516,7 @@ module GraphQL
516
516
  after_lazy(app_result, owner: owner_type, field: field_defn, path: next_path, ast_node: ast_node, scoped_context: context.scoped_context, owner_object: object, arguments: resolved_arguments, result_name: result_name, result: selection_result) do |inner_result|
517
517
  continue_value = continue_value(next_path, inner_result, owner_type, field_defn, return_type.non_null?, ast_node, result_name, selection_result)
518
518
  if HALT != continue_value
519
- continue_field(next_path, continue_value, owner_type, field_defn, return_type, ast_node, next_selections, false, object, kwarg_arguments, result_name, selection_result)
519
+ continue_field(next_path, continue_value, owner_type, field_defn, return_type, ast_node, next_selections, false, object, resolved_arguments, result_name, selection_result)
520
520
  end
521
521
  end
522
522
  end
@@ -617,13 +617,10 @@ module GraphQL
617
617
  end
618
618
 
619
619
  def authorized?(object, args, context)
620
- resolver_authed = if @resolver_class
620
+ if @resolver_class
621
621
  # The resolver _instance_ will check itself during `resolve()`
622
622
  @resolver_class.authorized?(object, context)
623
623
  else
624
- true
625
- end
626
- resolver_authed && begin
627
624
  if (arg_values = context[:current_arguments])
628
625
  # ^^ that's provided by the interpreter at runtime, and includes info about whether the default value was used or not.
629
626
  using_arg_values = true
@@ -155,6 +155,14 @@ module GraphQL
155
155
  end
156
156
  end
157
157
  end
158
+
159
+ private
160
+
161
+ def authorize_arguments(args, values)
162
+ # remove the `input` wrapper to match values
163
+ input_args = args["input"].type.unwrap.arguments(context)
164
+ super(input_args, values)
165
+ end
158
166
  end
159
167
  end
160
168
  end
@@ -145,19 +145,9 @@ module GraphQL
145
145
  # @raise [GraphQL::UnauthorizedError] To signal an authorization failure
146
146
  # @return [Boolean, early_return_data] If `false`, execution will stop (and `early_return_data` will be returned instead, if present.)
147
147
  def authorized?(**inputs)
148
- self.class.arguments(context).each_value do |argument|
149
- arg_keyword = argument.keyword
150
- if inputs.key?(arg_keyword) && !(arg_value = inputs[arg_keyword]).nil? && (arg_value != argument.default_value)
151
- arg_auth, err = argument.authorized?(self, arg_value, context)
152
- if !arg_auth
153
- return arg_auth, err
154
- else
155
- true
156
- end
157
- else
158
- true
159
- end
160
- end
148
+ arg_owner = @field # || self.class
149
+ args = arg_owner.arguments(context)
150
+ authorize_arguments(args, inputs)
161
151
  end
162
152
 
163
153
  # Called when an object loaded by `loads:` fails the `.authorized?` check for its resolved GraphQL object type.
@@ -172,6 +162,22 @@ module GraphQL
172
162
 
173
163
  private
174
164
 
165
+ def authorize_arguments(args, inputs)
166
+ args.each_value do |argument|
167
+ arg_keyword = argument.keyword
168
+ if inputs.key?(arg_keyword) && !(arg_value = inputs[arg_keyword]).nil? && (arg_value != argument.default_value)
169
+ arg_auth, err = argument.authorized?(self, arg_value, context)
170
+ if !arg_auth
171
+ return arg_auth, err
172
+ else
173
+ true
174
+ end
175
+ else
176
+ true
177
+ end
178
+ end
179
+ end
180
+
175
181
  def load_arguments(args)
176
182
  prepared_args = {}
177
183
  prepare_lazies = []
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.13.1"
3
+ VERSION = "1.13.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-13 00:00:00.000000000 Z
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips