This commit is contained in:
Charles 2025-07-28 11:22:57 +02:00
parent 6446eb2ce1
commit 3337b8c001
1 changed files with 4 additions and 3 deletions

View File

@ -39,10 +39,11 @@ class UserController extends AbstractController
$usersByOrganization = $entityManager->getRepository(UsersOrganizations::class)->getActiveUsersGroupedByOrganization();
} else{
$userIdentifier = $this->getUser()->getUserIdentifier();
if (!$userIdentifier) {
return $this->redirectToRoute('app_login');
$user = $this->getUser();
if (!$user) {
return $this->redirectToRoute('app_login');
}
$userIdentifier = $user->getUserIdentifier();
$organizations = $this->entityManager->getRepository(UsersOrganizations::class)->findOrganizationsByUserEmailAndRoleName($userIdentifier, 'ADMIN');
if(!$organizations) {
// if user is not admin in any organization, throw access denied