Skip to content

Commit

Permalink
Merge pull request #54 from moufmouf/null_unlogged_me
Browse files Browse the repository at this point in the history
Unlogged "me" query now returns null.
  • Loading branch information
moufmouf committed Feb 21, 2020
2 parents 3f85584 + 6b15dd1 commit 16f1bf3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 128 deletions.
5 changes: 2 additions & 3 deletions Controller/GraphQL/MeController.php
Expand Up @@ -41,9 +41,8 @@ public function me(): ?UserInterface
$user = $token->getUser();

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

return $user;
Expand Down
5 changes: 1 addition & 4 deletions Tests/FunctionalTest.php
Expand Up @@ -290,10 +290,7 @@ public function testMeQuery(): void

$this->assertSame([
'data' => [
'me' => [
'userName' => 'anon.',
'roles' => [],
]
'me' => null
]
], $result);

Expand Down
34 changes: 0 additions & 34 deletions Tests/Types/BasicUserTest.php

This file was deleted.

87 changes: 0 additions & 87 deletions Types/BasicUser.php

This file was deleted.

0 comments on commit 16f1bf3

Please sign in to comment.