Skip to content

Commit

Permalink
Return more explicit message if user don't have rights.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg-web committed Mar 9, 2016
1 parent 631e5ff commit b9400f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Resolver/ConfigResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Overblog\GraphQLBundle\Definition\Argument;
use Overblog\GraphQLBundle\Definition\ArgsInterface;
use Overblog\GraphQLBundle\Definition\FieldInterface;
use Overblog\GraphQLBundle\Error\UserError;
use Overblog\GraphQLBundle\Relay\Connection\Output\Connection;
use Overblog\GraphQLBundle\Relay\Connection\Output\Edge;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
Expand Down Expand Up @@ -265,7 +266,11 @@ private function resolveAccessAndWrapResolveCallback($expression, callable $reso
$access = false;
}

return (bool) $access;
if (!$access) {
throw new UserError('Access denied to this field.');
}

return true;
};

if (is_array($result) || $result instanceof \ArrayAccess) {
Expand Down

0 comments on commit b9400f7

Please sign in to comment.