From 85877986194ebd574f42bd365714f373aef32190 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 11 Feb 2026 11:59:46 +0100 Subject: [PATCH] remove useless code --- src/Controller/UserController.php | 57 ------------------------------- 1 file changed, 57 deletions(-) diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 6c33412..ce4cd64 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -510,63 +510,6 @@ class UserController extends AbstractController } } - #[Route(path: '/application/roles/{id}', name: 'application_role', methods: ['GET', 'POST'])] - public function applicationRole(int $id, Request $request): Response - { - $this->denyAccessUnlessGranted("ROLE_ADMIN"); - $actingUser = $this->getUser(); - - if ($this->userService->hasAccessTo($actingUser, true)) { - $uo = $this->entityManager->getRepository(UsersOrganizations::class)->find($id); - if (!$uo) { - $this->loggerService->logEntityNotFound('UsersOrganization', ['id' => $id], $actingUser->getUserIdentifier()); - $this->addFlash('danger', "La liaison utilisateur-organisation n'existe pas."); - throw new NotFoundHttpException("UserOrganization not found"); - } - $application = $this->entityManager->getRepository(Apps::class)->find($request->get('appId')); - if (!$application) { - $this->loggerService->logEntityNotFound('Application', ['id' => $request->get('appId')], $actingUser->getUserIdentifier()); - $this->addFlash('danger', "L'application demandée n'existe pas."); - throw $this->createNotFoundException(self::NOT_FOUND); - } - - $selectedRolesIds = $request->get('roles', []); - $roleUser = $this->entityManager->getRepository(Roles::class)->findOneBy(['name' => 'USER']); - if (!$roleUser) { - $this->loggerService->logEntityNotFound('Role', ['name' => 'USER'], $actingUser->getUserIdentifier()); - $this->addFlash('danger', "Le role de l'utilisateur n'existe pas."); - throw $this->createNotFoundException('User role not found'); - } - - if (!empty($selectedRolesIds)) { - // Si le role User n'est pas sélectionné, on désactive tous les liens (affiché comme 'accès' dans l'UI) - if (!in_array((string)$roleUser->getId(), $selectedRolesIds, true)) { - $this->userOrganizationAppService->deactivateAllUserOrganizationsAppLinks($uo, $application); - } else { - $this->userOrganizationAppService->syncRolesForUserOrganizationApp( - $uo, - $application, - $selectedRolesIds, - $actingUser - ); - } - - } else { - $this->userOrganizationAppService->deactivateAllUserOrganizationsAppLinks($uo, $application); - } - - $user = $uo->getUsers(); - $this->addFlash('success', 'Rôles mis à jour avec succès.'); - return $this->redirectToRoute('user_show', [ - 'user' => $user, - 'id' => $user->getId(), - 'organizationId' => $uo->getOrganization()->getId() - ]); - } - - throw $this->createAccessDeniedException(); - } - /* * AJAX endpoint for user listing with pagination * Get all the users that aren´t deleted and are active