public function renderToolbarAction(Workspace $workspace, Request $request)
    {
        $orderedTools = [];

        $hasManagerAccess = $this->workspaceManager->isManager($workspace, $this->tokenStorage->getToken());
        $hideToolsMenu = $this->workspaceManager->isToolsMenuHidden($workspace);
        $this->toolManager->addMissingWorkspaceTools($workspace);

        if ($hasManagerAccess || !$hideToolsMenu) {
            // load tool list
            if ($hasManagerAccess) {
                // gets all available tools
                $orderedTools = $this->toolManager->getOrderedToolsByWorkspace($workspace);
                // always display tools to managers
                $hideToolsMenu = false;
            } else {
                // gets accessible tools by user
                $currentRoles = $this->utils->getRoles($this->tokenStorage->getToken());
                $orderedTools = $this->toolManager->getOrderedToolsByWorkspaceAndRoles($workspace, $currentRoles);
            }
        }

        $current = null;
        if ('claro_workspace_open_tool' === $request->get('_route')) {
            $params = $request->get('_route_params');
            if (!empty($params['toolName'])) {
                $current = $params['toolName'];
            }
        }

        // mega hack to make the resource manager active when inside a resource
        if (in_array($request->get('_route'), ['claro_resource_show', 'claro_resource_show_short'])) {
            $current = 'resource_manager';
        }

        return [
            'current' => $current,
            'tools' => array_values(array_map(function (OrderedTool $orderedTool) use ($workspace) { // todo : create a serializer
                return [
                    'icon' => $orderedTool->getTool()->getClass(),
                    'name' => $orderedTool->getTool()->getName(),
                    'open' => ['claro_workspace_open_tool', ['workspaceId' => $workspace->getId(), 'toolName' => $orderedTool->getTool()->getName()]],
                ];
            }, $orderedTools)),
            'workspace' => $workspace,
            'hideToolsMenu' => $hideToolsMenu,
        ];
    }