[BUGFIX] Recreate processig folder without permission checks 33/23633/6
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 5 Sep 2013 07:45:13 +0000 (09:45 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 6 Sep 2013 10:24:39 +0000 (12:24 +0200)
When fetching the processing folder and it does not
exist, it is created on the fly. This should be done
without checking permissions. However by making
storage 0 not browsable, permissions will be checked
when fetching subfolders.

Instead we now fetch the folder objects directly
from the driver, where no permission checks are done.

Resolves: #51747
Releases: 6.0, 6.1, 6.2
Change-Id: I1a4c3b183323151c436969a478c669adb3856476
Reviewed-on: https://review.typo3.org/23633
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index 03b41e0..0a8082b 100644 (file)
@@ -2255,6 +2255,8 @@ class ResourceStorage {
                        $processingFolder = '/' . trim($processingFolder, '/') . '/';
                        // this way, we also worry about deeplinked folders like typo3temp/_processed_
                        if ($this->driver->folderExists($processingFolder) === FALSE) {
+                               // TODO: This assumes that we have a hirarchical storage.
+                               // TODO: Recursive creation of folders should go to the driver, so that we can just call $this->driver->createFolder() here.
                                $processingFolderParts = explode('/', $processingFolder);
                                $parentFolder = $this->driver->getRootLevelFolder();
                                foreach ($processingFolderParts as $folderPart) {
@@ -2264,7 +2266,13 @@ class ResourceStorage {
                                        if (!$this->driver->folderExistsInFolder($folderPart, $parentFolder)) {
                                                $parentFolder = $this->driver->createFolder($folderPart, $parentFolder);
                                        } else {
-                                               $parentFolder = $parentFolder->getSubfolder($folderPart);
+                                               // We do not use the Folder API here to get the subfolder
+                                               // Because permission checks are triggered then, which is not wanted
+                                               // Since the whole method assumes that folders are hirarchical,
+                                               // we can also asume it here to build the subfolder identifier
+                                               // and fetch it directly from the driver.
+                                               $subFolderIdentifier = $parentFolder->getIdentifier() . $folderPart;
+                                               $parentFolder = $this->driver->getFolder($subFolderIdentifier);
                                        }
                                }
                        }