diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php index 6e13ecb97..16199e780 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php @@ -1,12 +1,27 @@ addChild('Create a new activity in accompanying course', [ - 'route' => 'chill_activity_activity_new', - 'routeParameters' => [ - // 'activityType_id' => '', - 'accompanying_period_id' => $accompanyingCourse->getId() - ] - ]) - ->setExtras([ - 'order' => 10, - 'icon' => 'plus' - ]) - ; - + if ($this->security->isGranted(ActivityVoter::CREATE, $accompanyingCourse)) { + $menu + ->addChild('Create a new activity in accompanying course', [ + 'route' => 'chill_activity_activity_new', + 'routeParameters' => [ + // 'activityType_id' => '', + 'accompanying_period_id' => $accompanyingCourse->getId(), + ], + ]) + ->setExtras([ + 'order' => 10, + 'icon' => 'plus', + ]) + ; + } } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php index d98e9f2c8..a5ca99bf1 100644 --- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php @@ -1,12 +1,27 @@ addChild('Create a new calendar in accompanying course', [ - 'route' => 'chill_calendar_calendar_new', - 'routeParameters' => [ - //'accompanying_course_id' => $accompanyingCourse->getId() - ] - ]) - ->setExtras([ - 'order' => 20, - 'icon' => 'plus' - ]) - ; - + if ($this->security->isGranted(CalendarVoter::CREATE, $accompanyingCourse)) { + $menu + ->addChild('Create a new calendar in accompanying course', [ + 'route' => 'chill_calendar_calendar_new', + 'routeParameters' => [ + 'accompanying_period_id' => $accompanyingCourse->getId(), + ], + ]) + ->setExtras([ + 'order' => 20, + 'icon' => 'plus', + ]) + ; + } } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Menu/PersonQuickMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/PersonQuickMenuBuilder.php index a1b543662..5534791e4 100644 --- a/src/Bundle/ChillPersonBundle/Menu/PersonQuickMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/PersonQuickMenuBuilder.php @@ -1,5 +1,14 @@ authorizationChecker = $authorizationChecker; } public static function getMenuIds(): array @@ -28,18 +34,18 @@ class PersonQuickMenuBuilder implements LocalMenuBuilderInterface if ($this->authorizationChecker->isGranted(AccompanyingPeriodVoter::CREATE, $person)) { $menu->addChild( - 'Create Accompanying Course', [ + 'Create Accompanying Course', + [ 'route' => 'chill_person_accompanying_course_new', 'routeParameters' => [ - 'person_id' => [ $person->getId() ], + 'person_id' => [$person->getId()], ], ] ) - ->setExtras([ - 'order' => 10, - 'icon' => 'plus' - ]); + ->setExtras([ + 'order' => 10, + 'icon' => 'plus', + ]); } } - -} \ No newline at end of file +}