Skip to content

Commit 6ebb146

Browse files
authored
Removed silent try catching on access resolver (#53)
1 parent 8a0c8b4 commit 6ebb146

File tree

4 files changed

+4
-31
lines changed

4 files changed

+4
-31
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ overblog_graphql_endpoint:
4949
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
5050
```
5151
52-
**c)** Enable GraphiQL in dev mode (required twig)
52+
**d)** Enable GraphiQL in dev mode (required twig)
5353
5454
```yaml
5555
# in app/config/routing_dev.yml
@@ -865,8 +865,8 @@ Expression | Description | Scope
865865
---------- | ----------- | --------
866866
**container** | DI container | global
867867
**request** | Refers to the current request. | Request
868-
**token** | Refers to the token which is currently in the security token storage. | Token
869-
**user** | Refers to the user which is currently in the security token storage. | Valid Token
868+
**token** | Refers to the token which is currently in the security token storage. Token can be null. | Token
869+
**user** | Refers to the user which is currently in the security token storage. User can be null. | Valid Token
870870
**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.
871871
**value** | Resolver value | only available in resolve context
872872
**args** | Resolver args array | only available in resolve context

Resolver/AccessResolver.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ function (Edge $edge) use ($accessChecker, $resolveArgs) {
7070
private function hasAccess(callable $accessChecker, $object, array $resolveArgs = [])
7171
{
7272
$resolveArgs[] = $object;
73-
74-
try {
75-
$access = (bool) call_user_func_array($accessChecker, $resolveArgs);
76-
} catch (\Exception $e) {
77-
$access = false;
78-
}
73+
$access = (bool) call_user_func_array($accessChecker, $resolveArgs);
7974

8075
return $access;
8176
}

Tests/Functional/Security/AccessTest.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,27 +156,6 @@ public function testUserAccessToUserFriends()
156156
$this->assertResponse($this->userFriendsQuery, $expected, static::USER_ADMIN);
157157
}
158158

159-
public function testUserAccessToUserIsEnabledWithExpressionLanguageEvaluationFailed()
160-
{
161-
$expected = [
162-
'data' => [
163-
'user' => [
164-
'isEnabled' => null,
165-
],
166-
],
167-
'extensions' => [
168-
'warnings' => [
169-
[
170-
'message' => 'Access denied to this field.',
171-
'locations' => [['line' => 1, 'column' => 24]],
172-
],
173-
],
174-
],
175-
];
176-
177-
$this->assertResponse($this->userIsEnabledQuery, $expected, static::USER_ADMIN);
178-
}
179-
180159
public function testMutationAllowedUser()
181160
{
182161
$result = 123;

Tests/Functional/app/config/access/mapping/access.types.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ User:
3535
resolve: ['ROLE_USER']
3636
isEnabled:
3737
type: Boolean
38-
access: "@=service('fake').fake()"
3938
resolve: true
4039
friends:
4140
access: "@=object === 1"

0 commit comments

Comments
 (0)