Skip to content

Commit

Permalink
Removed silent try catching on access resolver (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg-web authored Jun 14, 2016
1 parent 8a0c8b4 commit 6ebb146
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ overblog_graphql_endpoint:
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
```
**c)** Enable GraphiQL in dev mode (required twig)
**d)** Enable GraphiQL in dev mode (required twig)
```yaml
# in app/config/routing_dev.yml
Expand Down Expand Up @@ -865,8 +865,8 @@ Expression | Description | Scope
---------- | ----------- | --------
**container** | DI container | global
**request** | Refers to the current request. | Request
**token** | Refers to the token which is currently in the security token storage. | Token
**user** | Refers to the user which is currently in the security token storage. | Valid Token
**token** | Refers to the token which is currently in the security token storage. Token can be null. | Token
**user** | Refers to the user which is currently in the security token storage. User can be null. | Valid Token
**object** | Refers to the value of the field for which access is being requested. For array `object` will be each item of the array. For Relay connection `object` will be the node of each connection edges. | only available for `config.fields.*.access` with query operation or mutation payload type.
**value** | Resolver value | only available in resolve context
**args** | Resolver args array | only available in resolve context
Expand Down
7 changes: 1 addition & 6 deletions Resolver/AccessResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ function (Edge $edge) use ($accessChecker, $resolveArgs) {
private function hasAccess(callable $accessChecker, $object, array $resolveArgs = [])
{
$resolveArgs[] = $object;

try {
$access = (bool) call_user_func_array($accessChecker, $resolveArgs);
} catch (\Exception $e) {
$access = false;
}
$access = (bool) call_user_func_array($accessChecker, $resolveArgs);

return $access;
}
Expand Down
21 changes: 0 additions & 21 deletions Tests/Functional/Security/AccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,27 +156,6 @@ public function testUserAccessToUserFriends()
$this->assertResponse($this->userFriendsQuery, $expected, static::USER_ADMIN);
}

public function testUserAccessToUserIsEnabledWithExpressionLanguageEvaluationFailed()
{
$expected = [
'data' => [
'user' => [
'isEnabled' => null,
],
],
'extensions' => [
'warnings' => [
[
'message' => 'Access denied to this field.',
'locations' => [['line' => 1, 'column' => 24]],
],
],
],
];

$this->assertResponse($this->userIsEnabledQuery, $expected, static::USER_ADMIN);
}

public function testMutationAllowedUser()
{
$result = 123;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ User:
resolve: ['ROLE_USER']
isEnabled:
type: Boolean
access: "@=service('fake').fake()"
resolve: true
friends:
access: "@=object === 1"
Expand Down

0 comments on commit 6ebb146

Please sign in to comment.