mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 01:49:05 +02:00
Deny access to part import tool without permission and added to tools menu
This commit is contained in:
parent
bd5ee837f4
commit
9ac8098f15
2 changed files with 8 additions and 0 deletions
|
@ -56,6 +56,8 @@ class PartImportExportController extends AbstractController
|
|||
*/
|
||||
public function importParts(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('@parts.import');
|
||||
|
||||
$import_form = $this->createForm(ImportType::class, ['entity_class' => Part::class]);
|
||||
$import_form->handleRequest($request);
|
||||
|
||||
|
|
|
@ -143,6 +143,12 @@ class ToolsTreeBuilder
|
|||
$this->urlGenerator->generate('tools_ic_logos')
|
||||
))->setIcon('fa-treeview fa-fw fa-solid fa-flag');
|
||||
}
|
||||
if ($this->security->isGranted('@parts.import')) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('parts.import.title'),
|
||||
$this->urlGenerator->generate('parts_import')
|
||||
))->setIcon('fa-treeview fa-fw fa-solid fa-file-import');
|
||||
}
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue