Finished builtin footprints viewer tool.

This commit is contained in:
Jan Böhmer 2023-01-09 23:40:54 +01:00
parent f84d1f8a8f
commit 04b660d777
7 changed files with 39 additions and 10 deletions

View file

@ -90,12 +90,14 @@ class ToolsController extends AbstractController
}
/**
* @Route("/builtin_footprints")
* @Route("/builtin_footprints", name="tools_builtin_footprints_viewer")
* @param AttachmentPathResolver $pathResolver
* @return Response
*/
public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator, ): Response
{
$this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer');
$grouped_footprints = $builtinAttachmentsFinder->getListOfFootprintsGroupedByFolder();
$grouped_footprints = array_map(function($group) use ($urlGenerator) {
return array_map(function($placeholder_filepath) use ($urlGenerator) {

View file

@ -131,6 +131,12 @@ class ToolsTreeBuilder
$this->urlGenerator->generate('tools_reel_calculator')
))->setIcon('fa-treeview fa-fw fa-solid fa-ruler');
}
if ($this->security->isGranted('@tools.builtin_footprints_viewer')) {
$nodes[] = (new TreeViewNode(
$this->translator->trans('tools.builtin_footprints_viewer.title'),
$this->urlGenerator->generate('tools_builtin_footprints_viewer')
))->setIcon('fa-treeview fa-fw fa-solid fa-images');
}
return $nodes;
}

View file

@ -139,6 +139,7 @@ class PermissionPresetsHelper
$this->permissionResolver->setPermission($perm_holder, 'tools', 'statistics', PermissionData::ALLOW);
$this->permissionResolver->setPermission($perm_holder, 'tools', 'label_scanner', PermissionData::ALLOW);
$this->permissionResolver->setPermission($perm_holder, 'tools', 'reel_calculator', PermissionData::ALLOW);
$this->permissionResolver->setPermission($perm_holder, 'tools', 'builtin_footprints_viewer', PermissionData::ALLOW);
//Set attachments permissions
$this->permissionResolver->setPermission($perm_holder, 'attachments', 'list_attachments', PermissionData::ALLOW);