Project

General

Profile

Actions

Bug #88895

closed

Auto-creates wrong folders if groupHomePath is used.

Added by Stig Nørgaard Færch over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Start date:
2019-08-02
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
CodingNight
Complexity:
Is Regression:
Sprint Focus:
Remote Sprint

Description

I have this configuration, which is dynamically set from a hook:

module.tx_form.settings.yamlSettingsOverrides.persistenceManager.allowedFileMounts.1 = 1:groups/<uid>/forms/ 

We are using the groupHomePath core feature. Here you can define a path - for example 1:groups/. Then if you are member of backendgroup with uid 200, you will automatically get a mount to 1:groups/200/ if that folders exists.

I have a problem when ext:form tries to create the folder. Instead of 1:groups/200/forms it created this path instead: 1:groups/200/groups/200/forms

The reason seems to be when \TYPO3\CMS\Core\Resource\ResourceStorage::createFolder() tries to get the parentFolder - instead of getting just 1: - it gets 1:/groups/200 - probably as the user does not have access to parent folders (because of the way userGroupHome works).
That way it creates 1:/groups/200/groups/200/forms/ instead.

Actions #1

Updated by Stig Nørgaard Færch over 5 years ago

I have made this fix.
I'm not in the loop on how this is done the right way, as we seldom contribute this way...
Hope someone can help me getting this fixed...

/Stig

Index: public/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- public/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php    (date 1564755837000)
+++ public/typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php    (date 1564755837000)
@@ -459,7 +459,14 @@
             try {
                 $folder = $storage->getFolder($fileMountIdentifier);
             } catch (FolderDoesNotExistException $e) {
-                $storage->createFolder($fileMountIdentifier);
+                //Fix to make sure that the folder is create correctly when using groupHomePath https://forge.typo3.org/issues/88895
+                if(strpos(str_replace(':/',':', $storage->getRootLevelFolder()->getCombinedIdentifier()), $GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath']) === 0) {
+                    $groupHomeFolder = $storage->getRootLevelFolder();
+                    $groupHomeFolder->createFolder(str_replace($storage->getRootLevelFolder()->getIdentifier(),'', '/'. $fileMountIdentifier));
+                } else {
+                    if(strpos($allowedFileMount, $GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath']) === 0) continue;
+                    $storage->createFolder($fileMountIdentifier);
+                }
                 continue;
             } catch (InsufficientFolderAccessPermissionsException $e) {
                 continue;

Actions #2

Updated by Susanne Moog over 5 years ago

  • Tags set to CodingNight
Actions #3

Updated by Stig Nørgaard Færch over 5 years ago

@susanne.moog
When does this Coding Night take place?

Actions #4

Updated by Susanne Moog about 5 years ago

  • Complexity deleted (easy)
  • Sprint Focus set to Remote Sprint
Actions #5

Updated by Ralf Zimmermann almost 5 years ago

  • Status changed from New to In Progress
Actions #6

Updated by Gerrit Code Review almost 5 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62415

Actions #7

Updated by Mathias Brodala almost 5 years ago

  • Description updated (diff)
Actions #8

Updated by Mathias Brodala almost 5 years ago

  • Description updated (diff)
Actions #9

Updated by Gerrit Code Review almost 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62415

Actions #10

Updated by Gerrit Code Review almost 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62415

Actions #11

Updated by Gerrit Code Review almost 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62415

Actions #12

Updated by Gerrit Code Review almost 5 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62415

Actions #13

Updated by Gerrit Code Review almost 5 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62400

Actions #14

Updated by Ralf Zimmermann almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #15

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF