mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
admin sections for main bundle
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?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 AdminUserMenuBuilder 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_user_admin',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 1000, 'header' => true]);
|
||||
|
||||
$menu->addChild('Center list', [
|
||||
'route' => 'admin_center',
|
||||
])->setExtras(['order' => 1010]);
|
||||
|
||||
$menu->addChild('List circles', [
|
||||
'route' => 'admin_scope',
|
||||
])->setExtras(['order' => 1020]);
|
||||
|
||||
$menu->addChild('Permissions group list', [
|
||||
'route' => 'admin_permissionsgroup',
|
||||
])->setExtras(['order' => 1030]);
|
||||
|
||||
$menu->addChild('crud.admin_user.index.title', [
|
||||
'route' => 'chill_crud_admin_user_index',
|
||||
])->setExtras(['order' => 1040]);
|
||||
|
||||
$menu->addChild('User jobs', [
|
||||
'route' => 'chill_crud_admin_user_job_index',
|
||||
])->setExtras(['order' => 1050]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_user'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user