mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
require actual password for change + insert link in menu
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
namespace Chill\MainBundle\Routing\MenuBuilder;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,17 +28,40 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
*/
|
||||
class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var TokenStorageInterface
|
||||
*/
|
||||
protected $tokenStorage;
|
||||
|
||||
public function __construct(TokenStorageInterface $tokenStorage)
|
||||
{
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters)
|
||||
{
|
||||
$menu->addChild(
|
||||
if ($this->tokenStorage->getToken()->getUser() instanceof User) {
|
||||
$menu
|
||||
->addChild(
|
||||
'Change password',
|
||||
[ 'route' => 'change_my_password']
|
||||
)
|
||||
->setExtras([
|
||||
'order' => 99999999998
|
||||
]);
|
||||
}
|
||||
|
||||
$menu
|
||||
->addChild(
|
||||
'Logout',
|
||||
[
|
||||
'route' => 'logout'
|
||||
])
|
||||
->setExtras([
|
||||
'order'=> 99999999999,
|
||||
'icon' => 'power-off'
|
||||
]);
|
||||
->setExtras([
|
||||
'order'=> 99999999999,
|
||||
'icon' => 'power-off'
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
|
Reference in New Issue
Block a user