mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 22:16:14 +00:00
61 lines
1.7 KiB
PHP
61 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\MainBundle\Routing\MenuBuilder;
|
|
|
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
|
use Knp\Menu\MenuItem;
|
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
|
|
|
class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
|
|
{
|
|
/**
|
|
* @var AuthorizationCheckerInterface
|
|
*/
|
|
protected $authorizationChecker;
|
|
|
|
public function __construct(AuthorizationCheckerInterface $authorizationChecker)
|
|
{
|
|
$this->authorizationChecker = $authorizationChecker;
|
|
}
|
|
|
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
|
{
|
|
// all the entries below must have ROLE_ADMIN permissions
|
|
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
|
|
return;
|
|
}
|
|
|
|
$menu->addChild('Users and permissions', [
|
|
'route' => 'chill_main_admin_permissions',
|
|
])
|
|
->setExtras([
|
|
'icons' => ['key'],
|
|
'order' => 200,
|
|
'explain' => 'Configure permissions for users',
|
|
]);
|
|
|
|
$menu->addChild('Location and location type', [
|
|
'route' => 'chill_main_admin_locations',
|
|
])
|
|
->setExtras([
|
|
'icons' => ['key'],
|
|
'order' => 205,
|
|
'explain' => 'Configure location and location type',
|
|
]);
|
|
}
|
|
|
|
public static function getMenuIds(): array
|
|
{
|
|
return ['admin_section', 'admin_index'];
|
|
}
|
|
}
|