diff --git a/src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php deleted file mode 100644 index df7620f30..000000000 --- a/src/Bundle/ChillActivityBundle/Menu/MenuBuilder.php +++ /dev/null @@ -1,76 +0,0 @@ - - */ -class MenuBuilder implements LocalMenuBuilderInterface -{ - /** - * - * @var TokenStorageInterface - */ - protected $tokenStorage; - - /** - * - * @var TranslatorInterface - */ - protected $translator; - - /** - * - * @var AuthorizationHelper - */ - protected $authorizationHelper; - - public function __construct( - TokenStorageInterface $tokenStorage, - TranslatorInterface $translator, - AuthorizationHelper $authorizationHelper - ) { - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; - $this->authorizationHelper = $authorizationHelper; - } - - - public function buildMenu($menuId, MenuItem $menu, array $parameters) - { - /* @var $person \Chill\PersonBundle\Entity\Person */ - $person = $parameters['person']; - $user = $this->tokenStorage->getToken()->getUser(); - $roleSee = new Role(ActivityVoter::SEE); - $roleAdd = new Role(ActivityVoter::CREATE); - - if ($this->authorizationHelper->userHasAccess($user, $person, $roleSee)) { - $menu->addChild($this->translator->trans('Activity list'), [ - 'route' => 'chill_activity_activity_list', - 'routeParameters' => [ - 'person_id' => $person->getId() - ] - ]) - ->setExtras([ - 'order' => 201 - ]); - } - } - - public static function getMenuIds(): array - { - return [ 'person' ]; - } -} diff --git a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php index 7c8092227..e44a0f561 100644 --- a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php @@ -15,8 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -namespace Chill\ActivityBundle\Menu; - +namespace Chill\ActivityBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; @@ -65,15 +64,6 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface ->setExtra('order', 201) ; } - if ($this->authorizationChecker->isGranted(ActivityVoter::CREATE, $person)) { - $menu->addChild( - $this->translator->trans('Add a new activity'), [ - 'route' => 'chill_activity_activity_new', - 'routeParameters' => [ 'person_id' => $person->getId() ], - ]) - ->setExtra('order', 200) - ; - } } public static function getMenuIds(): array