Review main Abandoned

63517[WIP][BUGFIX] Add tables_modify checks in fluidbased PageLayoutView

Oli Bartsch CR 0 V 0 Easy +24 −6 updated 03/08/20, 15:23

Commit message

To prevent the display of edit options (e.g. hide/unhide, delete, ...)
in the page module, some checks are added to validate if the current user
is allowed to modify `tt_content`.

ToDo:
* Get feedback
* There are certainly more places to check
* Add some test

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 6

Review log 58

  1. Oli Bartsch uploaded patch set 1 03/01/20, 10:41

  2. TYPO3com voted on patch set 1 V -1 03/01/20, 10:52 Completed build in 10m 46s on Sun, 1 Mar, 10:52 AM Test Summary: 72050 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-886

  3. TYPO3com voted on patch set 1 V +1 03/01/20, 11:09 Completed build in 11m 27s on Sun, 1 Mar, 11:09 AM Test Summary: 72050 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-888

  4. Oli Bartsch uploaded patch set 2 03/01/20, 11:12

  5. TYPO3com voted on patch set 2 V +1 03/01/20, 11:22 Completed build in 10m 21s on Sun, 1 Mar, 11:22 AM Test Summary: 72051 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-890

  6. Claus Due commented on patch set 2 03/01/20, 13:11

    In addition to comments: Please refer to check in \TYPO3\CMS\Backend\Controller\PageLayoutController::isContentEditable which is the check that is reproduced in the "isContentEditable" and "isEditable" methods. This original method does not perform a check for tt_content modification access - it seems to only check for permission flags (not exclude/allow settings) and is specific to a given language. The expectation may actually be that "Access" module flags determine if editing is allowed - without consulting the general "may user modify tt_content?" A/D setting. This *should* mean that if this is a problem in the fluid-based page module, it should be an equal problem in the PageLayoutView and would also need to be addressed there. Since the fluid-based page module's intention is to precisely replicate the behavior of the PageLayoutView, we shouldn't add permission checks in the fluid-based page module that do not exist in the PageLayoutView. This applies not just to the "is editable?" checks but also to the "is drag and drop allowed?" checks. My overall recommendation would be to first check and if necessary, address these problems in the PageLayoutView/PageLayoutController and *then* if that patch is accepted, address the problems, the same way, in the fluid-based replacement. (once that is done the scope of this current change may be different and might allow for a cleaner implementation, e.g. storing this general access flag in the abstract class or DrawingConfiguration instead of repeatedly calling the check methods - which may then allow us to get rid of some duplicated code. I will of coure re-evaluate this once the above is taken care of!)

    StandardContentPreviewRenderer.php:403 Unresolved

    See comment for PageLayoutView - we may not want to change this; or we should change it in a separate patch. This particular point of the code is basically only there to allow hooks that were built for PageLayoutView to function, so it should match the original code in PageLayoutView.

    GridColumnItem.php:234 Unresolved

    This method's body is lifted from PageLayoutView->isDragAndDropAllowed - if it is wrong here, it would also be wrong there. This should probably be extracted to a separate patch which makes the same change in both places and has a more specific topic like "Prevent drag/drop of content if user lacks tt_content modify access".

    LanguageColumn.php:217 Unresolved

    This method is probably redundant: the Fluid templates will access the "allowTranslate" and "allowTranslateCopy" properties but has no use for a getter that returns true if *content* can be edited (this check would be performed by all GridColumn renderings inside the LanguageColumn). It also changes the public API which would technically make this a FEATURE patch.

    PageLayoutView.php:1483 Unresolved

    The old PageLayoutView class should probably remain untouched by this patch. This method is called from a *lot* of different classes, and is accessible from hooks as well. If the current behavior is causing inaccessible content to have editing links in the preview text we probably want to preserve that - or at least move this to a different patch that only touches the PageLayoutView.
  7. Oli Bartsch commented on patch set 2 V -1 03/01/20, 16:32

    > Patch Set 2: > > (4 comments) > > In addition to comments: > > Please refer to check in \TYPO3\CMS\Backend\Controller\PageLayoutController::isContentEditable which is the check that is reproduced in the "isContentEditable" and "isEditable" methods. This original method does not perform a check for tt_content modification access - it seems to only check for permission flags (not exclude/allow settings) and is specific to a given language. > > The expectation may actually be that "Access" module flags determine if editing is allowed - without consulting the general "may user modify tt_content?" A/D setting. > > This *should* mean that if this is a problem in the fluid-based page module, it should be an equal problem in the PageLayoutView and would also need to be addressed there. > > Since the fluid-based page module's intention is to precisely replicate the behavior of the PageLayoutView, we shouldn't add permission checks in the fluid-based page module that do not exist in the PageLayoutView. This applies not just to the "is editable?" checks but also to the "is drag and drop allowed?" checks. > > My overall recommendation would be to first check and if necessary, address these problems in the PageLayoutView/PageLayoutController and *then* if that patch is accepted, address the problems, the same way, in the fluid-based replacement. > > (once that is done the scope of this current change may be different and might allow for a cleaner implementation, e.g. storing this general access flag in the abstract class or DrawingConfiguration instead of repeatedly calling the check methods - which may then allow us to get rid of some duplicated code. I will of coure re-evaluate this once the above is taken care of!) Hi Claus, thank you for your detailed feedback. I really appreciate it. Exactly while testing I switched back to the "old" PageLayoutView and like you said the same applies here. I therefore now added a separate issue: https://forge.typo3.org/issues/90608 and linked it to the fluid-based one I created earlier. I'm totally with you that the PageLayoutView and the fluid-based one should not differ from each other. That's why I was going to also add these checks to the "old" one in this patch. But it is surely a much better idea and easier to review if we make a separat patch and only if this patch is accepted and merged adapt the changes for the fluid-based Variant in this patch. We then may be able to make this one much more simple if we add the "modify allowed check" to a more general method or like you suggested some abstract class. I will -1 this one for now until we figured out how to apply the checks in the PageLayoutView/PageLayoutController.
  8. Claus Due abandoned the change 03/08/20, 15:23

    Fixes in this patch have been integrated into: * https://review.typo3.org/c/Packages/TYPO3.CMS/+/63520 (merged) for the PageLayoutView related fixes. * https://review.typo3.org/c/Packages/TYPO3.CMS/+/63615 for the new page module related fixes.