Skip to content

Commit

Permalink
BUGFIX: Show workspaces in overview if their parent workspace is not …
Browse files Browse the repository at this point in the history
…accessible

we do this by checking if a workspaces base workspace does not appear in the list of workspaces.

This is also true for the live workspace as its not part of the list so the

`entryWorkspace.baseWorkspaceName == 'live'` check is now obsolete but it shows better what we are trying to do here for the normal case :D

Also the dropdown of base workspaces must always show the current option even if it would not be re changeable in the current permission set from the current user.
  • Loading branch information
mhsdesign committed Jan 8, 2025
1 parent a7d6cc1 commit f3fe1d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,16 @@ protected function prepareBaseWorkspaceOptions(
$user = $this->userService->getCurrentUser();
$baseWorkspaceOptions = [];
$workspaces = $contentRepository->findWorkspaces();
$editedWorkspace = $editedWorkspaceName ? $workspaces->get($editedWorkspaceName) : null;
if ($editedWorkspace?->baseWorkspaceName !== null) {
// ensure that the current base workspace is always part of the list even if permissions are not granted
$workspaceMetadata = $this->workspaceService->getWorkspaceMetadata(
$contentRepository->id,
$editedWorkspace->baseWorkspaceName
);
$baseWorkspaceOptions[$editedWorkspace->baseWorkspaceName->value] = $workspaceMetadata->title->value;
}

foreach ($workspaces as $workspace) {
if ($editedWorkspaceName !== null) {
if ($workspace->workspaceName->equals($editedWorkspaceName)) {
Expand Down Expand Up @@ -1210,7 +1220,6 @@ protected function getWorkspaceListItems(
continue;
}

// TODO: If user is allowed to edit child workspace, we need to at least show the parent workspaces in the list
if ($workspacesPermissions->read === false) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ prototype(Neos.Workspace.Ui:Component.WorkspaceTable) < prototype(Neos.Fusion:Co
<tbody>
<Neos.Workspace.Ui:Component.WorkspaceTreeNode
workspaceListItems={props.workspaceListItems}
baseWorkspaceListItems={Array.filter(props.workspaceListItems, (entryWorkspace) => entryWorkspace.baseWorkspaceName == 'live')}
baseWorkspaceListItems={Array.filter(props.workspaceListItems, (entryWorkspace) =>
entryWorkspace.baseWorkspaceName == 'live'
|| !Array.some(props.workspaceListItems, (workspace) => entryWorkspace.baseWorkspaceName == workspace.name)
)}
/>
</tbody>
</table>
Expand Down

0 comments on commit f3fe1d0

Please sign in to comment.