revert on bug
This commit is contained in:
parent
c6833232a0
commit
f73723f42b
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue