Merge branch 'EventVoter' into sf3

This commit is contained in:
2019-01-25 18:19:29 +01:00
5 changed files with 133 additions and 110 deletions

View File

@@ -2,7 +2,9 @@ services:
chill_event.event_voter:
class: Chill\EventBundle\Security\Authorization\EventVoter
arguments:
- "@security.access.decision_manager"
- "@chill.main.security.authorization.helper"
- "@logger"
tags:
- { name: chill.role }
- { name: security.voter }

View File

@@ -1,8 +1,7 @@
services:
Chill\EventBundle\Menu\PersonMenuBuilder:
arguments:
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
$translator: '@Symfony\Component\Translation\TranslatorInterface'
tags:
- { name: 'chill.menu_builder' }

View File

@@ -46,46 +46,13 @@
<td>
<ul class="record_actions">
<li>
{% set currentPath = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
{% set returnLabel = 'Back to %person% events'|trans({ '%person%' : currentPerson } ) %}
{# temporaire --
TODO corriger EventVoter.php pour régler les autorisations sur les boutons, puis remplacer ci-dessous par le code commenté #}
<a href="{{ path('chill_event__event_show', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-show" title="{{ 'See details of the event'|trans }}"></a>
<div class="bt-dropdown">
<a href="" class="sc-button bt-update"></a>
<div class="bt-dropdown-content">
<a href="{{ path('chill_event__event_edit', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Edit the event'|trans }}
</a>
<a href="{{ path('chill_event_participation_edit', {
'participation_id' : participation.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Edit the participation'|trans }}
</a>
</div>
</div>
{#
{% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %}
<a href="{{ path('chill_event__event_show', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
} ) }}" class="sc-button bt-show"></a>
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel } ) }}"
class="sc-button bt-show" title="{{ 'See details of the event'|trans }}"></a>
{% endif %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event)
@@ -95,18 +62,13 @@
<a href="" class="sc-button bt-update"></a>
<div class="bt-dropdown-content">
<a href="{{ path('chill_event__event_edit', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Event edit'|trans }}
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the event'|trans }}
</a>
<a href="{{ path('chill_event_participation_edit', {
'participation_id' : participation.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Participation Edit'|trans }}
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the participation'|trans }}
</a>
</div>
@@ -114,25 +76,20 @@
{% else %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) %}
<a href="{{ path('chill_event__event_edit', {
'event_id' : participation.event.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Event edit'|trans }}
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the event'|trans }}
</a>
{% endif %}
{% if is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<a href="{{ path('chill_event_participation_edit', {
'participation_id' : participation.id,
'return_path' : currentPath,
'return_label' : returnLabel
}) }}" class="sc-button bt-update">{{ 'Participation Edit'|trans }}
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the participation'|trans }}
</a>
{% endif %}
{% endif %}
#}
</li>
</ul>
</td>