mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-29 06:18:26 +02:00
Check for permissions to access settings menu and added settings menu to sidebar menu
This commit is contained in:
parent
b9c3358f7f
commit
38c826713f
5 changed files with 31 additions and 14 deletions
|
@ -40,6 +40,8 @@ class SettingsController extends AbstractController
|
|||
#[Route("/settings", name: "system_settings")]
|
||||
public function systemSettings(Request $request, TagAwareCacheInterface $cache): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('@config.change_system_settings');
|
||||
|
||||
//Create a clone of the settings object
|
||||
$settings = $this->settingsManager->createTemporaryCopy(AppSettings::class);
|
||||
|
||||
|
@ -62,9 +64,6 @@ class SettingsController extends AbstractController
|
|||
$cache->invalidateTags(['tree_treeview', 'sidebar_tree_update']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Render the form
|
||||
return $this->render('settings/settings.html.twig', [
|
||||
'form' => $form
|
||||
|
|
|
@ -289,6 +289,13 @@ class ToolsTreeBuilder
|
|||
))->setIcon('fa-fw fa-treeview fa-solid fa-database');
|
||||
}
|
||||
|
||||
if ($this->security->isGranted('@config.change_system_settings')) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.system.settings'),
|
||||
$this->urlGenerator->generate('system_settings')
|
||||
))->setIcon('fa fa-fw fa-gears fa-solid');
|
||||
}
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,9 @@ class PermissionPresetsHelper
|
|||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'suppliers', PermissionData::ALLOW);
|
||||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'projects', PermissionData::ALLOW);
|
||||
|
||||
//Allow to change system settings
|
||||
$this->permissionResolver->setPermission($perm_holder, 'config', 'change_system_settings', PermissionData::ALLOW);
|
||||
|
||||
//Allow to manage Oauth tokens
|
||||
$this->permissionResolver->setPermission($perm_holder, 'system', 'manage_oauth_tokens', PermissionData::ALLOW);
|
||||
//Allow to show updates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue