Skip to content

Commit

Permalink
WIP: Adjust to Content Repository Privileges
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Oct 21, 2024
1 parent 1831094 commit 4d628a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Classes/Fusion/Helper/WorkspaceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Neos\Flow\Security\Context;
use Neos\Neos\Domain\Service\UserService;
use Neos\Neos\Domain\Service\WorkspaceService;
use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService;
use Neos\Neos\Ui\ContentRepository\Service\WorkspaceService as UiWorkspaceService;

/**
Expand Down Expand Up @@ -55,6 +56,12 @@ class WorkspaceHelper implements ProtectedContextAwareInterface
*/
protected $workspaceService;

/**
* @Flow\Inject
* @var ContentRepositoryAuthorizationService
*/
protected $contentRepositoryAuthorizationService;

/**
* @return array<string,mixed>
*/
Expand All @@ -66,7 +73,7 @@ public function getPersonalWorkspace(ContentRepositoryId $contentRepositoryId):
}
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$personalWorkspace = $this->workspaceService->getPersonalWorkspaceForUser($contentRepositoryId, $currentUser->getId());
$personalWorkspacePermissions = $this->workspaceService->getWorkspacePermissionsForUser($contentRepositoryId, $personalWorkspace->workspaceName, $currentUser);
$personalWorkspacePermissions = $this->contentRepositoryAuthorizationService->getWorkspacePermissionsForUser($contentRepositoryId, $personalWorkspace->workspaceName, $currentUser);
$publishableNodes = $this->uiWorkspaceService->getPublishableNodeInfo($personalWorkspace->workspaceName, $contentRepository->id);
return [
'name' => $personalWorkspace->workspaceName->value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Neos\Flow\Mvc\Routing\UriBuilder;
use Neos\Neos\Domain\Model\WorkspaceClassification;
use Neos\Neos\Domain\Service\WorkspaceService;
use Neos\Neos\Security\Authorization\ContentRepositoryAuthorizationService;
use Neos\Neos\Service\UserService;
use Neos\Neos\Ui\Domain\InitialData\CacheConfigurationVersionProviderInterface;
use Neos\Neos\Ui\Domain\InitialData\ConfigurationProviderInterface;
Expand All @@ -39,6 +40,9 @@ final class ConfigurationProvider implements ConfigurationProviderInterface
#[Flow\Inject]
protected WorkspaceService $workspaceService;

#[Flow\Inject]
protected ContentRepositoryAuthorizationService $contentRepositoryAuthorizationService;

#[Flow\Inject]
protected CacheConfigurationVersionProviderInterface $cacheConfigurationVersionProvider;

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

0 comments on commit 4d628a4

Please sign in to comment.