mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[main] allow hide change user password menu
This commit is contained in:
parent
8eef073988
commit
f77031630f
@ -11,6 +11,7 @@ and this project adheres to
|
||||
## Unreleased
|
||||
|
||||
<!-- write down unreleased development here -->
|
||||
* [main] allow hide change user password menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
* [main] filter user jobs by active jobs (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
* [main] add civility to User (entity, migration and form type) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/577)
|
||||
|
||||
|
@ -129,6 +129,11 @@ class ChillMainExtension extends Extension implements
|
||||
$config['access_global_history']
|
||||
);
|
||||
|
||||
$container->setParameter(
|
||||
'chill_main.access_user_change_password',
|
||||
$config['access_user_change_password']
|
||||
);
|
||||
|
||||
$container->setParameter(
|
||||
'chill_main.routing.resources',
|
||||
$config['routing']['resources']
|
||||
|
@ -116,6 +116,9 @@ class Configuration implements ConfigurationInterface
|
||||
->booleanNode('access_global_history')
|
||||
->defaultTrue()
|
||||
->end()
|
||||
->booleanNode('access_user_change_password')
|
||||
->defaultTrue()
|
||||
->end()
|
||||
->arrayNode('redis')
|
||||
->children()
|
||||
->scalarNode('host')
|
||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Notification\Counter\NotificationByUserCounter;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\MainBundle\Workflow\Counter\WorkflowByUserCounter;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
@ -28,16 +29,20 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
private WorkflowByUserCounter $workflowByUserCounter;
|
||||
|
||||
protected ParameterBagInterface $parameterBag;
|
||||
|
||||
public function __construct(
|
||||
NotificationByUserCounter $notificationByUserCounter,
|
||||
WorkflowByUserCounter $workflowByUserCounter,
|
||||
Security $security,
|
||||
TranslatorInterface $translator
|
||||
TranslatorInterface $translator,
|
||||
ParameterBagInterface $parameterBag
|
||||
) {
|
||||
$this->notificationByUserCounter = $notificationByUserCounter;
|
||||
$this->workflowByUserCounter = $workflowByUserCounter;
|
||||
$this->security = $security;
|
||||
$this->translator = $translator;
|
||||
$this->parameterBag = $parameterBag;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters)
|
||||
@ -85,14 +90,16 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
'order' => 700,
|
||||
]);
|
||||
|
||||
$menu
|
||||
->addChild(
|
||||
'Change password',
|
||||
['route' => 'change_my_password']
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 99999999998,
|
||||
]);
|
||||
if ($this->parameterBag->get('chill_main.access_user_change_password')) {
|
||||
$menu
|
||||
->addChild(
|
||||
'Change password',
|
||||
['route' => 'change_my_password']
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 99999999998,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$menu
|
||||
|
Loading…
x
Reference in New Issue
Block a user