Skip to content

Commit

Permalink
fix: re-introduce /linked-accounts endpoint to avoid breaking change (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Jun 28, 2024
1 parent d2ead9b commit bdba0b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

(new Extend\Routes('api'))
->get('/users/{id}/linked-accounts', 'users.provider.list', Api\Controllers\ListProvidersController::class)
->get('/linked-accounts', 'user.provider.list', Api\Controllers\ListProvidersController::class)
->delete('/linked-accounts/{id}', 'users.provider.delete', Api\Controllers\DeleteProviderLinkController::class),

(new Extend\ServiceProvider())
Expand Down
3 changes: 2 additions & 1 deletion src/Api/Controllers/ListProvidersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ protected function data(ServerRequestInterface $request, Document $document)
$actor = RequestUtil::getActor($request);
$actor->assertRegistered();

$user = $this->users->findOrFail(Arr::get($request->getQueryParams(), 'id'));
// If no id is provided, we're looking at the current user.
$user = $this->users->findOrFail(Arr::get($request->getQueryParams(), 'id', $actor->id));

if ($actor->id !== $user->id) {
$actor->assertCan('moderateUserProviders');
Expand Down

0 comments on commit bdba0b1

Please sign in to comment.