Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/hq/graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def self.configure(&block)
config.instance_eval(&block)
end

def self.authorized?(action, object, context)
!config.authorize || config.authorize.call(action, object, context)
def self.authorized?(action, object, context, **args)
!config.authorize || config.authorize.call(action, object, context, **args)
end

def self.authorize_field(action, field, object, context)
Expand Down
4 changes: 2 additions & 2 deletions lib/hq/graphql/ext/object_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def authorize_action(action)
self.authorized_action = action
end

def authorized?(object, context)
super && ::HQ::GraphQL.authorized?(authorized_action, object, context)
def authorized?(object, context, **args)
super && ::HQ::GraphQL.authorized?(authorized_action, object, context, **args)
end

def with_model(model_name, attributes: true, associations: true, auto_nil: true, enums: true)
Expand Down
3 changes: 2 additions & 1 deletion lib/hq/graphql/resource/auto_mutation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def build_update

if resource
resource.assign_attributes(args[:attributes].format_nested_attributes)
scoped_self.after_assign_attributes(resource, args[:attributes], context) if scoped_self&.respond_to?(:after_assign_attributes)
if resource.save
{
resource: resource,
Expand Down Expand Up @@ -135,7 +136,7 @@ def build_mutation(action:, require_primary_key: false, nil_klass: false, &block
graphql_name gql_name

define_method(:ready?) do |**args|
super(**args) && ::HQ::GraphQL.authorized?(action, scoped_model_name, context)
super(**args) && ::HQ::GraphQL.authorized?(action, scoped_model_name, context, **args)
end

lazy_load do
Expand Down
2 changes: 1 addition & 1 deletion lib/hq/graphql/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module HQ
module GraphQL
VERSION = "2.3.6"
VERSION = "2.3.7"
end
end