Feature #84493
open
Replace enableFields with QueryRestriction
Added by Josua Vogel over 6 years ago.
Updated over 6 years ago.
Category:
Content Rendering
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'].
- Status changed from New to Needs Feedback
Can you give some more information as the RestrictionContainers are used for every table in every case. also enableFields
uses.
However there is currently no way to add custom restrictions to any table but there is an issue for that already, see #84244
- Related to Feature #84244: Adding custom Restrictions to RestrictionContainer added
Georg Ringer wrote:
Can you give some more information as the RestrictionContainers are used for every table in every case. also enableFields
uses.
However there is currently no way to add custom restrictions to any table but there is an issue for that already, see #84244
Okay, 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 in enableFields
(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?
- Status changed from Needs Feedback to Accepted
Also available in: Atom
PDF