Skip to content

Commit

Permalink
TASK: Properly re-remove obsolete legacy `userInformation.personalWor…
Browse files Browse the repository at this point in the history
…kspaceName` in policy for workspaces

`current.userInformation.personalWorkspaceName` (`UserService::getPersonalWorkspaceName()`) was initially removed in c3f51e2

because with multiple content repositories we cannot find out the value:

```php
public function getPersonalWorkspaceName(): ?string
{
    $currentUser = $this->userDomainService->getCurrentUser();
    $cr = 'default'; // TODO!!!
    $this->workspaceService->getPersonalWorkspaceForUser($cr, $currentUser);
    return $workspace->workspaceName->value;
}
```

This is luckily no longer needed as the now called `NodeAddressToNodeConverter` (which we decided to keep in Neos 9.0: neos#4873)
Will handle this itself through the security in `ContentRepository::getContentSubgraph()` via neos#5298

Additionally, this pr makes `UserService::getPersonalWorkspaceName()` throw and exception to ease upgrading as otherwise `NULL` will be evaluated.
  • Loading branch information
mhsdesign committed Jan 6, 2025
1 parent 8b6c4eb commit 1764550
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Neos.Neos/Classes/Service/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ public function getBackendUser()
return $this->userDomainService->getCurrentUser();
}

/**
* 8.3 behaviour: Returns the name of the currently logged in user's personal workspace
* (even if that might not exist at that time).
* If no user is logged in this method returns null.
*
* @deprecated and not implemented with Neos 9.0 - can be removed any time, just for the 8.3 upgrade phase
*/
public function getPersonalWorkspaceName(): ?string
{
throw new \LogicException('`userInformation.personalWorkspaceName` was removed in Neos 9.0 see https://github.com/neos/neos-development-collection/pull/5418');
}

/**
* Returns the stored preferences of a user
*
Expand Down
4 changes: 0 additions & 4 deletions Neos.Neos/Configuration/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ privilegeTargets:
label: Access to content service APIs
matcher: 'method(Neos\Neos\Controller\Backend\SchemaController->(nodeTypeSchema)Action()) || method(Neos\Neos\Controller\Backend\SettingsController->editPreviewAction())'

'Neos.Neos:Backend.PersonalWorkspaceReadAccess.NodeConverter':
label: Access to own personal workspace
matcher: 'method(Neos\Neos\TypeConverter\NodeConverter->prepareContextProperties(workspaceName === current.userInformation.personalWorkspaceName))'

'Neos.Neos:Backend.EditContent':
label: General access to content editing
matcher: 'method(Neos\Neos\Service\Controller\NodeController->(show|getPrimaryChildNode|getChildNodesForTree|filterChildNodesForTree|getChildNodes|getChildNodesFromParent|create|createAndRender|createNodeForTheTree|move|moveBefore|moveAfter|moveInto|moveAndRender|copy|copyBefore|copyAfter|copyInto|copyAndRender|update|updateAndRender|delete|searchPage|error)Action()) || method(Neos\Neos\Controller\Backend\ContentController->(uploadAsset|assetsWithMetadata|imageWithMetadata|createImageVariant|error)Action()) || method(Neos\Neos\Controller\Service\AssetProxiesController->(index|show|import|error)Action()) || method(Neos\Neos\Controller\Service\AssetsController->(index|show|error)Action()) || method(Neos\Neos\Controller\Service\NodesController->(index|show|create|error)Action())'
Expand Down

0 comments on commit 1764550

Please sign in to comment.