Review main Merged

66053[BUGFIX] Return alternative group uids when aspect has no user

Xavier Perseguers CR +2 V +2 Easy +20 −8 updated 10/16/20, 15:26

Commit message

When a UserAspect is constructed without any associated
AbstractUserAuthentication user (first constructor argument is null)
as created during Application bootstrap within
\TYPO3\CMS\Frontend\Http\Application::initializeContext(), the
alternative list of group uids needs to be made accessible. This
implies that method getGroupIds() should only check for a
BackendUserAuthentication for a special handling and not do the
erroneous check that it could alternatively be a
FrontendUserAuthentication.

Review

  • Code review CR +2 Done
    • Daniel Goerz +2
    • Markus Klein +1
    • Xavier Perseguers +1
  • Verified V +2 Done
    • Daniel Goerz +2
    • Markus Klein +1
    • Xavier Perseguers +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 2127

Show 12 earlier messages
  1. Xavier Perseguers uploaded patch set 1 10/06/20, 09:12

  2. TYPO3com voted on patch set 1 V -1 10/06/20, 09:43 Completed build in 21m 37s on Tue, 6 Oct, 09:43 AM Test Summary: 6 of 74270 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6261

  1. Markus Klein commented on patch set 1 10/06/20, 09:45

    UserAspectTest.php:213

    is this necessary?
  2. Markus Klein commented on patch set 1 10/06/20, 09:46

    UserAspectTest.php:38 Unresolved

    This test is actually faulty now
  3. Xavier Perseguers commented on patch set 1 10/06/20, 09:47

    UserAspectTest.php:213 Reply Unresolved

    why do have this stuff??? this was supposed to be a test.
  4. Markus Klein commented on patch set 1 10/06/20, 09:48

    UserAspect.php:58 Unresolved

    IMO there must be proper handling if alternativeGroups = null, because $this->groups is not supposed to be null according to the type declaration
  5. Xavier Perseguers uploaded patch set 2 10/06/20, 09:49

  6. TYPO3com voted on patch set 2 V +1 10/06/20, 10:02 Completed build in 12m 29s on Tue, 6 Oct, 10:02 AM Test Summary: 73785 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6263

  7. Xavier Perseguers commented on patch set 2 10/06/20, 13:19

    > Patch Set 1: > > (1 comment)

    UserAspect.php:58 Unresolved

    @Markus Klein wrote in patchset 1: IMO there must be proper handling if alternativeGroups = null, because $this->groups is not supposed to be null according to the type declaration I would suggest this: ``` $this->groups = $alternativeGroups ?: [0, -1]; ``` (remaining in getter below)

    UserAspect.php:139

    the whole "else" block could logically be rewritten as this simpler code: ``` // Alternative groups are set $groups = $this->groups; if ($this->isLoggedIn()) { // If a user is logged in, always add "-2" $groups = [0, -2]; if (!empty($this->user->groupData['uid'])) { $groups = array_merge($groups, array_map('intval', $this->user->groupData['uid'])); } } ```
  8. Benni Mack commented on patch set 2 10/09/20, 19:29

    UserAspect.php:139 Reply

    nope. what's with "-1" then?
  9. Xavier Perseguers commented on patch set 2 10/10/20, 09:53

    UserAspect.php:139 Reply Unresolved

    Default value if you read the first comment in constructor
  10. Benni Mack uploaded patch set 3 10/13/20, 11:50

  11. Oliver Klee commented on patch set 3 10/13/20, 11:54

    Unresolved

    Should this really be "as", or is the letter "h" missing (for "has")?
  12. TYPO3com voted on patch set 3 V -1 10/13/20, 12:16 Completed build in 21m 08s on Tue, 13 Oct, 12:16 PM Test Summary: 6 of 74201 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6470

  13. Benni Mack updated the commit message in patch set 4 10/13/20, 18:57

  14. Benni Mack updated the commit message in patch set 5 10/13/20, 18:58

  15. TYPO3com voted on patch set 4 V -1 10/13/20, 19:22 Completed build in 24m 45s on Tue, 13 Oct, 07:22 PM Test Summary: 6 of 74201 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6499

  16. TYPO3com voted on patch set 5 V -1 10/13/20, 19:24 Completed build in 26m 25s on Tue, 13 Oct, 07:24 PM Test Summary: 6 of 74201 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6500

  17. Markus Klein commented on patch set 5 CR -1 10/14/20, 15:22

    UserAspect.php:58 Unresolved

    handle the null case: $this->groups = $alternativeGroups ?? [];

    UserAspect.php:157 Unresolved

    If no user is present at all, we return an empty list. This is a contradiction to the unittest

    UserAspectTest.php:37 Unresolved

    contradiction to the new implementation
  18. Markus Klein uploaded patch set 6 10/15/20, 13:34

  19. Markus Klein voted on patch set 6 V +1 CR +1 10/15/20, 13:37

  20. TYPO3com voted on patch set 6 V +1 10/15/20, 13:47 Completed build in 12m 42s on Thu, 15 Oct, 01:47 PM Test Summary: 73710 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6560

  21. Benni Mack commented on patch set 6 10/15/20, 14:37

    @xavier, are you fine with the change as is?
  22. Xavier Perseguers commented on patch set 6 V +1 CR +1 10/15/20, 15:55

    Did not check the exact list of page returned but it looks to be working again. Basically, in TYPO3 v8 and in an eID script context, doing that: ``` /** @var $contentObj \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */ $contentObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $foo = $contentObj->getTreeList(804, 99); -- 804 = some page uid ``` returned a list of subpages. In TYPO3 v9, without the patch, the list is empty, with the latest patch, the list is not empty anymore (I double checked that table cache_treelist was empty before checking). So that looks to be working again in the context of the Forge ticket (the unit test just asserts what we all know already).
  23. Xavier Perseguers commented on patch set 6 10/15/20, 15:56

    > Patch Set 6: Verified+1 Code-Review+1 > > Did not check the exact list of page returned but it looks to be working again. Basically, in TYPO3 v8 and in an eID script context, doing that: > > ``` > /** @var $contentObj \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */ > $contentObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); > $foo = $contentObj->getTreeList(804, 99); -- 804 = some page uid > ``` > > returned a list of subpages. In TYPO3 v9, without the patch, the list is empty, with the latest patch, the list is not empty anymore (I double checked that table cache_treelist was empty before checking). > > So that looks to be working again in the context of the Forge ticket (the unit test just asserts what we all know already). But the problem exists in TYPO3 v9 as well, so you don't want to fix TYPO3 v9 anymore?
  24. Daniel Goerz voted on patch set 6 V +2 CR +2 10/16/20, 15:26

  25. Daniel Goerz merged patch set 7 10/16/20, 15:26