solve security access issue
This commit is contained in:
parent
79ef977e1b
commit
88e9c6db6a
|
|
@ -28,6 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
|
@ -72,14 +73,14 @@ class UserController extends AbstractController
|
|||
$actingUser = $this->userService->getUserByIdentifier($this->getUser()->getUserIdentifier());
|
||||
|
||||
// Vérification des droits d'accès supplémentaires
|
||||
if (!$this->userService->hasAccessTo($actingUser)) {
|
||||
$this->loggerService->logAccessDenied($actingUser->getId());
|
||||
throw $this->createAccessDeniedException(self::ACCESS_DENIED);
|
||||
}
|
||||
|
||||
|
||||
// Chargement de l'utilisateur cible à afficher
|
||||
$user = $this->userRepository->find($id);
|
||||
|
||||
if (!$this->userService->hasAccessTo($user)) {
|
||||
$this->loggerService->logAccessDenied($actingUser->getId());
|
||||
throw new AccessDeniedHttpException (self::ACCESS_DENIED);
|
||||
}
|
||||
try {
|
||||
// Paramètre optionnel de contexte organisationnel
|
||||
$orgId = $request->query->get('organizationId');
|
||||
|
|
|
|||
Loading…
Reference in New Issue