X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FWallabagRestController.php;h=71da2a645ebd757309168277cdf8476565fcae67;hb=f808b01692a835673f328d7221ba8c212caa9b61;hp=544c1ea936718413658758b5d2507d71c3566a18;hpb=5a619812ca3eb05a82a023ccdaee13501eb8d45f;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 544c1ea9..71da2a64 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -3,8 +3,9 @@ namespace Wallabag\ApiBundle\Controller; use FOS\RestBundle\Controller\FOSRestController; +use Nelmio\ApiDocBundle\Annotation\ApiDoc; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Wallabag\CoreBundle\Entity\Entry; class WallabagRestController extends FOSRestController { @@ -19,6 +20,7 @@ class WallabagRestController extends FOSRestController { $version = $this->container->getParameter('wallabag_core.version'); $json = $this->get('serializer')->serialize($version, 'json'); + return (new JsonResponse())->setJson($json); } @@ -38,8 +40,8 @@ class WallabagRestController extends FOSRestController protected function validateUserAccess($requestUserId) { $user = $this->get('security.token_storage')->getToken()->getUser(); - if ($requestUserId != $user->getId()) { - throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); + if ($requestUserId !== $user->getId()) { + throw $this->createAccessDeniedException('Access forbidden. Entry user id: ' . $requestUserId . ', logged user id: ' . $user->getId()); } } }