Skip to content

Commit

Permalink
fix(deleteUser): update error message and attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Ly <[email protected]>
  • Loading branch information
edward-ly committed Oct 11, 2024
1 parent 7013ec3 commit 8872b54
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,18 @@ public function createUser(int $providerId, string $userId, ?string $displayName
}

/**
* @NoCSRFRequired
*
* @param string $userId
* @return DataResponse
*/
public function deleteUser(string $userId): DataResponse {
$status = Http::STATUS_NOT_FOUND;
$user = $this->userManager->get($userId);

if (!is_null($user) && $user->getBackendClassName() === 'user_oidc') {
$user->delete();
$status = Http::STATUS_OK;
if (is_null($user) || $user->getBackendClassName() !== 'user_oidc') {
return new DataResponse(['message' => 'User not found'], Http::STATUS_NOT_FOUND);
}

return new DataResponse(['user_id' => $userId], $status);
$user->delete();
return new DataResponse(['user_id' => $userId], Http::STATUS_OK);
}
}

0 comments on commit 8872b54

Please sign in to comment.