Authorize introspection documentarion for rebing/graphql-laravel
fidelize/graphql-laravel-authorize-introspection is a Laravel package for authorize introspection documentarion for rebing/graphql-laravel.
It currently has 2 GitHub stars and 5.724 downloads on Packagist (latest version 1.1.1).
Install it with composer require fidelize/graphql-laravel-authorize-introspection.
Discover more Laravel packages by fidelize
or browse all Laravel packages to compare alternatives.
Last updated
rebing/graphql-laravel lists all
queries, mutations and subscriptions when you perform
introspection,
even those queries which would not be authorized when called (due to rules in
their #authorize method).
This extension allows us to:
For example: you may want to list updatePost mutation for all authors with
authorizeIntrospection, but only allow an author to edit his or her own post
on calling updatePost. Thus:
authorizeIntrospection: allows showing the documentation.authorize: allows calling it with the given arguments.In your queries, mutations and subscriptions base classes, you may want to add:
<?php
namespace App\GraphQL\Mutation;
use Rebing\GraphQL\Support\Mutation;
class AbstractMutation extends Mutation
{
public function authorizeIntrospection()
{
// Your rule here
return true;
}
public function authorize(array $args)
{
// Only override when you have custom rule according to the $args
return $this->authorizeIntrospection();
}
}
composer require "fidelize/graphql-laravel-authorize-introspection"
Replace Rebing\GraphQL\GraphQLServiceProvider with
Fidelize\GraphQLAuthorizedIntrospection\ServiceProvider in your
config/app.php file.