[BUGFIX] Enforce processing folder generation 28/48028/5
authorNicole Cordes <typo3@cordes.co>
Fri, 6 May 2016 18:18:22 +0000 (20:18 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Thu, 7 Jul 2016 05:30:51 +0000 (07:30 +0200)
If the processing folder of a storage was deleted and the current user
isn't allowed to create new folders, an exception is thrown. This patch
turns off the access check to allow generation of the processing folder.

Resolves: #76067
Releases: master, 7.6
Change-Id: Idd096b44753ab438916d45ff2d6f085118ab2bcf
Reviewed-on: https://review.typo3.org/48028
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index b29ba90..3589c13 100644 (file)
@@ -2874,11 +2874,25 @@ class ResourceStorage implements ResourceStorageInterface
                     if ($storage->hasFolder($processingFolderIdentifier)) {
                         $this->processingFolder = $storage->getFolder($processingFolderIdentifier);
                     } else {
-                        $this->processingFolder = $storage->createFolder(ltrim($processingFolderIdentifier, '/'));
+                        $rootFolder = $storage->getRootLevelFolder(false);
+                        $currentEvaluatePermissions = $storage->getEvaluatePermissions();
+                        $storage->setEvaluatePermissions(false);
+                        $this->processingFolder = $storage->createFolder(
+                            ltrim($processingFolderIdentifier, '/'),
+                            $rootFolder
+                        );
+                        $storage->setEvaluatePermissions($currentEvaluatePermissions);
                     }
                 } else {
                     if ($this->driver->folderExists($processingFolder) === false) {
-                        $this->processingFolder = $this->createFolder($processingFolder);
+                        $rootFolder = $this->getRootLevelFolder(false);
+                        $currentEvaluatePermissions = $this->evaluatePermissions;
+                        $this->evaluatePermissions = false;
+                        $this->processingFolder = $this->createFolder(
+                            $processingFolder,
+                            $rootFolder
+                        );
+                        $this->evaluatePermissions = $currentEvaluatePermissions;
                     } else {
                         $data = $this->driver->getFolderInfoByIdentifier($processingFolder);
                         $this->processingFolder = ResourceFactory::getInstance()->createFolderObject($this, $data['identifier'], $data['name']);
@@ -2924,7 +2938,10 @@ class ResourceStorage implements ResourceStorageInterface
                 if ($processingFolder->hasFolder($folderName)) {
                     $processingFolder = $processingFolder->getSubfolder($folderName);
                 } else {
+                    $currentEvaluatePermissions = $processingFolder->getStorage()->getEvaluatePermissions();
+                    $processingFolder->getStorage()->setEvaluatePermissions(false);
                     $processingFolder = $processingFolder->createFolder($folderName);
+                    $processingFolder->getStorage()->setEvaluatePermissions($currentEvaluatePermissions);
                 }
             }
         } catch (Exception\FolderDoesNotExistException $e) {
@@ -2938,7 +2955,7 @@ class ResourceStorage implements ResourceStorageInterface
      *
      * @param string $fileIdentifier
      * @param int $levels
-     * @return []
+     * @return string[]
      */
     protected function getNamesForNestedProcessingFolder($fileIdentifier, $levels)
     {