mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
adding budget to person menu
This commit is contained in:
parent
35aa05fb97
commit
1fdc994c0a
@ -15,19 +15,14 @@ use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
*/
|
||||
protected $authorizationChecker;
|
||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
@ -39,10 +34,10 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
/** @var \Chill\PersonBundle\Entity\Person $person */
|
||||
/** @var Person $person */
|
||||
$person = $parameters['person'];
|
||||
|
||||
if ($this->authorizationChecker->isGranted(BudgetElementVoter::SHOW, $person)) {
|
||||
// if ($this->authorizationChecker->isGranted(BudgetElementVoter::SHOW, $person)) {
|
||||
$menu->addChild(
|
||||
$this->translator->trans('Budget'),
|
||||
[
|
||||
@ -50,8 +45,8 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
'routeParameters' => ['id' => $person->getId()],
|
||||
]
|
||||
)
|
||||
->setExtra('order', 460);
|
||||
}
|
||||
->setExtra('order', 4000);
|
||||
// }
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
@ -1,7 +1,5 @@
|
||||
services:
|
||||
Chill\BudgetBundle\Menu\UserMenuBuilder:
|
||||
arguments:
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
Chill\BudgetBundle\Menu\PersonMenuBuilder:
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
@ -33,10 +33,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||
*/
|
||||
protected $showAccompanyingPeriod;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private Security $security;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user