lib/rails/graphql/request/steps/authorizable.rb
def check_authorization!
          return unless field.authorizable?
          *args, block = field.authorizer

          catch(:authorized) do
            event = authorization_event
            schema_events = request.all_events[:authorize]
            executed = event.authorize_using(schema, args, schema_events)

            element = field
            while element && element != schema
              executed = event.authorize_using(element, args) || executed
              element = element.try(:owner)
            end

            if block.present?
              block.call(event, *args[0], **args[1])
              executed = true
            end

            event.unauthorized!(message: <<~MSG.squish) unless executed
              Authorization required but unable to be executed
            MSG
          end
        rescue UnauthorizedFieldError => error
          request.rescue_with_handler(error)
          request.exception_to_error(error, @node)
          invalidate!
        end
# Check if the field is correctly authorized to be executed
# TODO: Implement reverse order of authorization
Check if the field is correctly authorized to be executed
TODO: Implement reverse order of authorization
Check if the field is correctly authorized to be executed TODO : Implement reverse order of authorization
def check_authorization!
          return unless field.authorizable?
          *args, block = field.authorizer
          catch(:authorized) do
            event = authorization_event
            schema_events = request.all_events[:authorize]
            executed = event.authorize_using(schema, args, schema_events)
            element = field
            while element && element != schema
              executed = event.authorize_using(element, args) || executed
              element = element.try(:owner)
            end
            if block.present?
              block.call(event, *args[0], **args[1])
              executed = true
            end
            event.unauthorized!(message: <<~MSG.squish) unless executed
              Authorization required but unable to be executed
            MSG
          end
        rescue UnauthorizedFieldError => error
          request.rescue_with_handler(error)
          request.exception_to_error(error, @node)
          invalidate!
        end
def check_authorization! return unless field . authorizable? * args , block = field . authorizer catch ( :authorized ) do event = authorization_event schema_events = request . all_events [ :authorize ] executed = event . authorize_using ( schema , args , schema_events ) element = field while element && element != schema executed = event . authorize_using ( element , args ) || executed element = element . try ( :owner ) end if block . present? block . call ( event , * args [ 0 ] , ** args [ 1 ] ) executed = true end event . unauthorized! ( message : <<~MSG . squish ) unless executed 
              Authorization required but unable to be executed
             MSG end rescue UnauthorizedFieldError => error request . rescue_with_handler ( error ) request . exception_to_error ( error , @node ) invalidate! end
Check if the field is correctly authorized to be executed
TODO: Implement reverse order of authorization
Check if the field is correctly authorized to be executed TODO : Implement reverse order of authorization