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,56 @@
|
||||
<?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 AdminLanguageMenuBuilder 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('Languages and countries', [
|
||||
'route' => 'chill_main_language_admin',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 1200, 'header' => true]);
|
||||
|
||||
$menu->addChild('Language list', [
|
||||
'route' => 'chill_crud_main_language_index',
|
||||
])->setExtras(['order' => 1210]);
|
||||
|
||||
$menu->addChild('Country list', [
|
||||
'route' => 'chill_crud_main_country_index',
|
||||
])->setExtras(['order' => 1220]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_language'];
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
<?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 AdminLocationMenuBuilder 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('Location and location type', [
|
||||
'route' => 'chill_main_location_admin',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 1300, 'header' => true]);
|
||||
|
||||
$menu->addChild('Location type list', [
|
||||
'route' => 'chill_crud_main_location_type_index',
|
||||
])->setExtras(['order' => 1310]);
|
||||
|
||||
$menu->addChild('Location list', [
|
||||
'route' => 'chill_crud_main_location_index',
|
||||
])->setExtras(['order' => 1320]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_location'];
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
class AdminUserMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationCheckerInterface
|
||||
@@ -34,7 +34,9 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$menu->addChild('Users and permissions')
|
||||
$menu->addChild('Users and permissions', [
|
||||
'route' => 'chill_main_user_admin',
|
||||
])
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 1000, 'header' => true]);
|
||||
|
||||
@@ -57,34 +59,10 @@ class AdminSectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
$menu->addChild('User jobs', [
|
||||
'route' => 'chill_crud_admin_user_job_index',
|
||||
])->setExtras(['order' => 1050]);
|
||||
|
||||
$menu->addChild('Languages and countries')
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 1200, 'header' => true]);
|
||||
|
||||
$menu->addChild('Language list', [
|
||||
'route' => 'chill_crud_main_language_index',
|
||||
])->setExtras(['order' => 1210]);
|
||||
|
||||
$menu->addChild('Country list', [
|
||||
'route' => 'chill_crud_main_country_index',
|
||||
])->setExtras(['order' => 1220]);
|
||||
|
||||
$menu->addChild('Location and location type')
|
||||
->setAttribute('class', 'list-group-item-header')
|
||||
->setExtras(['order' => 1300, 'header' => true]);
|
||||
|
||||
$menu->addChild('Location type list', [
|
||||
'route' => 'chill_crud_main_location_type_index',
|
||||
])->setExtras(['order' => 1310]);
|
||||
|
||||
$menu->addChild('Location list', [
|
||||
'route' => 'chill_crud_main_location_index',
|
||||
])->setExtras(['order' => 1320]);
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_section', 'admin_index'];
|
||||
return ['admin_section', 'admin_user'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user