Project

General

Profile

Actions

Feature #84493

open

Replace enableFields with QueryRestriction

Added by Josua Vogel over 6 years ago. Updated over 6 years ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2018-03-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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'].


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #84244: Adding custom Restrictions to RestrictionContainerClosed2018-03-13

Actions
Actions #1

Updated by Georg Ringer over 6 years ago

  • 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

Actions #2

Updated by Georg Ringer over 6 years ago

  • Related to Feature #84244: Adding custom Restrictions to RestrictionContainer added
Actions #3

Updated by Josua Vogel over 6 years ago

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?

Actions #4

Updated by Georg Ringer over 6 years ago

  • Status changed from Needs Feedback to Accepted
Actions

Also available in: Atom PDF