diff --git a/Neos.Media.Browser/Resources/Private/Templates/Asset/Edit.html b/Neos.Media.Browser/Resources/Private/Templates/Asset/Edit.html index 06ec12fa5d7..fc7edbcaf03 100644 --- a/Neos.Media.Browser/Resources/Private/Templates/Asset/Edit.html +++ b/Neos.Media.Browser/Resources/Private/Templates/Asset/Edit.html @@ -57,14 +57,16 @@

{neos:backend.translate(id: 'connectionError', package: 'Neos.Media.Browser' - - - - - - + + + + + + + +
{neos:backend.translate(id: 'metadata', package: 'Neos.Media.Browser')} diff --git a/Neos.Neos/Classes/Controller/Backend/MenuHelper.php b/Neos.Neos/Classes/Controller/Backend/MenuHelper.php index 779337503c1..54694d6f28c 100644 --- a/Neos.Neos/Classes/Controller/Backend/MenuHelper.php +++ b/Neos.Neos/Classes/Controller/Backend/MenuHelper.php @@ -11,13 +11,16 @@ * source code. */ +use Neos\ContentRepository\Domain\Factory\NodeFactory; +use Neos\ContentRepository\Domain\Repository\NodeDataRepository; +use Neos\ContentRepository\Domain\Repository\WorkspaceRepository; +use Neos\ContentRepository\Domain\Utility\NodePaths; use Neos\ContentRepository\Security\Authorization\Privilege\Node\NodePrivilegeSubject; use Neos\Flow\Annotations as Flow; use Neos\Flow\Http\Exception; use Neos\Flow\Mvc\Controller\ControllerContext; use Neos\Flow\Mvc\Routing\Exception\MissingActionNameException; use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; -use Neos\Neos\Domain\Service\ContentContextFactory; use Neos\Neos\Domain\Service\SiteService; use Neos\Neos\Security\Authorization\Privilege\ModulePrivilege; use Neos\Neos\Security\Authorization\Privilege\ModulePrivilegeSubject; @@ -65,9 +68,21 @@ class MenuHelper /** * @Flow\Inject - * @var ContentContextFactory + * @var WorkspaceRepository */ - protected $contextFactory; + protected $workspaceRepository; + + /** + * @Flow\Inject + * @var NodeDataRepository + */ + protected $nodeDataRepository; + + /** + * @Flow\Inject + * @var NodeFactory + */ + protected $nodeFactory; /** * @param array $settings @@ -93,38 +108,57 @@ public function buildSiteList(ControllerContext $controllerContext): array return []; } - $context = $this->contextFactory->create(); + $liveWorkspace = $this->workspaceRepository->findByIdentifier('live'); + $domainsFound = false; $sites = []; foreach ($this->siteRepository->findOnline() as $site) { - $node = $context->getNode(\Neos\ContentRepository\Domain\Utility\NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName())); - if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($node))) { - $uri = null; - $active = false; - /** @var $site Site */ - if ($site->hasActiveDomains()) { - $activeHostPatterns = $site->getActiveDomains()->map(static function ($domain) { - return $domain->getHostname(); - })->toArray(); - - $active = in_array($requestUriHost, $activeHostPatterns, true); - - if ($active) { - $uri = $contentModule['uri']; - } else { - $uri = $controllerContext->getUriBuilder()->reset()->uriFor('switchSite', ['site' => $site], 'Backend\Backend', 'Neos.Neos'); - } + $granted = false; + + $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName()); + $siteNodesInAllDimensions = $this->nodeDataRepository->findByPathWithoutReduce($siteNodePath, $liveWorkspace); - $domainsFound = true; + foreach ($siteNodesInAllDimensions as $siteNodeData) { + $siteNodeContext = $this->nodeFactory->createContextMatchingNodeData($siteNodeData); + $siteNode = $this->nodeFactory->createFromNodeData($siteNodeData, $siteNodeContext); + + // if the node exists, check if the user is granted access to this node + if ($this->privilegeManager->isGranted(NodeTreePrivilege::class, new NodePrivilegeSubject($siteNode))) { + $granted = true; + break; + } + } + + // if no siteNode is accessible ignore this site + if (!$granted) { + continue; + } + + $uri = null; + $active = false; + /** @var $site Site */ + if ($site->hasActiveDomains()) { + $activeHostPatterns = $site->getActiveDomains()->map(static function ($domain) { + return $domain->getHostname(); + })->toArray(); + + $active = in_array($requestUriHost, $activeHostPatterns, true); + + if ($active) { + $uri = $contentModule['uri']; + } else { + $uri = $controllerContext->getUriBuilder()->reset()->uriFor('switchSite', ['site' => $site], 'Backend\Backend', 'Neos.Neos'); } - $sites[] = [ - 'name' => $site->getName(), - 'nodeName' => $site->getNodeName(), - 'uri' => $uri, - 'active' => $active - ]; + $domainsFound = true; } + + $sites[] = [ + 'name' => $site->getName(), + 'nodeName' => $site->getNodeName(), + 'uri' => $uri, + 'active' => $active + ]; } if ($domainsFound === false) { diff --git a/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php b/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php index d0aeeae4dc3..b348c160394 100644 --- a/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php +++ b/Neos.Neos/Classes/Controller/Module/Management/WorkspacesController.php @@ -470,16 +470,18 @@ protected function computeChangesCount(Workspace $selectedWorkspace) { $changesCount = ['new' => 0, 'changed' => 0, 'removed' => 0, 'total' => 0]; foreach ($this->computeSiteChanges($selectedWorkspace) as $siteChanges) { - foreach ($siteChanges['documents'] as $documentChanges) { - foreach ($documentChanges['changes'] as $change) { - if ($change['node']->isRemoved()) { - $changesCount['removed']++; - } elseif ($change['isNew']) { - $changesCount['new']++; - } else { - $changesCount['changed']++; - }; - $changesCount['total']++; + foreach ($siteChanges['documents'] as $dimensions) { + foreach ($dimensions as $documentChanges) { + foreach ($documentChanges['changes'] as $change) { + if ($change['node']->isRemoved()) { + $changesCount['removed']++; + } elseif ($change['isNew']) { + $changesCount['new']++; + } else { + $changesCount['changed']++; + }; + $changesCount['total']++; + } } } } @@ -509,11 +511,15 @@ protected function computeSiteChanges(Workspace $selectedWorkspace) // $document will be null if we have a broken root line for this node. This actually should never happen, but currently can in some scenarios. if ($document !== null) { $documentPath = implode('/', array_slice(explode('/', $document->getPath()), 3)); + + $dimensionValues = $document->getDimensions(); + $documentDimension = Utility::sortDimensionValueArrayAndReturnDimensionsHash($dimensionValues); + $relativePath = str_replace(sprintf(SiteService::SITES_ROOT_PATH . '/%s/%s', $siteNodeName, $documentPath), '', $node->getPath()); if (!isset($siteChanges[$siteNodeName]['siteNode'])) { $siteChanges[$siteNodeName]['siteNode'] = $this->siteRepository->findOneByNodeName($siteNodeName); } - $siteChanges[$siteNodeName]['documents'][$documentPath]['documentNode'] = $document; + $siteChanges[$siteNodeName]['documents'][$documentDimension][$documentPath]['documentNode'] = $document; $change = [ 'node' => $node, @@ -522,7 +528,7 @@ protected function computeSiteChanges(Workspace $selectedWorkspace) if ($node->getNodeType()->isOfType('Neos.Neos:Node')) { $change['configuration'] = $node->getNodeType()->getFullConfiguration(); } - $siteChanges[$siteNodeName]['documents'][$documentPath]['changes'][$relativePath] = $change; + $siteChanges[$siteNodeName]['documents'][$documentDimension][$documentPath]['changes'][$relativePath] = $change; } } } @@ -534,17 +540,21 @@ protected function computeSiteChanges(Workspace $selectedWorkspace) ksort($siteChanges); foreach ($siteChanges as $siteKey => $site) { - foreach ($site['documents'] as $documentKey => $document) { - $liveDocumentNode = $liveContext->getNodeByIdentifier($document['documentNode']->getIdentifier()); - $siteChanges[$siteKey]['documents'][$documentKey]['isMoved'] = $liveDocumentNode && $document['documentNode']->getPath() !== $liveDocumentNode->getPath(); - $siteChanges[$siteKey]['documents'][$documentKey]['isNew'] = $liveDocumentNode === null; - foreach ($document['changes'] as $changeKey => $change) { - $liveNode = $liveContext->getNodeByIdentifier($change['node']->getIdentifier()); - $siteChanges[$siteKey]['documents'][$documentKey]['changes'][$changeKey]['isNew'] = is_null($liveNode); - $siteChanges[$siteKey]['documents'][$documentKey]['changes'][$changeKey]['isMoved'] = $liveNode && $change['node']->getPath() !== $liveNode->getPath(); + foreach ($site['documents'] as $documentDimension => $documentsPerDimension) { + foreach ($documentsPerDimension as $documentKey => $document) { + $liveDocumentNode = $liveContext->getNodeByIdentifier($document['documentNode']->getIdentifier()); + $siteChanges[$siteKey]['documents'][$documentDimension][$documentKey]['isMoved'] = $liveDocumentNode && $document['documentNode']->getPath() !== $liveDocumentNode->getPath(); + $siteChanges[$siteKey]['documents'][$documentDimension][$documentKey]['isNew'] = $liveDocumentNode === null; + foreach ($document['changes'] as $changeKey => $change) { + $liveNode = $liveContext->getNodeByIdentifier($change['node']->getIdentifier()); + $siteChanges[$siteKey]['documents'][$documentDimension][$documentKey]['changes'][$changeKey]['isNew'] = is_null($liveNode); + $siteChanges[$siteKey]['documents'][$documentDimension][$documentKey]['changes'][$changeKey]['isMoved'] = $liveNode && $change['node']->getPath() !== $liveNode->getPath(); + } } } - ksort($siteChanges[$siteKey]['documents']); + foreach ($siteChanges[$siteKey]['documents'] as $key => $document) { + ksort($siteChanges[$siteKey]['documents'][$key]); + } } return $siteChanges; } diff --git a/Neos.Neos/Documentation/Appendixes/ChangeLogs/7319.rst b/Neos.Neos/Documentation/Appendixes/ChangeLogs/7319.rst new file mode 100644 index 00000000000..711577afdc8 --- /dev/null +++ b/Neos.Neos/Documentation/Appendixes/ChangeLogs/7319.rst @@ -0,0 +1,57 @@ +`7.3.19 (2024-01-15) `_ +================================================================================================ + +Overview of merged pull requests +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`BUGFIX: Check SVG files for malicious code before providing original asset url links `_ +------------------------------------------------------------------------------------------------------------------------------------------------------- + +This adds a check in the preview of assets in the media module and checks for malicous content in svgs. If detected, the direct links to the original url get removed from the preview pages and a warning is shown. + +!`image `_ + +Fixes https://github.com/neos/flow-development-collection/issues/3248 + +* Packages: ``Neos`` ``Media.Browser`` + +`BUGFIX: Resolve StyleCI issues `_ +------------------------------------------------------------------------------------------------- + + + +* Packages: ``Neos`` ``Fusion`` + +`BUGFIX: node:repair fails with could not be converted to string `_ +---------------------------------------------------------------------------------------------------------------------------------- + +Fixes the following crash during node:repair + +```shell +./flow node:repair --dry-run --only removeBrokenEntityReferences +Dry run, not committing any changes. + +Checking for broken entity references ... +Object of class Neos\\Flow\\Persistence\\Doctrine\\Proxies\\__CG__\\Neos\\Media\\Domain\\Model\\ImageVariant could not be converted to string + + Type: Error + File: Data/Temporary/Development/SubContextWbWeb/Cache/Code/Flow_Object_Classes/Neos_ContentRepository_Command_NodeCommandControllerPlugin.php + Line: 836 +``` + +resolved `#4794 `_ + +**Upgrade instructions** + +- [x] Code follows the PSR-2 coding style +- ~~Tests have been created, run and adjusted as needed~~ + - There are not tests in place and I added none. +- [x] The PR is created against the `lowest maintained branch `_ -> 7.3 +- [ ] Reviewer - PR Title is brief but complete and starts with ``FEATURE|TASK|BUGFIX`` +- [ ] Reviewer - The first section explains the change briefly for change-logs +- [ ] Reviewer - Breaking Changes are marked with ``!!!`` and have upgrade-instructions + +* Packages: ``Neos`` ``ContentRepository`` + +`Detailed log `_ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Show.html b/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Show.html index 7dd9032d8b5..9dd10c151b7 100644 --- a/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Show.html +++ b/Neos.Neos/Resources/Private/Templates/Module/Management/Workspaces/Show.html @@ -5,7 +5,7 @@ - + @@ -15,37 +15,38 @@
- - - - - + + + + + - - - - - - + + + + - - - - - - - + + + - + + + + @@ -96,7 +98,7 @@ - +
@@ -115,60 +117,60 @@
- + - + - + {neos:backend.translate(id: 'workspaces.unpublishedChanges', source: 'Modules', package: 'Neos.Neos', arguments: {0: selectedWorkspaceLabel})}
- -
+ +
- - - - - - - + + +
+ + + + + + +
{neos:backend.translate(id: 'pathCaption', source: 'Main', package: 'Neos.Neos')}:
- +
@@ -54,40 +55,41 @@
-
- -
- - + + - - - -
+ +
+ + + + + + + +
- -
-
- - - + + + + + + +
- - -