[BUGFIX] Access to sys_files is incompatible to fe_access checks 87/25987/3
authorSteffen Ritter <info@rs-websystems.de>
Sat, 7 Dec 2013 08:22:59 +0000 (09:22 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Wed, 18 Dec 2013 14:45:07 +0000 (15:45 +0100)
The system extension filemetadata adds access restriction fields
for selecting frontend user groups as known from tt_content or
pages. Behind the scenes of the TCEform this relation is stored
in a MM table which is incompatible to the usual access checks.

In addition a opposite relation is added to fe_groups which
queries all files to show in a selector.

This change removes the MM table and reconfigures the fe_groups
field in the same way as it is done for tt_content and pages.

Resolves: #54236
Resolves: #54237
Releases: 6.2
Change-Id: I8a05073dee9e57e48335e1fe2a3917313563ac7d
Reviewed-on: https://review.typo3.org/25987
Reviewed-by: Markus Klein
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Frans Saris
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/filemetadata/Configuration/TCA/fe_groups.php [deleted file]
typo3/sysext/filemetadata/Configuration/TCA/sys_file_metadata.php
typo3/sysext/filemetadata/ext_tables.sql

diff --git a/typo3/sysext/filemetadata/Configuration/TCA/fe_groups.php b/typo3/sysext/filemetadata/Configuration/TCA/fe_groups.php
deleted file mode 100644 (file)
index e14beb9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-if (!defined('TYPO3_MODE')) die ('Access denied.');
-
-$tca = array(
-       // Opposite relation for sys_file_metadata.fe_groups.
-       // The field is configured but not displayed by default for a FE Group.
-       // To display it update your TCA as example:
-       // $tca['types'][0]['showitem'] = $GLOBALS['TCA']['fe_groups']['types'][0]['showitem'] . ',files'
-       'columns' => array(
-               'files' => array(
-                       'exclude' => 1,
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:fe_groups.files',
-                       'config' => array(
-                               'type' => 'select',
-                               'size' => 10,
-                               'minitems' => 0,
-                               'maxitems' => 9999,
-                               'autoSizeMax' => 30,
-                               'multiple' => 0,
-                               'foreign_table' => 'sys_file_metadata',
-                               'MM' => 'sys_file_fegroups_mm',
-                               'MM_opposite_field' => 'fe_groups',
-                       ),
-               ),
-       ),
-);
-
-return \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TCA']['fe_groups'], $tca);
-?>
\ No newline at end of file
index 1939e2f..530f498 100644 (file)
@@ -413,21 +413,32 @@ $tca = array(
                ),
                'fe_groups' => array(
                        'exclude' => 1,
-                       'l10n_mode' => 'exclude',
-                       'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.fe_groups',
+                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.fe_group',
                        'config' => array(
                                'type' => 'select',
-                               'size' => 10,
-                               'minitems' => 0,
-                               'maxitems' => 9999,
-                               'autoSizeMax' => 30,
-                               'multiple' => 0,
+                               'size' => 5,
+                               'maxitems' => 20,
+                               'items' => array(
+                                       array(
+                                               'LLL:EXT:lang/locallang_general.xlf:LGL.hide_at_login',
+                                               -1
+                                       ),
+                                       array(
+                                               'LLL:EXT:lang/locallang_general.xlf:LGL.any_login',
+                                               -2
+                                       ),
+                                       array(
+                                               'LLL:EXT:lang/locallang_general.xlf:LGL.usergroups',
+                                               '--div--'
+                                       )
+                               ),
+                               'exclusiveKeys' => '-1,-2',
                                'foreign_table' => 'fe_groups',
-                               'MM' => 'sys_file_fegroups_mm',
-                       ),
+                               'foreign_table_where' => 'ORDER BY fe_groups.title'
+                       )
                ),
        ),
 );
 
 
-return \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TCA']['sys_file_metadata'], $tca);
\ No newline at end of file
+return \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TCA']['sys_file_metadata'], $tca);
index 67e7167..2dc5b02 100644 (file)
@@ -39,18 +39,5 @@ CREATE TABLE sys_file_metadata (
        language varchar(12) DEFAULT '' NOT NULL,
 
        # FE permissions
-       fe_groups int(11) unsigned DEfAULT '0' NOT NULL,
-);
-
-#
-# Table structure for table 'sys_file_fegroups_mm'
-#
-CREATE TABLE sys_file_fegroups_mm (
-       uid_local int(11) unsigned DEFAULT '0' NOT NULL,
-       uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
-       sorting int(11) unsigned DEFAULT '0' NOT NULL,
-       sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
-
-       KEY uid_local (uid_local),
-       KEY uid_foreign (uid_foreign)
-);
+       fe_groups tinytext NOT NULL,
+);
\ No newline at end of file