Skip to content

Commit 16f1bf3

Browse files
authored
Merge pull request #54 from moufmouf/null_unlogged_me
Unlogged "me" query now returns null.
2 parents 3f85584 + 6b15dd1 commit 16f1bf3

File tree

4 files changed

+3
-128
lines changed

4 files changed

+3
-128
lines changed

Controller/GraphQL/MeController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ public function me(): ?UserInterface
4141
$user = $token->getUser();
4242

4343
if (!$user instanceof UserInterface) {
44-
// getUser() can be an object with a toString or a string
45-
$userName = (string) $user;
46-
$user = new BasicUser($userName);
44+
// getUser() can be the "anon." string.
45+
return null;
4746
}
4847

4948
return $user;

Tests/FunctionalTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,7 @@ public function testMeQuery(): void
290290

291291
$this->assertSame([
292292
'data' => [
293-
'me' => [
294-
'userName' => 'anon.',
295-
'roles' => [],
296-
]
293+
'me' => null
297294
]
298295
], $result);
299296

Tests/Types/BasicUserTest.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

Types/BasicUser.php

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)