Skip to content

[WIP] Add user api#592

Closed
y3n4 wants to merge 8 commits intomainfrom
add_user_api
Closed

[WIP] Add user api#592
y3n4 wants to merge 8 commits intomainfrom
add_user_api

Conversation

@y3n4
Copy link
Copy Markdown
Contributor

@y3n4 y3n4 commented Apr 12, 2024

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
17.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link
Copy Markdown
Contributor

@doobry-systemli doobry-systemli left a 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.

Comment thread src/Controller/Api/AliasController.php Outdated
$user = $this->security->getUser();

$aliases = $this->aliasHandler->getEnabledAliasesByUser($user);
$data = [];
Copy link
Copy Markdown
Contributor

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);

Comment thread src/Controller/Api/UserController.php Outdated

$data=[
'username' => $user->getEmail(),
'mailcrypt_enabled' => $user->hasMailCrypt(),
Copy link
Copy Markdown
Contributor

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?


namespace App\Traits;


Copy link
Copy Markdown
Contributor

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?

@y3n4 y3n4 force-pushed the add_user_api branch 10 times, most recently from 082c759 to b4c91fa Compare April 21, 2024 16:14
Comment thread src/Controller/Api/AliasController.php Outdated
#[Route('/api/user/aliases', name: 'get_user_aliases', methods: ['GET'])]
public function getAliases(): JsonResponse
{
$user = $this->security->getUser();
Copy link
Copy Markdown
Contributor

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?

@y3n4 y3n4 added the enhancement New feature or request label Apr 22, 2024
@y3n4 y3n4 force-pushed the add_user_api branch 3 times, most recently from 43512fb to 47c2bac Compare April 25, 2024 17:13
@y3n4 y3n4 force-pushed the add_user_api branch 2 times, most recently from 2985403 to e71af4c Compare April 11, 2025 22:04
@y3n4 y3n4 closed this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants