Skip to content

Commit 4d628a4

Browse files
committed
WIP: Adjust to Content Repository Privileges
Counter-part for neos/neos-development-collection#5298
1 parent 1831094 commit 4d628a4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Classes/Fusion/Helper/WorkspaceHelper.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Neos\Flow\Security\Context;
1919
use Neos\Neos\Domain\Service\UserService;
2020
use Neos\Neos\Domain\Service\WorkspaceService;
21+
use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService;
2122
use Neos\Neos\Ui\ContentRepository\Service\WorkspaceService as UiWorkspaceService;
2223

2324
/**
@@ -55,6 +56,12 @@ class WorkspaceHelper implements ProtectedContextAwareInterface
5556
*/
5657
protected $workspaceService;
5758

59+
/**
60+
* @Flow\Inject
61+
* @var ContentRepositoryAuthorizationService
62+
*/
63+
protected $contentRepositoryAuthorizationService;
64+
5865
/**
5966
* @return array<string,mixed>
6067
*/
@@ -66,7 +73,7 @@ public function getPersonalWorkspace(ContentRepositoryId $contentRepositoryId):
6673
}
6774
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
6875
$personalWorkspace = $this->workspaceService->getPersonalWorkspaceForUser($contentRepositoryId, $currentUser->getId());
69-
$personalWorkspacePermissions = $this->workspaceService->getWorkspacePermissionsForUser($contentRepositoryId, $personalWorkspace->workspaceName, $currentUser);
76+
$personalWorkspacePermissions = $this->contentRepositoryAuthorizationService->getWorkspacePermissionsForUser($contentRepositoryId, $personalWorkspace->workspaceName, $currentUser);
7077
$publishableNodes = $this->uiWorkspaceService->getPublishableNodeInfo($personalWorkspace->workspaceName, $contentRepository->id);
7178
return [
7279
'name' => $personalWorkspace->workspaceName->value,

Classes/Infrastructure/Configuration/ConfigurationProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Neos\Flow\Mvc\Routing\UriBuilder;
2121
use Neos\Neos\Domain\Model\WorkspaceClassification;
2222
use Neos\Neos\Domain\Service\WorkspaceService;
23+
use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService;
2324
use Neos\Neos\Service\UserService;
2425
use Neos\Neos\Ui\Domain\InitialData\CacheConfigurationVersionProviderInterface;
2526
use Neos\Neos\Ui\Domain\InitialData\ConfigurationProviderInterface;
@@ -39,6 +40,9 @@ final class ConfigurationProvider implements ConfigurationProviderInterface
3940
#[Flow\Inject]
4041
protected WorkspaceService $workspaceService;
4142

43+
#[Flow\Inject]
44+
protected ContentRepositoryAuthorizationService $contentRepositoryAuthorizationService;
45+
4246
#[Flow\Inject]
4347
protected CacheConfigurationVersionProviderInterface $cacheConfigurationVersionProvider;
4448

@@ -103,7 +107,7 @@ private function getAllowedTargetWorkspaces(ContentRepository $contentRepository
103107
if (!in_array($workspaceMetadata->classification, [WorkspaceClassification::ROOT, WorkspaceClassification::SHARED], true)) {
104108
continue;
105109
}
106-
$workspacePermissions = $this->workspaceService->getWorkspacePermissionsForUser($contentRepository->id, $workspace->workspaceName, $backendUser);
110+
$workspacePermissions = $this->contentRepositoryAuthorizationService->getWorkspacePermissionsForUser($contentRepository->id, $workspace->workspaceName, $backendUser);
107111
if ($workspacePermissions->read === false) {
108112
continue;
109113
}

0 commit comments

Comments
 (0)