lib/rails/graphql/request/steps/authorizable.rb
def authorize_using(object, send_args, events = nil)
            cache = data[:request].cache(:authorize)[object] ||= []
            return false if cache.present? && cache.none?
            args, xargs = send_args

            # Authorize through instance method
            using_object = cache[0] ||= authorize_on_object(object)
            set_on(using_object) do |instance|
              instance.public_send(:authorize!, *args, **xargs)
            end if using_object

            # Authorize through events
            using_events = cache[1] ||= (events || object.all_events[:authorize]).presence
            using_events&.each { |block| block.call(self, *args, **xargs) }

            # Does any authorize process ran
            cache.any?
          end
# Similar to trigger for object, but with an extra extension for
# instance methods defined on the given object
Similar to trigger for object, but with an extra extension for
instance methods defined on the given object
Similar to trigger for object but with an extra extension for instance methods defined on the given object
def authorize_using(object, send_args, events = nil)
            cache = data[:request].cache(:authorize)[object] ||= []
            return false if cache.present? && cache.none?
            args, xargs = send_args
            using_object = cache[0] ||= authorize_on_object(object)
            set_on(using_object) do |instance|
              instance.public_send(:authorize!, *args, **xargs)
            end if using_object
            using_events = cache[1] ||= (events || object.all_events[:authorize]).presence
            using_events&.each { |block| block.call(self, *args, **xargs) }
            cache.any?
          end
def authorize_using ( object , send_args , events = nil ) cache = data [ :request ] . cache ( :authorize ) [ object ] ||= [ ] return false if cache . present? && cache . none? args , xargs = send_args using_object = cache [ 0 ] ||= authorize_on_object ( object ) set_on ( using_object ) do | instance | instance . public_send ( :authorize! , * args , ** xargs ) end if using_object using_events = cache [ 1 ] ||= ( events || object . all_events [ :authorize ] ) . presence using_events &. each { | block | block . call ( self , * args , ** xargs ) } cache . any? end
Similar to trigger for object, but with an extra extension for
instance methods defined on the given object
Similar to trigger for object but with an extra extension for instance methods defined on the given object
# Authorize through instance method # Authorize through events # Does any authorize process ran
object
send_args
events