-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add user api #592
base: main
Are you sure you want to change the base?
[WIP] Add user api #592
Conversation
Quality Gate failedFailed conditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks promising 😊 Didn't test and grap the JWT authentication yet. Left some comments on things that caught my eye.
$user = $this->security->getUser(); | ||
|
||
$aliases = $this->aliasHandler->getEnabledAliasesByUser($user); | ||
$data = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use array_map
here (and similarily in the other controllers) and return it directly. Something along the lines of:
return $this->json(array_map(function (Alias $alias) {
return [
'id' => $alias->getId(),
'address' => $alias->getSource(),
'isRandom' => $alias->getRandom(),
];
}, $aliases), 200);
|
||
$data=[ | ||
'username' => $user->getEmail(), | ||
'mailcrypt_enabled' => $user->hasMailCrypt(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to expose this via the API? What would be the usecase for a selfservice client? Recovery token would be more useful and important, no?
@@ -2,8 +2,10 @@ | |||
|
|||
namespace App\Traits; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These extra empty lines seem like leftovers?
082c759
to
b4c91fa
Compare
#[Route('/api/user/aliases', name: 'get_user_aliases', methods: ['GET'])] | ||
public function getAliases(): JsonResponse | ||
{ | ||
$user = $this->security->getUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it work to use $this->getUser()
directly from the parent AbstractController
?
74c99f4
to
43512fb
Compare
Adds LexikJWT auth bundle and JSON login TODO: Add tests
TODO: - Testing
No description provided.