diff --git a/Neos.Media.Browser/Classes/Controller/UsageController.php b/Neos.Media.Browser/Classes/Controller/UsageController.php
index 76703174097..bea720acffc 100644
--- a/Neos.Media.Browser/Classes/Controller/UsageController.php
+++ b/Neos.Media.Browser/Classes/Controller/UsageController.php
@@ -20,6 +20,7 @@
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
+use Neos\Flow\Security\Context;
use Neos\Media\Domain\Model\AssetInterface;
use Neos\Media\Domain\Service\AssetService;
use Neos\Neos\Controller\CreateContentContextTrait;
@@ -80,6 +81,18 @@ class UsageController extends ActionController
*/
protected $domainUserService;
+ /**
+ * @Flow\Inject
+ * @var Context
+ */
+ protected $securityContext;
+
+ /**
+ * @Flow\InjectConfiguration(package="Neos.Media.Browser", path="features.showWorkspaceOwnerOrName")
+ * @var array
+ */
+ protected $showWorkspaceOwnerOrNameConfiguration;
+
/**
* Get Related Nodes for an asset
*
@@ -89,6 +102,19 @@ class UsageController extends ActionController
public function relatedNodesAction(AssetInterface $asset)
{
$userWorkspace = $this->userService->getPersonalWorkspace();
+ $currentAccount = $this->securityContext->getAccount();
+
+ $isPrivilegedRole = false;
+ if ($currentAccount != null && $this->showWorkspaceOwnerOrNameConfiguration['enable']) {
+ $roles = array_keys($currentAccount->getRoles());
+
+ foreach ($this->showWorkspaceOwnerOrNameConfiguration['privilegedRoles'] as $role) {
+ if (in_array($role, $roles)) {
+ $isPrivilegedRole = true;
+ break;
+ }
+ }
+ }
$usageReferences = $this->assetService->getUsageReferences($asset);
$relatedNodes = [];
@@ -165,7 +191,8 @@ public function relatedNodesAction(AssetInterface $asset)
'inaccessibleRelations' => $inaccessibleRelations,
'relatedNodes' => $relatedNodes,
'contentDimensions' => $this->contentDimensionPresetSource->getAllPresets(),
- 'userWorkspace' => $userWorkspace
+ 'userWorkspace' => $userWorkspace,
+ 'isPrivilegedRole' => $isPrivilegedRole,
]);
}
diff --git a/Neos.Media.Browser/Configuration/Settings.yaml b/Neos.Media.Browser/Configuration/Settings.yaml
index ec7c29899eb..d7f0e57a0d8 100644
--- a/Neos.Media.Browser/Configuration/Settings.yaml
+++ b/Neos.Media.Browser/Configuration/Settings.yaml
@@ -27,6 +27,10 @@ Neos:
# By default, enable the option to create redirects for replaced asset resources
createAssetRedirectsOption:
enable: true
+ # By default, disable showing the workspace owner/title in media browser usage tab
+ showWorkspaceOwnerOrName:
+ enable: false
+ privilegedRoles: ['Neos.Neos:Administrator']
Flow:
security:
diff --git a/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html b/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html
index 8dde5d9cb3a..c41ebfe29b2 100644
--- a/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html
+++ b/Neos.Media.Browser/Resources/Private/Templates/Usage/RelatedNodes.html
@@ -39,6 +39,7 @@
title="{neos:backend.translate(id: 'workspaces.personalWorkspace', source: 'Modules', package: 'Neos.Neos')}"
data-neos-toggle="tooltip">
{neos:backend.translate(id: 'workspaces.personalWorkspace', source: 'Modules', package: 'Neos.Neos')}
+ ({inaccessibleRelation.workspace.title})
{neos:backend.translate(id: 'workspaces.privateWorkspace', source: 'Modules', package:
'Neos.Neos')}
+ ({inaccessibleRelation.workspace.owner.name.fullName})
{neos:backend.translate(id: 'workspaces.internalWorkspace', source: 'Modules', package:
'Neos.Neos')}
+ ({inaccessibleRelation.workspace.title})
---