revert on bug

This commit is contained in:
Charles 2026-02-11 15:55:17 +01:00
parent c6833232a0
commit f73723f42b
1 changed files with 26 additions and 0 deletions

View File

@ -101,4 +101,30 @@ class ApplicationController extends AbstractController
]);
}
#[Route(path:'/user/{id}', name: 'user', methods: ['GET'])]
public function getApplicationUsers(int $id): JSONResponse
{
$user = $this->userRepository->find($id);
$actingUser = $this->getUser();
if (!$user) {
$this->loggerService->logEntityNotFound('User', ['message'=> 'User not found for application list'], $actingUser->getId());
return new JsonResponse(['error' => 'User not found'], Response::HTTP_NOT_FOUND);
}
if ($this->isGranted('ROLE_SUPER_ADMIN')) {
$applications = $this->entityManager->getRepository(Apps::class)->findAll();
}else{
$applications = $this->userOrganizationAppService->getUserApplications($user);
}
$data = array_map(function($app) {
return [
'name' => $app->getName(),
'subDomain' => $app->getSubDomain(),
'logoMiniUrl' => $this->assetsManager->getUrl($app->getLogoMiniUrl()),
];
}, $applications);
return new JsonResponse($data, Response::HTTP_OK);
}
}