‪TYPO3CMS  ‪main
ImportExportFilter.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\CMS\Core\Resource\Driver\DriverInterface;
22 
31 {
36  public static function ‪filterImportExportFilesAndFolders(string $itemName, string $itemIdentifier, string $parentIdentifier, array $additionalInformation, DriverInterface $driverInstance)
37  {
38  // + `_temp_` is hard-coded in `ImportExport::getDefaultUploadTemporaryFolder()`
39  // + `importexport` is hard-coded in `ImportExport::createDefaultImportExportFolder()`
40  $importExportFolderSubPath = '/_temp_/importexport/';
41  if (str_ends_with($parentIdentifier, $importExportFolderSubPath) || str_contains($itemIdentifier, $importExportFolderSubPath)) {
42  $backendUser = ‪self::getBackendUser();
43  if ($backendUser === null || !$backendUser->isExportEnabled()) {
44  return -1;
45  }
46  }
47 
48  return true;
49  }
50 
51  protected static function ‪getBackendUser(): ?‪BackendUserAuthentication
52  {
53  return ‪$GLOBALS['BE_USER'] ?? null;
54  }
55 }
‪TYPO3\CMS\Core\Resource\Filter\ImportExportFilter\filterImportExportFilesAndFolders
‪static filterImportExportFilesAndFolders(string $itemName, string $itemIdentifier, string $parentIdentifier, array $additionalInformation, DriverInterface $driverInstance)
Definition: ImportExportFilter.php:36
‪TYPO3\CMS\Core\Resource\Filter\ImportExportFilter\getBackendUser
‪static getBackendUser()
Definition: ImportExportFilter.php:51
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Resource\Filter
Definition: FileExtensionFilter.php:18
‪TYPO3\CMS\Core\Resource\Filter\ImportExportFilter
Definition: ImportExportFilter.php:31