Skip to content

Commit

Permalink
[Security] remove role ROLE_RE_USER (#10889)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottaviano authored Oct 18, 2024
1 parent 25c80d7 commit a79c8d8
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Api/ResubscribeEmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[IsGranted('ROLE_USER')]
#[Route(path: '/resubscribe-email', name: 'api_resubscribe_email_payload', methods: ['GET'])]
#[Route(path: '/v3/resubscribe-config', methods: ['GET'])]
class ResubscribeEmailController extends AbstractController
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/OAuth/SsoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[IsGranted('IS_AUTHENTICATED_FULLY')]
#[IsGranted('ROLE_USER')]
#[Route(path: '/sso/{uuid}', name: 'app_front_oauth_sso', requirements: ['uuid' => '%pattern_uuid%'], methods: ['GET'])]
class SsoController extends AbstractController
{
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Renaissance/Adherent/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

#[IsGranted('ROLE_RENAISSANCE_USER')]
#[IsGranted('ROLE_USER')]
#[Route(path: '/espace-adherent/evenements', name: 'app_renaissance_event')]
class EventController extends AbstractController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[IsGranted('ROLE_RENAISSANCE_USER')]
#[IsGranted('ROLE_USER')]
#[Route(path: '/election-locale', name: 'app_renaissance_local_election_home', methods: 'GET')]
class LocalPollElectionController extends AbstractController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[IsGranted('ROLE_RENAISSANCE_USER')]
#[IsGranted('ROLE_USER')]
#[Route(path: '/changement-des-statuts/{uuid}', name: 'app_poll_election')]
class PollElectionController extends AbstractController
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[IsGranted('ROLE_RENAISSANCE_USER')]
#[IsGranted('ROLE_USER')]
#[Route(path: '/election-sas/{uuid}', name: 'app_sas_election')]
class SasElectionController extends AbstractController
{
Expand Down
4 changes: 0 additions & 4 deletions src/Entity/Adherent.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,6 @@ public function getRoles(): array
$roles[] = 'ROLE_CORRESPONDENT';
}

if ($this->isRenaissanceAdherent() || $this->isRenaissanceSympathizer()) {
$roles[] = 'ROLE_RENAISSANCE_USER';
}

// Must be at the end as it uses $roles array
if ($this->isAdherentMessageRedactor($roles)) {
$roles[] = 'ROLE_MESSAGE_REDACTOR';
Expand Down
2 changes: 1 addition & 1 deletion templates/adherent/my_activity_events.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{% if event is instanceof('App\\Entity\\Event\\CommitteeEvent') and event.committee %}
<div class="text--body">Organisé par le comité <span class="text--bold">{{ event.committee.name }}</span></div>
{% elseif event.organizer %}
<div class="text--body">Organisé par <span class="text--bold">{{ is_granted('IS_AUTHENTICATED_FULLY') ? event.organizer.fullName : event.organizer.partialName }}</span></div>
<div class="text--body">Organisé par <span class="text--bold">{{ is_granted('ROLE_USER') ? event.organizer.fullName : event.organizer.partialName }}</span></div>
{% endif %}
</div>

Expand Down
4 changes: 2 additions & 2 deletions templates/adherent_profile/activity/_events.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% if event is instanceof('App\\Entity\\Event\\CommitteeEvent') and event.committee %}
<div class="text--body text--gray b__nudge--bottom-small">Organisé par le comité <span class="text--black">{{ event.committee.name }}</span> à <span class="text--black">{{ event.cityName }}</span></div>
{% elseif event.organizer %}
<div class="text--body text--gray b__nudge--bottom-small">Organisé par <span class="text--black">{{ is_granted('IS_AUTHENTICATED_FULLY') ? event.organizer.fullName : event.organizer.partialName }}</span> à <span class="text--black">{{ event.cityName }}</span></div>
<div class="text--body text--gray b__nudge--bottom-small">Organisé par <span class="text--black">{{ is_granted('ROLE_USER') ? event.organizer.fullName : event.organizer.partialName }}</span> à <span class="text--black">{{ event.cityName }}</span></div>
{% endif %}
<div class="l__row l__row--wrap font-roboto text--gray b__nudge--bottom-small">
<div class="l__row b__nudge--bottom-small">
Expand Down Expand Up @@ -75,7 +75,7 @@
{% if event is instanceof('App\\Entity\\Event\\CommitteeEvent') and event.committee %}
<div class="text--body text--gray b__nudge--bottom-small">Organisé par le comité <span class="text--black">{{ event.committee.name }}</span> à <span class="text--black">{{ event.cityName }}</span></div>
{% elseif event.organizer %}
<div class="text--body text--gray b__nudge--bottom-small">Organisé par <span class="text--black">{{ is_granted('IS_AUTHENTICATED_FULLY') ? event.organizer.fullName : event.organizer.partialName }}</span> à <span class="text--black">{{ event.cityName }}</span></div>
<div class="text--body text--gray b__nudge--bottom-small">Organisé par <span class="text--black">{{ is_granted('ROLE_USER') ? event.organizer.fullName : event.organizer.partialName }}</span> à <span class="text--black">{{ event.cityName }}</span></div>
{% endif %}
<div class="l__row l__row--wrap font-roboto text--gray b__nudge--bottom-small">
<div class="l__row b__nudge--bottom-small">
Expand Down
4 changes: 2 additions & 2 deletions templates/events/_header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="l__row">
{% if event.organizer %}
<div class="committee-event-organizer text--body text--white">
Organisé par <span class="text--bold">{{ is_granted('IS_AUTHENTICATED_FULLY') ? event.organizer.fullName : event.organizer.partialName }}</span>
Organisé par <span class="text--bold">{{ is_granted('ROLE_USER') ? event.organizer.fullName : event.organizer.partialName }}</span>
{% if committee is defined and committee %}
du comité
<a class="link--white" href="{{ path('app_committee_show', {'slug': committee.slug}) }}">
Expand Down Expand Up @@ -49,7 +49,7 @@
{% endif %}
{% endif %}
{% endif %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{% if is_granted('ROLE_USER') %}
<div class="text--body text--white icon--with-text l__row--center b__nudge--top-10 committee-event-attendees event-attendees">
{{ include('components/participants.html.twig') }}
{{ 'participants_count'|trans({ count: event.participantsCount }) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{% if event is instanceof('App\\Entity\\Event\\CommitteeEvent') and event.committee %}
Par le comité <span class="font-medium text-gray-700">{{ event.committee.name }}</span>
{% elseif event.organizer %}
Par <span class="font-medium text-gray-700">{{ is_granted('IS_AUTHENTICATED_FULLY') ? event.organizer.fullName : event.organizer.partialName }}</span>
Par <span class="font-medium text-gray-700">{{ is_granted('ROLE_USER') ? event.organizer.fullName : event.organizer.partialName }}</span>
{% endif %}
</span>
</p>
Expand Down Expand Up @@ -83,4 +83,3 @@
} %}
{% endif %}
{% endif %}

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{% if event is instanceof('App\\Entity\\Event\\CommitteeEvent') and event.committee %}
Par le comité <span class="font-medium text-gray-700">{{ event.committee.name }}</span>
{% elseif event.organizer %}
Par <span class="font-medium text-gray-700">{{ is_granted('IS_AUTHENTICATED_FULLY') ? event.organizer.fullName : event.organizer.partialName }}</span>
Par <span class="font-medium text-gray-700">{{ is_granted('ROLE_USER') ? event.organizer.fullName : event.organizer.partialName }}</span>
{% endif %}
</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion templates/search/_events.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
Événement complet
</div>
{% endif %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
{% if is_granted('ROLE_USER') %}
<div class="text--body text--gray icon--with-text l__row--center">
{{ 'participants_count'|trans({ count: event.participantsCount }) }}
</div>
Expand Down

0 comments on commit a79c8d8

Please sign in to comment.