diff --git a/templates/my_area/index.html.twig b/templates/my_area/index.html.twig index 70bd6716b..8dacdb5d4 100644 --- a/templates/my_area/index.html.twig +++ b/templates/my_area/index.html.twig @@ -12,6 +12,11 @@

{{ 'user.myarea.description'|trans }}

+ {% if is_granted('ROLE_SUPER_ADMIN') %} + + {{ 'common.admin'|trans }} + + {% endif %} {{ 'common.logout'|trans }} diff --git a/tests/Integration/Infrastructure/Controller/MyArea/IndexControllerTest.php b/tests/Integration/Infrastructure/Controller/MyArea/IndexControllerTest.php index be10f4698..6c80e1088 100644 --- a/tests/Integration/Infrastructure/Controller/MyArea/IndexControllerTest.php +++ b/tests/Integration/Infrastructure/Controller/MyArea/IndexControllerTest.php @@ -4,6 +4,7 @@ namespace App\Tests\Integration\Infrastructure\Controller\MyArea; +use App\Infrastructure\Persistence\Doctrine\Fixtures\UserFixture; use App\Tests\Integration\Infrastructure\Controller\AbstractWebTestCase; final class IndexControllerTest extends AbstractWebTestCase @@ -21,6 +22,16 @@ public function testIndex(): void $organizations = $crawler->filter('[data-testid="organization-list"]'); $this->assertCount(1, $organizations->filter('[data-testid="organization-detail"]')); $this->assertSame('Main Org Contributeur', $organizations->filter('[data-testid="organization-detail"]')->text()); + $this->assertCount(0, $crawler->filter('[data-testid="admin-link"]')); + } + + public function testIndexAsAdmin(): void + { + $client = $this->login(UserFixture::MAIN_ORG_ADMIN_EMAIL); + $crawler = $client->request('GET', '/mon-espace'); + + $this->assertResponseStatusCodeSame(200); + $this->assertCount(1, $crawler->filter('[data-testid="admin-link"]')); } public function testWithoutAuthenticatedUser(): void diff --git a/translations/messages.fr.xlf b/translations/messages.fr.xlf index 678bdd4cb..177bf85e7 100644 --- a/translations/messages.fr.xlf +++ b/translations/messages.fr.xlf @@ -18,6 +18,10 @@ common.blog Blog + + common.admin + Administration + common.and et