Les items sidebar peuvent declarer une cle `permission` optionnelle. Le SidebarProvider verifie isGranted() et masque les items dont l'utilisateur ne possede pas la permission requise. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Sidebar configuration.
|
|
*
|
|
* This file defines the sidebar sections displayed in the frontend.
|
|
* Each item references the module that owns it via the `module` key.
|
|
* Items whose module is not active (see config/modules.php) are filtered out.
|
|
* Items may also declare a `permission` key (RBAC permission code) : the item
|
|
* is hidden from users who do not hold that permission.
|
|
*
|
|
* This config is decoupled from the modules themselves: you can freely
|
|
* move an item from one section to another without touching the module code.
|
|
*
|
|
* Label keys are i18n keys resolved by the frontend (see frontend/i18n/locales/).
|
|
*/
|
|
|
|
return [
|
|
[
|
|
'label' => 'sidebar.general.section',
|
|
'icon' => 'mdi:view-dashboard-outline',
|
|
'items' => [
|
|
[
|
|
'label' => 'sidebar.general.dashboard',
|
|
'to' => '/',
|
|
'icon' => 'mdi:view-dashboard-outline',
|
|
'module' => 'core',
|
|
],
|
|
[
|
|
'label' => 'sidebar.general.admin',
|
|
'to' => '/admin',
|
|
'icon' => 'mdi:cog-outline',
|
|
'module' => 'core',
|
|
],
|
|
[
|
|
'label' => 'sidebar.core.roles',
|
|
'to' => '/admin/roles',
|
|
'icon' => 'mdi:shield-account-outline',
|
|
'module' => 'core',
|
|
'permission' => 'core.roles.view',
|
|
],
|
|
[
|
|
'label' => 'sidebar.core.users',
|
|
'to' => '/admin/users',
|
|
'icon' => 'mdi:account-group-outline',
|
|
'module' => 'core',
|
|
'permission' => 'core.users.view',
|
|
],
|
|
[
|
|
'label' => 'sidebar.general.logout',
|
|
'to' => '/logout',
|
|
'icon' => 'mdi:logout',
|
|
'module' => 'core',
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'label' => 'sidebar.commercial.section',
|
|
'icon' => 'mdi:account-arrow-left-outline',
|
|
'items' => [
|
|
[
|
|
'label' => 'sidebar.commercial.suppliers',
|
|
'to' => '/suppliers',
|
|
'icon' => 'mdi:account-arrow-left-outline',
|
|
'module' => 'commercial',
|
|
],
|
|
],
|
|
],
|
|
];
|