#84493Replace enableFields with QueryRestriction
Description
I noticed, that only ‘pages’ (and language tables) are restricted by QueryRestrictions (all that are contained in FrontendRestrictionContainer).
For content elements the function enableFields is used. I think it would be better to use one way to restrict access, so a developer isn’t forced to implement his logic not in a custom QueryRestriction AND $GLOBALS[‘TYPO3_CONF_VARS’][‘SC_OPTIONS’][‘t3lib/class.t3lib_page.php’][‘addEnableColumns’].
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 1
History 5
-
Georg Ringer commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2018-03-20T10:42:23+00:00" > 03/20/18, 10:42 </span> -
Georg Ringer changed Related to #84244 <span data-processor="relativetime" data-value="2018-03-20T10:42:35+00:00" > 03/20/18, 10:42 </span>
-
Josua Vogel commented <span data-processor="relativetime" data-value="2018-03-20T11:14:14+00:00" > 03/20/18, 11:14 </span>
Georg Ringer wrote:
> Can you give some more information as the RestrictionContainers are used for every table in every case. alsoenableFieldsuses.
>
> However there is currently no way to add custom restrictions to any table but there is an issue for that already, see #84244Okay, I try. I created #84244, because I had to use XCLASS to add my custom restriction (yes it is possible!). My code works fine, but there is one problem: it is only called on pages table (or the corresponding language tables). For my tt_content elements no FrontendRestrictionContainer is used. If I implement my logic in a EnableFieldsHook it works, my content elements are hidden if my restriction forces it.
By looking closer:ContentObjectRenderer::getQuery()calls a method for restriction, but this results inenableFields(Class->PageRepository). There is no call to anything like$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));(if I´m correct…). So it is not possible for me to use a restriction container while rendering on tt_content. Only ‘pages’,‘pages_language_overlay’, ‘sys_file_reference’ tables are processed in Restrictions.
Or is the ‘tt_content’table joined with ‘pages’ while rendering? -
Georg Ringer changed status
Needs FeedbackAccepted <span data-processor="relativetime" data-value="2018-03-21T09:08:37+00:00" > 03/21/18, 09:08 </span> -
Benni Mack commented and changed status
AcceptedClosed <span data-processor="relativetime" data-value="2026-11-13T11:26:49+00:00" > 11/13/26, 11:26 </span>This is solved finally.
Can you give some more information as the RestrictionContainers are used for every table in every case. also
enableFieldsuses.However there is currently no way to add custom restrictions to any table but there is an issue for that already, see #84244