From f73723f42bbf530d00ce7379f78fe13b1bf96041 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 11 Feb 2026 15:55:17 +0100 Subject: [PATCH] revert on bug --- src/Controller/ApplicationController.php | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Controller/ApplicationController.php b/src/Controller/ApplicationController.php index 47d3665..ff7e775 100644 --- a/src/Controller/ApplicationController.php +++ b/src/Controller/ApplicationController.php @@ -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); + } }