mirror of
https://github.com/tchapi/davis.git
synced 2025-04-21 21:11:59 +02:00
Fix bad error status
This commit is contained in:
parent
e05ee0a73d
commit
861d97b943
@ -19,6 +19,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@ -273,6 +274,10 @@ class AdminController extends AbstractController
|
||||
*/
|
||||
public function userDelegateAdd(ManagerRegistry $doctrine, Request $request, string $username)
|
||||
{
|
||||
if (!is_numeric($request->get('principalId'))) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
$newMemberToAdd = $doctrine->getRepository(Principal::class)->findOneById($request->get('principalId'));
|
||||
|
||||
if (!$newMemberToAdd) {
|
||||
@ -464,6 +469,10 @@ class AdminController extends AbstractController
|
||||
throw $this->createNotFoundException('Calendar not found');
|
||||
}
|
||||
|
||||
if (!is_numeric($request->get('principalId'))) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
$newShareeToAdd = $doctrine->getRepository(Principal::class)->findOneById($request->get('principalId'));
|
||||
if (!$newShareeToAdd) {
|
||||
throw $this->createNotFoundException('Member not found');
|
||||
|
Loading…
x
Reference in New Issue
Block a user