Issue Feature Closed

#84493Replace enableFields with QueryRestriction

Josua Vogel 03/20/18, 09:34 updated 11/13/26, 11:26

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.

History 5

  1. Georg Ringer commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2018-03-20T10:42:23+00:00" > 03/20/18, 10:42 </span>

    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

  2. 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. 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?

  3. Benni Mack commented and changed status Accepted Closed <span data-processor="relativetime" data-value="2026-11-13T11:26:49+00:00" > 11/13/26, 11:26 </span>

    This is solved finally.