Project

General

Profile

Actions

Bug #100959

open

File storage 'fileadmin' as default storage must be allowed for editors to show other other filemounts in other file storages

Added by Robert Hafenried about 1 year ago. Updated 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2023-06-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

I have a separate file storage for the editors. However, this is only displayed if default file storage fileadmin has also been enabled. Otherwise, the error message appears:

You are not allowed to access the given folder: "" | TYPO3\CMS\Core\ResourceException\InsufficientFolderAccessPermissionsException thrown in file /www/htdocs/xxxxxxx/my-domain.de/typo3_src-12.4.1/typo3/sysext/core/Classes/Resource/ResourceStorage.php in line 849. Requested URL: https://my-domain.de/typo3/wizard/record/browse?token=--AnonymizedToken--&mode=file&bparams=%7C%7C%7Cgif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai,svg%7Cdata-72-tt_address-1-image-sys_file_reference

Actions #1

Updated by Robert Hafenried about 1 year ago

I would expect that fileadmin sharing is not necessary since editors are not supposed to work with this file storage.

Actions #2

Updated by Robert Hafenried about 1 year ago

  • Is Regression set to Yes
Actions #3

Updated by Robert Hafenried about 1 year ago

  • Target version deleted (Candidate for patchlevel)
Actions #4

Updated by Julian Wundrak about 1 year ago

We have the same problem in our project. Currently we use this patch:

Index: Classes/ElementBrowser/AbstractResourceBrowser.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Classes/ElementBrowser/AbstractResourceBrowser.php b/Classes/ElementBrowser/AbstractResourceBrowser.php
--- a/Classes/ElementBrowser/AbstractResourceBrowser.php
+++ b/Classes/ElementBrowser/AbstractResourceBrowser.php    (date 1688372094488)
@@ -116,9 +116,31 @@
         }

         if (!$this->selectedFolder) {
-            $this->selectedFolder = $resourceFactory->getDefaultStorage()?->getRootLevelFolder() ?? null;
+            $this->selectedFolder = $this->findAccessableRootLevelFolder();
         }
     }
+
+    private function findAccessableRootLevelFolder(): ?Folder
+    {
+        $storages          = [];
+        $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+        foreach ($storageRepository->findAll() as $storage) {
+            if ($storage->isDefault()) {
+                \array_unshift($storages, $storage);
+            } else {
+                $storages[] = $storage;
+            }
+        }
+
+        foreach ($storages as $storage) {
+            $rootFolder = $storage->getRootLevelFolder();
+            if ($rootFolder && $rootFolder->checkActionPermission('read')) {
+                return $rootFolder;
+            }
+        }
+
+        return null;
+    }

     protected function getViewModeButton(): ButtonInterface
     {

I'm sure, that this is not the correct way, but the issue is, that the default-Storage is not accessable for the user by permissions. This patch select the first available folder, if nothing is selected.

Actions #5

Updated by Karsten Nowak (undkonsorten) 2 months ago

We had the same problem here. But unfortunately the patch doesn't help. Error still exists. Fortunately we had only one site in this instance and only one used file storage. So we can set the second storage as default. That's ok for the moment.

But I think that is not a solution for that issue in general. In multisite instances and multiple editors with different access right on filemounts/filestorages it's not possible to give the user only one storage.

Our system: TYPO3 12.4.14, PHP 8.2

Actions

Also available in: Atom PDF