Review main Abandoned

73901[BUGFIX] Do not show "New" context menu when deniedNewTables forbids it

Christian Weiske CR 0 V 0 Easy +20 −1 updated 03/23/22, 06:44

Commit message

PageTSconfig "mod.web_list.deniedNewTables" currently prevents the
"new record" button to appear in the record list view and the
new record page.

This patch makes the record context menu respect this setting, too.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 1721

  1. Christian Weiske uploaded patch set 1 03/11/22, 09:58

  2. Benni Mack commented on patch set 1 CR +1 03/11/22, 10:10

    looks good!
  3. core-ci voted on patch set 1 V -1 03/11/22, 10:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24830

  4. Oli Bartsch commented on patch set 1 03/11/22, 10:27

    Not sure whether this is a bugfix. Is there any documentation which states that context menu would respect this setting? Additionally, wouldn't this also required to respect "allowedNewTables" as well? Im not sure whether we should respect this here at all. This is a "mod.web_list" page TSconfig, but the context menu is displayed in various modules and components.

    RecordProvider.php:524

    We would need those adjustments in the PageProvider, too.

    RecordProvider.php:530

    This should be strict.
  5. Christian Weiske uploaded patch set 2 03/11/22, 10:43

  6. Christian Weiske commented on patch set 2 03/11/22, 10:44

    Reply

    > Is there any documentation which states that context menu would respect this setting? No, there is no documentation that says this. > Additionally, wouldn't this also required to respect "allowedNewTables" as well? deniedNewTables overrides allowedNewTables, so I don't think that that has any influence here. > Im not sure whether we should respect this here at all. This is a "mod.web_list" page TSconfig, but the context menu is displayed in various modules and components. This setting is already used in the new content element wizard, which is not exclusive to the list module at all.

    RecordProvider.php:524 Reply

    Done

    RecordProvider.php:530 Reply

    Done
  7. core-ci voted on patch set 2 V -1 03/11/22, 10:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24832

  8. Oli Bartsch commented on patch set 2 03/11/22, 13:12

    Reply

    > deniedNewTables overrides allowedNewTables, so I don't think that that has any influence here. Sure, but "allowedNewTables" can be used to limit the tables, too. If "allowedNewTables = pages" is set, all other tables are denied automatically (allow / include list). > This setting is already used in the new content element wizard, which is not exclusive to the list module at all. Where exactly is this setting already used?

    RecordProvider.php:530 Reply

    With "strict" I meant the 3rd parameter of in_array.
  9. Christian Weiske uploaded patch set 3 03/11/22, 15:00

  10. Christian Weiske commented on patch set 3 03/11/22, 15:10

    Reply

    > Sure, but "allowedNewTables" can be used to limit the tables, too. If "allowedNewTables = pages" is set, all other tables are denied automatically (allow / include list). I've added support for "allowedNewTables". > Where exactly is this setting already used? On the "new record" page that is available at the top of the list view ("+ button"), and to see if the "add new note" should be shown on the top right button bar - but only in web_list, too. So it is currently not used outside web_list at all. The context menu does not get module parameter passed, so I cannot check for that either.

    RecordProvider.php:530 Reply

    Done
  11. core-ci voted on patch set 3 V -1 03/11/22, 15:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24835

  12. Oli Bartsch commented on patch set 3 03/11/22, 20:28

    Reply Unresolved

    Sorry, but I can't follow you here. Anyways as you said, there are no module parameters passed, because the context menu can be displayed anywhere, without any context. Therefore, I still think we should not add this setting here. Especially not as a bugfix, because as explained, this does not look like a bug (not documented at all and IMO also a different use case).
  13. Christian Weiske commented on patch set 3 03/14/22, 07:41

    > Sorry, but I can't follow you here. I meant to say that I was wrong when I initially wrote that the setting is already used outside web_list. I still think the appearance of the "New" button is a bug, because I used deniedNewTables to disallow creation of new records, and now the users are still able to create new records. When you insist on this being a new feature - where should this non-web-list-specific typoscript setting be located then?
  14. Oli Bartsch commented on patch set 3 03/14/22, 09:02

    Reply

    > I used deniedNewTables to disallow creation of new records Pleas be aware that this does not prevent users from creating those records. This only hides some buttons in UX. Instead, access controls for the user / user group should to set.
  15. Christian Weiske uploaded patch set 4 03/14/22, 09:33

  16. core-ci voted on patch set 4 V +1 03/14/22, 09:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24870

  17. Christian Weiske commented on patch set 4 03/22/22, 15:35

    @oliver bartsch: When you insist on this being a new feature - where should this non-web-list-specific typoscript setting be located then?
  18. Oli Bartsch commented on patch set 4 03/22/22, 16:02

    Reply

    I'm actually not sure if we should introduce a new option at all. Why not just using the access controls as mentioned in my last comment?
  19. Christian Weiske commented on patch set 4 03/22/22, 16:45

    Reply

    > Why not just using the access controls as mentioned in my last comment? AFAIK, access controls (backend user groups and System>Access) cannot be used to prevent creation of new records while allowing editing of existing ones.
  20. Oli Bartsch commented on patch set 4 03/22/22, 17:34

    Reply Unresolved

    Right. For this case case you might want to use the dedicated TSconfig options for the context menu. For example: options.contextMenu.table.<some_table>.disableItems = new See https://docs.typo3.org/m/typo3/reference-tsconfig/main/en-us/UserTsconfig/Options.html?highlight=disabledelete#contextmenu-disableitems
  21. Christian Weiske abandoned the change 03/23/22, 06:44

    An option to disable the "new" menu item in context menus already exists in UserTSConfig: options.contextMenu.table.xxx.disableItems