options added to create person or parcours and to access global history

This commit is contained in:
2022-03-21 12:10:03 +01:00
parent ff5aeaae17
commit bdb07a3a05
6 changed files with 56 additions and 34 deletions

View File

@@ -114,6 +114,11 @@ class ChillMainExtension extends Extension implements
$config['available_countries']
);
$container->setParameter(
'chill_main.access_global_history',
$config['access_global_history']
);
$container->setParameter(
'chill_main.routing.resources',
$config['routing']['resources']

View File

@@ -113,6 +113,9 @@ class Configuration implements ConfigurationInterface
->end()
->end()
->end()
->booleanNode('access_global_history')
->defaultTrue()
->end()
->arrayNode('redis')
->children()
->scalarNode('host')

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
use Knp\Menu\MenuItem;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -22,23 +23,20 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class SectionMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
protected AuthorizationCheckerInterface $authorizationChecker;
/**
* @var TranslatorInterface
*/
protected $translator;
protected TranslatorInterface $translator;
protected ParameterBagInterface $parameterBag;
/**
* SectionMenuBuilder constructor.
*/
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator)
public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator, ParameterBagInterface $parameterBag)
{
$this->authorizationChecker = $authorizationChecker;
$this->translator = $translator;
$this->parameterBag = $parameterBag;
}
/**
@@ -54,14 +52,16 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
'order' => 0,
]);
$menu->addChild($this->translator->trans('Global timeline'), [
'route' => 'chill_center_timeline',
])
->setExtras(
[
'order' => 10,
]
);
if ($this->parameterBag->get('chill_main.access_global_history')) {
$menu->addChild($this->translator->trans('Global timeline'), [
'route' => 'chill_center_timeline',
])
->setExtras(
[
'order' => 10,
]
);
}
if ($this->authorizationChecker->isGranted(ChillExportVoter::EXPORT)) {
$menu->addChild($this->translator->trans('Export Menu'), [