From f7b2c73e0e44de517916b5377373761d34d7259f Mon Sep 17 00:00:00 2001 From: Camille Simiand <camille.simiand@tetras-libre.fr> Date: Thu, 9 Dec 2021 10:23:10 +0100 Subject: [PATCH] Update access control roles for my capsules page --- config/packages/security.yaml | 4 ++-- src/Controller/CapsuleController.php | 4 ---- tests/functional/RegistrationControllerTest.php | 6 +++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index bfb5e2f..5d52eb4 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -36,5 +36,5 @@ security: # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - # - { path: ^/admin, roles: ROLE_ADMIN } - # - { path: ^/profile, roles: ROLE_USER } + - { path: ^/my_capsules, roles: ROLE_USER } + diff --git a/src/Controller/CapsuleController.php b/src/Controller/CapsuleController.php index 4449135..8680194 100644 --- a/src/Controller/CapsuleController.php +++ b/src/Controller/CapsuleController.php @@ -13,10 +13,6 @@ class CapsuleController extends AbstractController */ public function index(): Response { - if (! $this->getUser()) { - return $this->redirectToRoute('app_login'); - } - return $this->render('capsule/index.html.twig', [ 'controller_name' => 'CapsuleController', ]); diff --git a/tests/functional/RegistrationControllerTest.php b/tests/functional/RegistrationControllerTest.php index da92490..30bd7bc 100644 --- a/tests/functional/RegistrationControllerTest.php +++ b/tests/functional/RegistrationControllerTest.php @@ -44,7 +44,7 @@ class RegistrationControllerTest extends WebTestCase $this->registerUser($userEmail, $client); - $this->checkEmailHasBeenSentAndGetEmail($userEmail); + $this->checkEmailHasBeenSentAndGetEmailMessage($userEmail); } public function testEmailValidationRegistrationShouldEnableUser(): void @@ -53,7 +53,7 @@ class RegistrationControllerTest extends WebTestCase $client = static::createClient(); $this->registerUser($userEmail, $client); - $emailMessage = $this->checkEmailHasBeenSentAndGetEmail($userEmail); + $emailMessage = $this->checkEmailHasBeenSentAndGetEmailMessage($userEmail); $client->followRedirect(); $this->clickOnEmailMessageLink($emailMessage, $client); @@ -81,7 +81,7 @@ class RegistrationControllerTest extends WebTestCase * @param string $userEmail The registered user email * @return RawMessage The email message sent to the user */ - private function checkEmailHasBeenSentAndGetEmail(string $userEmail): RawMessage + private function checkEmailHasBeenSentAndGetEmailMessage(string $userEmail): RawMessage { $this->assertEmailCount( 1, -- GitLab