Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/8.4' into 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Jan 16, 2025
2 parents 36781f8 + 7476324 commit 255366d
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 13 deletions.
31 changes: 29 additions & 2 deletions Neos.Media.Browser/Classes/Controller/UsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Security\Context as SecurityContext;
use Neos\Media\Domain\Model\AssetInterface;
use Neos\Media\Domain\Service\AssetService;
use Neos\Neos\AssetUsage\Dto\AssetUsageReference;
Expand Down Expand Up @@ -79,6 +78,12 @@ class UsageController extends ActionController
*/
protected $contentRepositoryAuthorizationService;

/**
* @Flow\Inject
* @var PrivilegeManagerInterface
*/
protected $privilegeManager;

Check failure on line 85 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Property Neos\Media\Browser\Controller\UsageController::$privilegeManager has unknown class Neos\Media\Browser\Controller\PrivilegeManagerInterface as its type.

Check failure on line 85 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Property Neos\Media\Browser\Controller\UsageController::$privilegeManager has unknown class Neos\Media\Browser\Controller\PrivilegeManagerInterface as its type.

/**
* Get Related Nodes for an asset
*
Expand Down Expand Up @@ -120,6 +125,7 @@ public function relatedNodesAction(AssetInterface $asset)
$workspacePermissions = $this->contentRepositoryAuthorizationService->getWorkspacePermissions($currentContentRepositoryId, $usage->getWorkspaceName(), $this->securityContext->getRoles(), $this->userService->getBackendUser()?->getId());

Check failure on line 125 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Call to method getRoles() on an unknown class Neos\Media\Browser\Controller\SecurityContext.

Check failure on line 125 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Call to method getRoles() on an unknown class Neos\Media\Browser\Controller\SecurityContext.
$workspace = $contentRepository->findWorkspaceByName($usage->getWorkspaceName());

$inaccessibleRelation['label'] = $this->getLabelForInaccessibleWorkspace($workspace);

Check failure on line 128 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Parameter #1 $workspace of method Neos\Media\Browser\Controller\UsageController::getLabelForInaccessibleWorkspace() expects Neos\Media\Browser\Controller\Workspace, Neos\ContentRepository\Core\SharedModel\Workspace\Workspace|null given.

Check failure on line 128 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Parameter #1 $workspace of method Neos\Media\Browser\Controller\UsageController::getLabelForInaccessibleWorkspace() expects Neos\Media\Browser\Controller\Workspace, Neos\ContentRepository\Core\SharedModel\Workspace\Workspace|null given.
$inaccessibleRelation['nodeIdentifier'] = $usage->getNodeAggregateId()->value;
$inaccessibleRelation['workspaceName'] = $usage->getWorkspaceName()->value;
$inaccessibleRelation['workspace'] = $workspace;
Expand Down Expand Up @@ -183,7 +189,28 @@ public function relatedNodesAction(AssetInterface $asset)
'inaccessibleRelations' => $inaccessibleRelations,
'relatedNodes' => $relatedNodes,
'contentDimensions' => $currentContentRepository->getContentDimensionSource()->getContentDimensionsOrderedByPriority(),
'userWorkspace' => $userWorkspace
'userWorkspace' => $userWorkspace,
]);
}

private function getLabelForInaccessibleWorkspace(Workspace $workspace): string

Check failure on line 196 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Parameter $workspace of method Neos\Media\Browser\Controller\UsageController::getLabelForInaccessibleWorkspace() has invalid type Neos\Media\Browser\Controller\Workspace.

Check failure on line 196 in Neos.Media.Browser/Classes/Controller/UsageController.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Parameter $workspace of method Neos\Media\Browser\Controller\UsageController::getLabelForInaccessibleWorkspace() has invalid type Neos\Media\Browser\Controller\Workspace.
{
/*
TODO: Needs to get re-implemented for Neos 9.
See: https://github.com/neos/neos-development-collection/pull/5182
$currentAccount = $this->securityContext->getAccount();
if ($currentAccount != null && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Media.Browser:WorkspaceName')) {
if ($workspace->isPrivateWorkspace()) {
$owner = $workspace->getOwner();
return '(' . $owner->getLabel() . ')';
} else {
return '(' . $workspace->getTitle() . ')';
}
}
*/

return '';
}
}
9 changes: 9 additions & 0 deletions Neos.Media.Browser/Configuration/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ privilegeTargets:
label: Allowed to replace asset resources
matcher: 'method(Neos\Media\Browser\Controller\(Asset|Image)Controller->(replaceAssetResource|updateAssetResource)Action())'

# We evaluate the WorkspaceName privilegeTarget in code (UsageController) to determine whether we should show workspace names or not.
# To control access to the module in general, Neos.Media.Browser:AssetUsage is used (so that's why they have the same matcher string).
'Neos.Media.Browser:WorkspaceName':
label: Allowed to see workspace owner
matcher: 'method(Neos\Media\Browser\Controller\UsageController->relatedNodesAction())'

