Review main Merged

33501[BUGFIX] Fix links of shortcuts to restricted pages in menus

Markus Klein CR +2 V +2 Easy +22 −9 updated 11/02/14, 19:42

Commit message

Fix missing links in menus when shortcuts point to access restricted
pages or shortcuts themselves are restricted.

This fixes TypoScript menu option "showAccessRestrictedPages"

Review

  • Code review CR +2
    • Helmut Hummel +2
    • Markus Klein +1
  • Verified V +2
    • Helmut Hummel +2
    • Markus Klein +1

Issues 1

Files 2

Review log 24

  1. Markus Klein uploaded patch set 1 10/24/14, 01:41

  2. Gernot Ploiner commented on patch set 1 CR +1 V +1 10/24/14, 04:21

    Works fine on my live-project. Thank you very much!
  3. Helmut Hummel commented on patch set 1 10/30/14, 11:34

    AbstractMenuContentObject.php:1248

    what is this line for? It is not needed, is it? I fear it might lead to unwanted side effects to change that here.
  4. Helmut Hummel commented on patch set 1 10/30/14, 11:35

    other than the inline comment code looks good.
  5. Markus Klein commented on patch set 1 10/30/14, 12:20

    AbstractMenuContentObject.php:1248 Reply

    The menuArr holds the menu item to render, we need to adjust this to the shortcut, otherwise rendering is wrong
  6. Helmut Hummel commented on patch set 1 10/30/14, 15:14

    AbstractMenuContentObject.php:1248 Reply

    For not restricted pages it obviously worked without this line. with your other changes it also works for restricted pages. that is why I'm asking. What does not work for you, if you remove this line?
  7. Helmut Hummel commented on patch set 1 10/30/14, 15:21

    AbstractMenuContentObject.php:1248 Reply

    additionally $shortcut is only the page record, while $menuItem or $this->menuArr[$key] hold additional information about this menu item. so setting the menu item array entry to just the page record seems wrong to me (besides it does not fix anything as far as I can see)
  8. Helmut Hummel uploaded patch set 2 10/30/14, 15:59

  9. Helmut Hummel commented on patch set 1 10/30/14, 15:59

    AbstractMenuContentObject.php:1248 Reply

    OK, dug a little bit further coming to the conclusion, that this is wrong. $this->menuArr[$key] holds the page record to be linked (which can include some page properties that are evaluated for rendering the menu item), not the data of the page to be linked to. So it must remain untouched and only the link needs to be changed, which actually works perfectly. Will push a new changeset
  10. Helmut Hummel commented on patch set 2 CR +1 V +2 10/30/14, 16:04

    AbstractMenuContentObject.php:1240

    I think it is cleaner to use (introduce in this case) API instead of "messing" with internal state of TSFE (although it is exposed through a public property unfortunately)

    TypoScriptFrontendController.php:1597

    although this does not make a nice API, we cannot change the order of arguments for released versions. But I think it would be OK to change it for master later (not many usages in the core and using the arguments 4+5 can be considered as internal use only)
  11. Markus Klein commented on patch set 2 10/30/14, 17:31

    Did you really test exactly the usecase described in the ticket?
  12. Markus Klein commented on patch set 2 CR -2 10/30/14, 17:33

    blocking the merge until I can verify things again.

    AbstractMenuContentObject.php:1240 Reply

    Didn't dare to do so, but was my first thought as well :-)
  13. Markus Klein commented on patch set 1 10/30/14, 17:35

    AbstractMenuContentObject.php:1248 Reply

    I had to make these changes because of the actions performed in changeLinksForAccessRestrictedPages() Will check again now
  14. Markus Klein commented on patch set 2 CR -1 V -1 10/30/14, 18:18

    Nope, patch set 2 fails for the described test case in the ticket, see my comment there please.
  15. Helmut Hummel uploaded patch set 3 11/01/14, 10:18

  16. Markus Klein commented on patch set 3 CR -1 11/01/14, 18:37

    Thanks Helmut for the update. The returnUrl inside the restricted page link is now ok, but the link generated from the shortcut is still pointing to the restricted page and not to the login page (with appended addParams)
  17. Markus Klein commented on patch set 3 11/01/14, 18:42

    The problem is that the checkPageGroupAccess() within the changeLinksForAccessRestrictedPages() method is still performed on the shortcut page and not on the target page, which is stored within the $this->menuArr[$key] variable. For this reason I modified this array in the first patch version.
  18. Markus Klein commented on patch set 3 11/01/14, 18:44

    IMO the menu object does not need to know anything about the shortcut anymore after its target has been determined, hence the menuArr shall contain only information about the actual target.
  19. Helmut Hummel commented on patch set 1 11/02/14, 15:10

    AbstractMenuContentObject.php:1248 Reply

    We cannot just change the $this->menuArr[$key] …

    AbstractMenuContentObject.php:1254

    … because we would break this functionality here. _OVERRIDE_* stuff can be set by userfuncs before and just overriding this array with the target page row will break this.
  20. Helmut Hummel uploaded patch set 4 11/02/14, 15:13

  21. Helmut Hummel uploaded patch set 5 11/02/14, 15:21

  22. Markus Klein voted on patch set 5 CR +1 V +1 11/02/14, 19:37

  23. Helmut Hummel voted on patch set 5 CR +2 V +2 11/02/14, 19:42

  24. Helmut Hummel merged patch set 5 11/02/14, 19:42