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