Bug #88895

Auto-creates wrong folders if groupHomePath is used.

Added by Stig Nørgaard Færch 10 months ago. Updated 5 months ago.

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

100%

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.

Associated revisions

Revision e185f39d (diff)
Added by Ralf Zimmermann 6 months ago

[BUGFIX] Respect user mount points within FormPersistenceManager

Let the FormPersistenceManager respect user mount points and
auto created file mounts while retrieving and creating folders
which are configured within
"TYPO3.CMS.Form.persistenceManager.allowedFileMounts".

Resolves: #88895
Releases: master, 9.5
Change-Id: Ic422c692e268165de986e43239d9f293a71e0b25
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62415
Tested-by: TYPO3com <>
Tested-by: Mathias Brodala <>
Tested-by: Björn Jacob <>
Tested-by: Ralf Zimmermann <>
Reviewed-by: Mathias Brodala <>
Reviewed-by: Björn Jacob <>
Reviewed-by: Ralf Zimmermann <>

Revision 23a97dcd (diff)
Added by Ralf Zimmermann 6 months ago

[BUGFIX] Respect user mount points within FormPersistenceManager

Let the FormPersistenceManager respect user mount points and
auto created file mounts while retrieving and creating folders
which are configured within
"TYPO3.CMS.Form.persistenceManager.allowedFileMounts".

Resolves: #88895
Releases: master, 9.5
Change-Id: Ic422c692e268165de986e43239d9f293a71e0b25
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62400
Tested-by: TYPO3com <>
Tested-by: Ralf Zimmermann <>
Reviewed-by: Ralf Zimmermann <>

History

#1 Updated by Stig Nørgaard Færch 10 months 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;

#2 Updated by Susanne Moog 10 months ago

  • Tags set to CodingNight

#3 Updated by Stig Nørgaard Færch 10 months ago

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

#4 Updated by Susanne Moog 6 months ago

  • Complexity deleted (easy)
  • Sprint Focus set to Remote Sprint

#5 Updated by Ralf Zimmermann 6 months ago

  • Status changed from New to In Progress

#6 Updated by Gerrit Code Review 6 months 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

#7 Updated by Mathias Brodala 6 months ago

  • Description updated (diff)

#8 Updated by Mathias Brodala 6 months ago

  • Description updated (diff)

#9 Updated by Gerrit Code Review 6 months 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

#10 Updated by Gerrit Code Review 6 months 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

#11 Updated by Gerrit Code Review 6 months 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

#12 Updated by Gerrit Code Review 6 months 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

#13 Updated by Gerrit Code Review 6 months 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

#14 Updated by Ralf Zimmermann 6 months ago

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

#15 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF