diff options
Diffstat (limited to 'src/Wallabag/ApiBundle')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 4 | ||||
-rw-r--r-- | src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 1fee56ad..74bfe4dc 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -40,7 +40,7 @@ class WallabagRestController extends FOSRestController | |||
40 | 40 | ||
41 | private function validateAuthentication() | 41 | private function validateAuthentication() |
42 | { | 42 | { |
43 | if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) { | 43 | if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { |
44 | throw new AccessDeniedException(); | 44 | throw new AccessDeniedException(); |
45 | } | 45 | } |
46 | } | 46 | } |
@@ -347,7 +347,7 @@ class WallabagRestController extends FOSRestController | |||
347 | */ | 347 | */ |
348 | private function validateUserAccess($requestUserId) | 348 | private function validateUserAccess($requestUserId) |
349 | { | 349 | { |
350 | $user = $this->get('security.context')->getToken()->getUser(); | 350 | $user = $this->get('security.token_storage')->getToken()->getUser(); |
351 | if ($requestUserId != $user->getId()) { | 351 | if ($requestUserId != $user->getId()) { |
352 | throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); | 352 | throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); |
353 | } | 353 | } |
diff --git a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php index 119889b3..09cde0f6 100644 --- a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php | |||
@@ -25,7 +25,6 @@ abstract class AbstractControllerTest extends WebTestCase | |||
25 | $client = static::createClient(); | 25 | $client = static::createClient(); |
26 | $container = $client->getContainer(); | 26 | $container = $client->getContainer(); |
27 | 27 | ||
28 | $session = $container->get('session'); | ||
29 | /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ | 28 | /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ |
30 | $userManager = $container->get('fos_user.user_manager'); | 29 | $userManager = $container->get('fos_user.user_manager'); |
31 | /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ | 30 | /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ |
@@ -36,9 +35,10 @@ abstract class AbstractControllerTest extends WebTestCase | |||
36 | $loginManager->loginUser($firewallName, $user); | 35 | $loginManager->loginUser($firewallName, $user); |
37 | 36 | ||
38 | // save the login token into the session and put it in a cookie | 37 | // save the login token into the session and put it in a cookie |
39 | $container->get('session')->set('_security_'.$firewallName, | 38 | $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); |
40 | serialize($container->get('security.context')->getToken())); | ||
41 | $container->get('session')->save(); | 39 | $container->get('session')->save(); |
40 | |||
41 | $session = $container->get('session'); | ||
42 | $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId())); | 42 | $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId())); |
43 | 43 | ||
44 | return $client; | 44 | return $client; |