Review main Merged

65276[BUGFIX] Ensure cache entries in PageRepository consider groups

Benni Mack CR +2 V +2 Easy +9 −1 updated 09/08/20, 18:46

Commit message

The results of the hook in PageRepository->enableFields and of
PageRepository->getMultipleGroupsWhereClause may be different,
depending on the Context state for usergroups.
In TYPO3 v9, PageRepository was also used when resolving pages
during Routing (where there is no user / group resolved yet),
which is why we may face different states of usergroups in PageRepository.

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Benjamin Franzke +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Benjamin Franzke +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 1317

  1. Benni Mack uploaded patch set 1 08/11/20, 14:11

  2. TYPO3com voted on patch set 1 V +1 08/11/20, 14:23 Completed build in 12m 11s on Tue, 11 Aug, 02:23 PM Test Summary: 72989 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4573

  3. Simon Praetorius commented on patch set 1 V +1 CR +1 08/11/20, 14:26

    Verified both with manual testing and functional tests of a private extension that makes use of this hook.
  4. Benjamin Franzke commented on patch set 1 08/12/20, 11:52

    What I do not get about this patch – or rather this bug – is that PageRepository already depends on the frontend.user aspect: getMultipleGroupsWhereClause called in enableFields, reads from 'frontend.user'. So it's not just the addEnableColumns hook in enableFields, but the core itself that relies on a possibly changing user context. If that's the case: a) Do we also fix possible core bugs with this? Or is the "real" issue that PageRepository is used too "early" somewhere? I mean, a PageRepository, that doesn't take the current user authentication into account (because it's used too early), can't actually be correct. b) If the cache identifier is actually needed for getMultipleGroupsWhereClause() than we shouldn't document that the user aspect is only added to cache identifier for possible changes by the hook, because than it's just a plain "dependency".
  5. Benni Mack commented on patch set 1 08/13/20, 12:39

    > Patch Set 1: > > What I do not get about this patch – or rather this bug – is that PageRepository already depends on the frontend.user aspect: getMultipleGroupsWhereClause called in enableFields, reads from 'frontend.user'. > So it's not just the addEnableColumns hook in enableFields, but the core itself that relies on a possibly changing user context. > > If that's the case: > a) Do we also fix possible core bugs with this? Or is the "real" issue that PageRepository is used too "early" somewhere? I mean, a PageRepository, that doesn't take the current user authentication into account (because it's used too early), can't actually be correct. > b) If the cache identifier is actually needed for getMultipleGroupsWhereClause() than we shouldn't document that the user aspect is only added to cache identifier for possible changes by the hook, because than it's just a plain "dependency". Previously (until v8 LTS), PageRepository was only initialized once (in $tsfe->sys_page), this was executed when all permissions / groups are set up. In TYPO3 v9, we've used PageRepository also when resolving pages in Routing (where there is no user / group resolved yet), which is why we have different states now. BUT because of this newly added runtime cache (in 9.5.18 I believe), "enableFields" was only called once per request (when there were no groups set up), as in 9.5.17 the hooks were executed multiple times to add custom constraints to enableFields (which is actually quite handy when dealing with GEoIP-related group assigments or A/B testing). But since this is now called only ONCE without any user permissions, you cannot even modify this by yourself anymore. The cache is actually really really helpful when e.g. generating 170 links on one page (page generation) and the enableFields is only called once. The other solution to solve Simon's issue would be (which is much more complicated to achieve IMHO for v9 issues) to cache enableFields but execute the hook multiple times (e.g. every time the instantiation has happened) which would be viable as well.
  6. Andreas Kienast voted on patch set 1 CR +1 09/02/20, 14:52

  7. Anja Leichsenring voted on patch set 1 V +1 CR +1 09/02/20, 17:38

  8. Wouter Wolters voted on patch set 1 CR +1 09/02/20, 17:46

  9. Oli Bartsch voted on patch set 1 CR +1 09/06/20, 13:01

  10. Jörg Bösche voted on patch set 1 CR +1 09/07/20, 07:18

  11. Benjamin Franzke uploaded patch set 2 09/08/20, 11:37

    No functional change – just comments!
  12. TYPO3com voted on patch set 2 V -1 09/08/20, 11:57 Completed build in 20m 02s on Tue, 8 Sep, 11:57 AM Test Summary: 2 of 71747 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5365

  13. TYPO3com commented on patch set 2 09/08/20, 12:22 Completed build in 1h 04m 34s on Tue, 8 Sep, 12:22 PM Test Summary: 1 of 73712 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5365

  14. TYPO3com voted on patch set 2 V +1 09/08/20, 14:32 Completed build in 10m 57s on Tue, 8 Sep, 02:32 PM Test Summary: 73171 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5371

  15. Christian Kuhn voted on patch set 2 CR +1 09/08/20, 18:37

  16. Anja Leichsenring voted on patch set 2 V +2 CR +2 09/08/20, 18:46

  17. Anja Leichsenring merged patch set 3 09/08/20, 18:46