roles:
'Neos.Neos:AbstractEditor':
privileges:
Expand Down Expand Up @@ -55,6 +61,9 @@ roles:
-
privilegeTarget: 'Neos.Media.Browser:ManageAssetCollections'
permission: GRANT
-
privilegeTarget: 'Neos.Media.Browser:WorkspaceName'
permission: GRANT

'Neos.Flow:Everybody':
privileges:
Expand Down
18 changes: 8 additions & 10 deletions Neos.Media.Browser/Resources/Private/Templates/Asset/Edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ <h2>{neos:backend.translate(id: 'connectionError', package: 'Neos.Media.Browser'
</label>
</f:for>
</f:if>
<f:security.ifAccess privilegeTarget="Neos.Media.Browser:ManageAssetCollections">
<f:if condition="{assetCollections}">
<label>{neos:backend.translate(id: 'collections', package: 'Neos.Media.Browser')}</label>
<f:for each="{assetCollections}" as="assetCollection">
<label class="neos-checkbox neos-inline">
<m:form.checkbox property="assetCollections" multiple="TRUE" value="{assetCollection}" /><span></span> {assetCollection.title}
</label>
</f:for>
</f:if>
</f:security.ifAccess>
<f:if condition="{assetCollections}">
<label>{neos:backend.translate(id: 'collections', package: 'Neos.Media.Browser')}</label>
<f:for each="{assetCollections}" as="assetCollection">
<label class="neos-checkbox neos-inline">
<m:form.checkbox property="assetCollections" multiple="TRUE" value="{assetCollection}" /><span></span> {assetCollection.title}
</label>
</f:for>
</f:if>
</fieldset>
<fieldset>
<legend>{neos:backend.translate(id: 'metadata', package: 'Neos.Media.Browser')}</legend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,21 @@
title="{neos:backend.translate(id: 'workspaces.personalWorkspace', source: 'Main', package: 'Neos.Workspace.Ui')}"
data-neos-toggle="tooltip"></i>
{neos:backend.translate(id: 'workspaces.personalWorkspace', source: 'Main', package: 'Neos.Workspace.Ui')}
{inaccessibleRelation.label}
</f:case>
<f:case value="{inaccessibleRelation.workspace.privateWorkspace}">
<i class="fas fa-shield"
title="{neos:backend.translate(id: 'workspaces.privateWorkspace', source: 'Main', package: 'Neos.Workspace.Ui')}"
data-neos-toggle="tooltip"></i>
{neos:backend.translate(id: 'workspaces.privateWorkspace', source: 'Main', package: 'Neos.Workspace.Ui')}
{inaccessibleRelation.label}
</f:case>
<f:case value="{inaccessibleRelation.workspace.internalWorkspace}">
<i class="fas fa-group"
title="{neos:backend.translate(id: 'workspaces.internalWorkspace', source: 'Main', package: 'Neos.Workspace.Ui')}"
data-neos-toggle="tooltip"></i>
{neos:backend.translate(id: 'workspaces.internalWorkspace', source: 'Main', package: 'Neos.Workspace.Ui')}
{inaccessibleRelation.label}
</f:case>
<f:defaultCase>
---
Expand Down
1 change: 0 additions & 1 deletion Neos.Neos/Configuration/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ roles:
'Neos.Neos:Administrator':
label: Neos Administrator
description: Grants access to all modules and functionalities of the Neos backend.

parentRoles: ['Neos.Neos:Editor']
privileges:
-
Expand Down
35 changes: 35 additions & 0 deletions Neos.Neos/Documentation/Appendixes/ChangeLogs/8318.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
`8.3.18 (2024-11-18) <https://github.com/neos/neos-development-collection/releases/tag/8.3.18>`_
================================================================================================

Overview of merged pull requests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`BUGFIX: Restore asset collection assignment capabilities <https://github.com/neos/neos-development-collection/pull/5367>`_
---------------------------------------------------------------------------------------------------------------------------

resolves `#5365 <https://github.com/neos/neos-development-collection/issues/5365>`_
reverts `#4404 <https://github.com/neos/neos-development-collection/issues/4404>`_

**Upgrade instructions**

none

**Review instructions**

none


* Packages: ``Neos`` ``Media.Browser``

`BUGFIX: show workspace owner/title in media usage tab <https://github.com/neos/neos-development-collection/pull/5182>`_
------------------------------------------------------------------------------------------------------------------------

Issue: https://github.com/neos/neos-development-collection/issues/5181

Possibility to enable showing all workspace titles/owners to user with certain roles in the media usage tab.


* Packages: ``Neos`` ``Media.Browser``

`Detailed log <https://github.com/neos/neos-development-collection/compare/8.3.17...8.3.18>`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 comments on commit 255366d

Please sign in to comment.