From 52b8ba0a10120378b74fc67aa18bc0fb61af1d75 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 25 Nov 2025 15:46:15 +0100 Subject: [PATCH] Removed unused functions --- src/Service/UserService.php | 68 ------------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/Service/UserService.php b/src/Service/UserService.php index 01f0b2f..3cb2cb0 100644 --- a/src/Service/UserService.php +++ b/src/Service/UserService.php @@ -133,35 +133,6 @@ class UserService return false; } - /** - * Get the Organizations id where the user is admin - * - * @param User $user - * @return array - * @throws Exception - */ - public function getAdminOrganizationsIds(User $user): array - { - $orgIds = []; - try { - $uo = $this->entityManager->getRepository(UsersOrganizations::class)->findBy(['users' => $user]); - $roleAdmin = $this->entityManager->getRepository(Roles::class)->findOneBy(['name' => 'ADMIN']); - if ($uo) { - foreach ($uo as $u) { - $uoa = $this->entityManager->getRepository(UserOrganizatonApp::class)->findOneBy(['userOrganization' => $u, - 'role' => $roleAdmin, - 'isActive' => true]); - if ($uoa && $this->security->isGranted('ROLE_ADMIN')) { - $orgIds[] = $u->getOrganization()->getId(); - } - } - } - } catch (EntityNotFoundException $e) { - throw new EntityNotFoundException("Error while fetching organizations ids where the user is admin"); - } - - return array_unique($orgIds); - } /** * Get the user by their identifier. @@ -179,45 +150,6 @@ class UserService return $user; } - /** - * Get users grouped by their organizations for the index page. - * This method should return an array of users grouped by their organizations. - * - * @return array - */ - public function groupByOrganization(array $usersOrganizations): array - { - $grouped = []; - - foreach ($usersOrganizations as $userOrg) { - $org = $userOrg->getOrganization(); - if (!$org) { - continue; - } - - $orgId = $org->getId(); - $orgName = $org->getName(); - $orgLogo = $org->getLogoUrl(); - - if (!isset($grouped[$orgId])) { - $grouped[$orgId] = [ - 'id' => $orgId, - 'name' => $orgName, - 'logo' => $orgLogo, - 'users' => [], - ]; - } - - $user = $userOrg->getUsers(); - $grouped[$orgId]['users'][] = [ - 'entity' => $user, - 'connected' => $this->isUserConnected($user->getUserIdentifier()), - 'isActive' => (bool)$userOrg->isActive() - ]; - } - - return $grouped; - } /** * Format users without organization for admin view.