diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index f7e3b3800..830f85e9a 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -248,6 +248,8 @@ class AccompanyingCourseController extends Controller */ public function newAction(Request $request): Response { + $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::CREATE); + $period = new AccompanyingPeriod(); $em = $this->getDoctrine()->getManager(); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig index f30bfc45a..15b659ac4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig @@ -17,12 +17,14 @@ class="btn btn-cancel">{{ 'Person details'|trans }} + {% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE') %}
  • {{ 'Create an accompanying period'|trans }}
  • + {% endif %} {# Disabled dropdown