Review main Merged

83743[FEATURE] Combine be_groups table permission read & write UI

Marcin Sągol CR +2 V +2 Hard +745 −27 updated 07/06/24, 17:26

Commit message

The `tables_select` and `tables_modify` lists have the same
items listed, so instead of managing them through separate
views, the merges them into a single view.

The new (merged) table renders the three options "No Access",
"Read" and "Read & Write" for each table. Those options are
accompanied by the multi record selection options to
"Check All", "Uncheck All" and to "Toggle Selection".

To render this new table view and handle its behavior, a
dedicated form renderType `tablePermission` is introduced, which
is now set for the `tables_modify` column. The `tables_select`
column has been changed to TCA type `passthrough`.

The new form element is defined through:
`\TYPO3\CMS\Backend\Form\Element\TablePermissionElement`.
It uses a dedicated data provider defined in:
`\TYPO3\CMS\Backend\Form\FormDataProvider\TcaTablePermission`.
The JavaScript code is handled by a new web component:
`@typo3/backend/form-engine/element/table-permission-element.js`.

When the TcaTablePermission data provider handles the
configuration, it reads table lists from both the `tables_select`
and `tables_modify` columns and combines them into a single array
with unique table names.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Georg Ringer +1
    • Marcin Sągol +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Georg Ringer +1
    • Marcin Sągol +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 13

Review log 215291

Show 192266 earlier messages
  1. Marcin Sągol uploaded patch set 1 04/11/24, 10:50

  2. core-ci voted on patch set 1 V -1 04/11/24, 10:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55754

  3. Marcin Sągol uploaded patch set 2 V -1 04/11/24, 11:05

  4. core-ci voted on patch set 2 V +1 04/11/24, 11:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55758

  5. Georg Ringer commented on patch set 2 04/11/24, 11:58

    this would be really a feature and needs a rst as it is a bit breaking because in list view now the "table_select" is not possible to show anymore. don't get me wrong, this is not a -1 but should still be told and this is a so important feature that it really deserves a feature!!
  6. Ayke Halder commented on patch set 2 04/11/24, 12:35

    select-check-box-table-permissions-element.ts:86

    In case you start with state: [select: **checked** | modify: not checked] Now you do: 1. Click `modify` to allow [select: checked & disabled | modify: checked] 2. Click `modify` again to revert [select: **not checked** | modify: not checked] So this is not the best. In this case we must have the state from the beginning: [select: **checked** | modify: not checked] Disabling the `select`-checkbox on `modify` checked is okay. We might change the visual representation of the disabled `select`-checkbox to a visual style 'disabled & checked`. But don't change the internal state of the `select`-checkbox.
  7. Mathias Brodala commented on patch set 2 04/15/24, 05:53

    IMO this is not the best UX. Especially if there is no clear indication why the 1st checkbox is suddenly disabled and not ready for interaction anymore. If we have a setup like this where one selection implies another one, maybe a different UI element should be chosen instead. A custom 3-step switch element would be a better choice since one can see at a glimpse what actions are possible and only have a single object (the knob) to interact with. The closest native alternative would be a HTML "slider" element: > <input type="range" min="0" max="2" step="1" value="0">
  8. Ayke Halder commented on patch set 2 04/15/24, 15:14

    Reply

    There is a discussion on Slack: https://typo3.slack.com/archives/C03AM9R17/p1712832846227209 My opinion: * For UX use simple radio buttons to implement a 3-state-input element. But radio buttons are not trivial to implement here, as the input spans over multiple rows and is finally merged into the two database fields `tables_select` and `tables_modify`. * For easy implementation use a two checkbox solution with two-way coupling. Never deactivate (gray out) any of these boxes: * Click on unchecked modify-box does check both boxes. * Click on checked select-box does uncheck both boxes.
  9. Mathias Brodala commented on patch set 2 04/16/24, 05:22

    Reply

    Yeah, this could also work. With this variant the user can at least always interact with all objects and will quickly grasp the indicated behavior.
  10. Marcin Sągol uploaded patch set 3 V +1 06/05/24, 09:15

  11. Marcin Sągol commented on patch set 3 06/05/24, 09:19

    Reply

    I have discussed this with UI/UX team and from their perspective it is ok to have the first checkbox disabled. Do you think that we need a better indicator why those checkboxes are disabled, than the current description of this section: Tables chosen for modification automatically receive read access permissions. Therefore, there's no need to select them again for listing.
  12. core-ci voted on patch set 3 V -1 06/05/24, 09:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58732

  13. Ayke Halder uploaded patch set 4 V -1 06/05/24, 15:22

  14. Ayke Halder commented on patch set 4 06/05/24, 15:24

    This refactors the code to split up: - preparation of a config array for the checkboxes - rendering of the checkboxes
  15. Ayke Halder uploaded patch set 5 06/05/24, 15:27

  16. core-ci voted on patch set 4 V -1 06/05/24, 15:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58759

  17. Ayke Halder commented on patch set 5 06/05/24, 15:28

    SelectCheckBoxTablePermissionsElement.php:126

    This fixes a logic error which was already present in the code from patchset 3.
  18. core-ci voted on patch set 5 V +1 06/05/24, 15:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58760

  19. Ayke Halder uploaded patch set 6 06/05/24, 15:33

    Copied Votes: * Verified+1 (copy condition: "**changekind:NO_CHANGE**")
  20. core-ci voted on patch set 6 V +1 06/05/24, 15:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58761

  21. Ayke Halder uploaded patch set 7 V +1 06/05/24, 17:24

  22. core-ci voted on patch set 7 V +1 06/05/24, 17:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58762

  23. Ayke Halder uploaded patch set 8 V +1 06/05/24, 19:51

  24. core-ci voted on patch set 8 V +1 06/05/24, 19:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58763

  25. Marcin Sągol uploaded patch set 9 V +1 06/06/24, 10:35

  26. Ayke Halder commented on patch set 9 06/06/24, 10:40

    SelectCheckBoxTablePermissionsElement.php:184

    There is a logic error. This must be: ```php if ($readOnly || ($type === 'select' && $item['modify']['checked'])) { $inputElementAttrs['disabled'] = 'disabled'; } if (!$readOnly) { $inputElementAttrs = array_merge( $inputElementAttrs, str_replace('tables_modify', 'tables_' . $type, $this->getOnFieldChangeAttrs('click', $parameterArray['fieldChangeFunc'] ?? [])) ); } ```
  27. core-ci voted on patch set 9 V +1 06/06/24, 10:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58792

  28. Marcin Sągol uploaded patch set 10 V +1 06/06/24, 11:15

  29. Marcin Sągol commented on patch set 10 06/06/24, 11:15

    SelectCheckBoxTablePermissionsElement.php:184 Reply

    Fixed.
  30. core-ci voted on patch set 10 V +1 06/06/24, 11:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58794

  31. Marcin Sągol commented on patch set 10 06/06/24, 11:27

    Reply

    @mbrodala@pagemachine.de @mail@ayke-halder.de is it ok for you to close this discussion for now?
  32. Ayke Halder commented on patch set 9 06/06/24, 11:41

    Some suggestions to make the code more readable and maintainable for the future. Also see https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/5..7

    SelectCheckBoxTablePermissionsElement.php:30

    The strings `tables_select`and `tables_modify` are used everywhere in the code as they are the names of the table-fields. Maybe introduce constants and use them: ```php private const FIELD_MODIFY = 'tables_modify'; private const FIELD_SELECT = 'tables_select'; ```

    SelectCheckBoxTablePermissionsElement.php:31

    In TS we have some constants: ```TS enum RestrictionType { select = 'select', modify = 'modify', } ``` Maybe also introduce them here and use them in the code: ```php private const RESTRICTION_TYPES = [ SELF::FIELD_MODIFY => 'modify', SELF::FIELD_SELECT => 'select', ]; ```

    SelectCheckBoxTablePermissionsElement.php:91

    The values `0` and `1` are only used as boolean and never become part of the html-output. Maybe use boolean `false` and `true` instead.

    SelectCheckBoxTablePermissionsElement.php:109

    This very same string replace is used 3 times in the code. Maybe refactor it as an own function: ```php /** * Replace the field tables_modify by the field tables_select * * @param string|string[] $subject * @return string|string[] */ private static function replaceFieldModifyByFieldSelect(array|string $subject): array|string { return str_replace( search: self::FIELD_MODIFY, replace: self::FIELD_SELECT, subject: $subject ); } ```

    SelectCheckBoxTablePermissionsElement.php:136

    This very same string replace is used 3 times in the code. See comment above.

    SelectCheckBoxTablePermissionsElement.php:164

    Here we are in rendering context of the function. But the following code logic does define all the attributes for the 'select'- and 'modify'-checkbox. Maybe move this logic up to the part where the checkboxes are first defined: ```php // Build item array $groups[$currentGroup]['items'][] = [ 'id' => $elementId . '-item-', … 'select' => […], 'modify' => […], ] ``` Then this part of the function just need to do the rendering - see below: ``` $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($inputElementAttrs, true, true) . '>'; ```

    SelectCheckBoxTablePermissionsElement.php:171

    Maybe use constant here as this must be the same string as in the javascript-code. ```php 'data-restriction-type' => self::RESTRICTION_TYPES[$type], ```

    SelectCheckBoxTablePermissionsElement.php:182

    This very same string replace is used 3 times in the code. See comment above. Additionaly this replace is only neccessary for `$type === 'select'`. For `$type === 'modify'` it becomes `str_replace('tables_modify', 'tables_modify', …)`. Maybe put the replace inside an `if ($type === 'select') {…}`
  33. Ayke Halder commented on patch set 10 06/06/24, 11:47

    Reply

    As you have discussed with UI/UX team, this is the how it will be for now. We might introduce the suggested behaviour in the future by an extra patch like this: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/7..8 Who from UI/UX team may I contact on this topic?
  34. Ayke Halder commented on patch set 10 06/06/24, 13:29

    Bullet points should look like: ```md * Bullet points are okay, too * An asterisk (`*`) is used for the bullet, it can be followed by a single space. This format is rendered correctly by Forge (redmine) * Use a hanging indent ```
    This line is to long, just wrap it to 72 characters.
  35. Ayke Halder commented on patch set 10 CR -1 06/06/24, 14:15

    Impact of missing ARIA labels: * Before this patch: You can click on the title (`<label>`-tag) to change the checkbox value. * With this patch: The title can not be associtated with one specific checkbox, thereby you can not click anmyore on the title to change the checkbox. So you must click directly on the checkbox now. --- Besides the missing feature above, the ARIA label connection to the checkboxes is broken right now and must be fixed: Sorry, this would take to much effort to comment each line of the code which needs to be changed. So here is a suggested patch: ```diff diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php --- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php (revision 42751e8d70c3ccca2f34d21af96561085c4a72f1) +++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php (date 1717682144845) @@ -100,7 +100,7 @@ // Build item array $groups[$currentGroup]['items'][] = [ - 'id' => $elementId . '-item-', + 'id' => $elementId . '-item-' . $counter, 'value' => $item['value'], 'icon' => FormEngineUtility::getIconHtml(!empty($item['icon']) ? $item['icon'] : 'empty-empty'), 'title' => $item['label'], @@ -158,14 +158,15 @@ $tableRows = []; // Render rows - foreach ($group['items'] as $itemNumber => $item) { + foreach ($group['items'] as $item) { $tableRows[] = '<tr>'; foreach (['select', 'modify'] as $type) { $inputElementAttrs = [ 'type' => 'checkbox', 'class' => 't3js-checkbox', - 'id' => $item['id'] . $itemNumber . '-tables_' . $type, + 'id' => $item['id'] . '-tables_' . $type, + 'aria-labelledby' => $item['id'] . '-label', 'name' => $item[$type]['name'], 'value' => $item['value'], 'data-restriction-type' => $type, @@ -190,7 +191,7 @@ } $tableRows[] = '<td class="col-title">'; - $tableRows[] = '<label class="label-block nowrap-disabled" for="' . $item['id'] . '">'; + $tableRows[] = '<label class="label-block nowrap-disabled" id="' . $item['id'] . '-label">'; $tableRows[] = '<span class="inline-icon">' . $item['icon'] . '</span>'; $tableRows[] = htmlspecialchars($this->appendValueToLabelInDebugMode($item['title'], $item['value']), ENT_COMPAT, 'UTF-8', false); $tableRows[] = '</label>'; ```

    SelectCheckBoxTablePermissionsElement.php:193

    This ARIA label to checkbox connection is broken. ```html <tr> <td class="col-checkbox"> <input type="checkbox" id="formengine-select-checkbox-666198c06f8d7177057673-item-0-tables_select" …> </td> <td class="col-checkbox"> <input type="checkbox" id="formengine-select-checkbox-666198c06f8d7177057673-item-0-tables_modify" …> </td> <td class="col-title"> <label … for="formengine-select-checkbox-666198c06f8d7177057673-item-"> … Page </label> </td> <td class="text-end"></td> </tr> ```
  36. Ayke Halder commented on patch set 10 06/06/24, 14:26

    Suggestion on missing click on title/label functionality: See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby > Note that while using aria-labelledby is similar in this situation to using an HTML <label> element with the for attribute, there are some very important differences. The aria-labelledby attribute only defines the accessible name. It doesn't provide any of <label>'s other functionality, such as making clicking on the labeling element activate the input it is associated with. That has to be added back in with JavaScript. Add a JS-action for click on title which circles through this 3 states: * O select / O modify * X select / O modify * X select / X modify
  37. Michael Telgkamp commented on patch set 10 V -1 06/07/24, 05:30

    Some additional remarks from accessibility point of view: - Having one checkbox change content/states BEFORE the checkbox itself is unwanted, would it be possible to switch positions of the checkboxes? If Write access is the first column, the second checkbox with read access comes afterwards and is not announced again when the "write" is checked already. - The table header for the second column should not be colspan="2" because this would have the header logically connected to the name column. Please add an additional header for this column. - The labelling of the checkboxes is not sufficient. An alternative to the suggestions already mentioned would be to use the text content of the table headers for labelling by adding them as additional value in the `aria-labelledby` attribute. For this the table header elements containing "Read" and "Write" needs to have an `id` and the `aria-labelledby` would then be something like `aria-labelledby="formengine-select-header-read-SOMEUID formengine-select-checkbox-666198c06f8d7177057673-item-0-label"` There are more accessibility issues with this table, but I addressed the ones introduced by this patch.
  38. Marcin Sągol uploaded patch set 11 CR -1 V +1 06/08/24, 13:30

  39. Marcin Sągol commented on patch set 10 06/08/24, 13:30

    Reply

    I usually talk with @rfoucard@w-seils.com and @erredeco@gmail.com

    SelectCheckBoxTablePermissionsElement.php:30 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:31 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:91 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:109 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:136 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:171 Reply

    I think just $type can be used as now we iterate over and constant array: foreach (self::RESTRICTION_TYPES as $type) { ... }

    SelectCheckBoxTablePermissionsElement.php:182 Reply

    Done
  40. core-ci voted on patch set 11 V -1 06/08/24, 13:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58914

  41. Marcin Sągol uploaded patch set 12 V -1 06/08/24, 14:50

  42. Marcin Sągol commented on patch set 11 06/08/24, 14:51

    SelectCheckBoxTablePermissionsElement.php:164 Reply

    I have changed the code, to define whole checkbox element (modify and select) in one place, than just render both checkboxes with GeneralUtility::implodeAttributes().
  43. Marcin Sągol updated the commit message in patch set 13 06/08/24, 14:53

  44. Marcin Sągol commented on patch set 12 06/08/24, 14:53

    Reply

    Done

    Reply

    Done
  45. core-ci voted on patch set 12 V +1 06/08/24, 14:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58915

  46. core-ci voted on patch set 13 V +1 06/08/24, 15:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58916

  47. Marcin Sągol uploaded patch set 14 V +1 06/08/24, 17:37

  48. core-ci voted on patch set 14 V +1 06/08/24, 17:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58924

  49. Marcin Sągol commented on patch set 13 06/08/24, 17:42

    Reply

    I have implemented this solution. So now the aria-labelledby value is a concatenation of a column header Read/Write + table name which comes from column with table title value.

    SelectCheckBoxTablePermissionsElement.php:193 Reply

    I have implemented solution proposed by @michael.telgkamp@mindscreen.de. The column header + field title is used to have the aria-labelledby value defined.
  50. Marcin Sągol commented on patch set 14 06/08/24, 17:44

    select-check-box-table-permissions-element.ts:86 Reply

    They should not be changed now.
  51. Simon Schaufelberger updated the commit message in patch set 15 V +1 06/08/24, 19:36

  52. core-ci voted on patch set 15 V +1 06/08/24, 19:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58927

  53. Marcin Sągol uploaded patch set 16 V +1 06/08/24, 20:10

  54. core-ci voted on patch set 16 V +1 06/08/24, 20:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58928

  55. Georg Ringer voted on patch set 16 CR +1 V +1 06/09/24, 08:18

  56. Ayke Halder commented on patch set 16 CR -1 06/10/24, 07:57

    Please have a look at ARIA labeling.

    SelectCheckBoxTablePermissionsElement.php:33

    Comment not needed anymore - order is set below.

    SelectCheckBoxTablePermissionsElement.php:145

    About comment above: order is set here.

    SelectCheckBoxTablePermissionsElement.php:146

    No use of constants here but use of constants below.

    SelectCheckBoxTablePermissionsElement.php:200

    Use of constant here but no use of constant above.

    SelectCheckBoxTablePermissionsElement.php:202

    A11y: This is not the label for the checkbox anymore. The new label is already the table column-header. Defined via `aria-labelledby`-attribute of the checkbox.
  57. Marcin Sągol uploaded patch set 17 CR +1 V +1 06/10/24, 08:48

  58. Marcin Sągol commented on patch set 16 06/10/24, 08:48

    SelectCheckBoxTablePermissionsElement.php:33 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:145 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:146 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:200 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:202 Reply

    Done
  59. Marcin Sągol uploaded patch set 18 06/10/24, 08:53

  60. core-ci voted on patch set 17 V -1 06/10/24, 08:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58984

  61. core-ci voted on patch set 18 V +1 06/10/24, 08:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58985

  62. Marcin Sągol rebased onto patch set 19 V +1 06/10/24, 09:01

  63. core-ci voted on patch set 19 V +1 06/10/24, 09:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58986

  64. Michael Telgkamp commented on patch set 19 CR -1 06/10/24, 09:44

    We are on the sprint in DUS and plan to have a deeper look into it. Also some consolidation with the layout other table views is planned. Probably there will also be some connected additional tickets for more improvements.
  65. Ayke Halder commented on patch set 19 06/10/24, 10:21

    Reply

    May we get this here merged without fixing the a11y implications of the table header? The table header-columns on all these permission/data-record tables are a11y-broken right now. The header-columns are used for this checkbox "toggle/select all" and therefor they actually do not associate correctly with the colums of the table. Also see: https://typo3.slack.com/archives/C027S88NY/p1718013691585059?thread_ts=1718012218.748539&cid=C027S88NY I think we can fix these header-columns after merging this one here.
  66. Marcin Sągol uploaded patch set 20 CR -1 V +1 06/10/24, 10:25

  67. core-ci voted on patch set 20 V +1 06/10/24, 10:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58989

  68. Ayke Halder commented on patch set 19 06/10/24, 10:39

    The functionality is working perfectly! Just some minor nitpick: Boolean HTML attributes need the correct string values: Right now `true` typecasts to string "1". `$tableModifyElement['checked'] = true;` results in `<input checked="1">` For `true` it should be either an empty string `<input checked="">` or the attribute name repeated `<input checked="checked">` (The third option to use an attribute without a value at all like `<input checked>` is not possible by using `GeneralUtility::implodeAttributes()`.) Same for the `disabled`-attribute. See https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML > Note: The strings "true" and "false" are invalid values. To set the attribute to false, the attribute should not be present in the element tag. Though modern browsers treat any string value as true, you should not rely on that behavior. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#checked https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled

    SelectCheckBoxTablePermissionsElement.php:115

    Should be either `$tableModifyElement['checked'] = "";` or `$tableModifyElement['checked'] = "checked";`

    SelectCheckBoxTablePermissionsElement.php:118

    Should be either `$tableModifyElement['disabled'] = "";` or `$tableModifyElement['disabled'] = "disabled";`

    SelectCheckBoxTablePermissionsElement.php:128

    See above.

    SelectCheckBoxTablePermissionsElement.php:131

    See above.
  69. Michael Telgkamp commented on patch set 20 CR -1 06/10/24, 10:39

    I found a mixup of the IDs used. This needs to be fixed.

    SelectCheckBoxTablePermissionsElement.php:111

    Table modify element is for Modification / Write access. Thus the $writeColumnId needs to be used here.

    SelectCheckBoxTablePermissionsElement.php:125

    Here the $readColumnId needs to be used
  70. Marcin Sągol uploaded patch set 21 CR -1 V +1 06/10/24, 11:39

  71. Marcin Sągol commented on patch set 20 06/10/24, 11:39

    SelectCheckBoxTablePermissionsElement.php:115 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:118 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:128 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:131 Reply

    Done
  72. Marcin Sągol uploaded patch set 22 06/10/24, 11:42

  73. Marcin Sągol commented on patch set 21 06/10/24, 11:42

    SelectCheckBoxTablePermissionsElement.php:111 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:125 Reply

    Done
  74. core-ci voted on patch set 21 V +1 06/10/24, 11:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58998

  75. core-ci voted on patch set 22 V +1 06/10/24, 11:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58999

  76. Michael Telgkamp commented on patch set 22 CR +1 V +1 06/10/24, 12:12

    Reply

    The problem I see here is, that the text is no longer the (only part of the) label. Implementing this additional behavior would not be expected, as toggling multiple checkboxes with one part of a label is not intuitive, and keyboard interactivity for the "label" would also be required. Having a third interactive element for each row would not be helpful.

    Reply

    I would not like to have this change in the patch (as explained in the other comment).
  77. Ayke Halder commented on patch set 22 CR -1 06/10/24, 12:53

    A11y: make screenreaders read the row-title after the checkbox-label See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role By adding `role="rowheader"` to the title column, we get a pretty nice screenreader readout. Without this: * "Checkbox Read not checked" -> [Tab] * "Checkbox Write not checked" -> [Tab] * "Checkbox Read not checked" -> [Tab] * "Checkbox Write not checked" -> [Tab] * "Checkbox Read not checked" -> [Tab] * "Checkbox Write not checked" -> [Tab] With `role="rowheader"` set: * "Checkbox Read Page not checked" -> [Tab] * "Checkbox Write Page not checked" -> [Tab] * "Checkbox Read Category not checked" -> [Tab] * "Checkbox Write Category not checked" -> [Tab] * "Checkbox Read File not checked" -> [Tab] * "Checkbox Write File not checked" -> [Tab]

    SelectCheckBoxTablePermissionsElement.php:200

    Change `<td class="col-title">` to `<td class="col-title" role="rowheader">`
  78. Ayke Halder commented on patch set 22 CR +1 V +1 06/10/24, 13:01

    All and everything looks perfect now! Great job on this!

    Reply

    Actually also works without setting `role="rowheader"` - no need to add this.

    SelectCheckBoxTablePermissionsElement.php:200 Reply

    Actually also works without setting `role="rowheader"` - no need to add this.
  79. Georg Ringer commented on patch set 22 CR +1 V +1 06/10/24, 13:19

    can you please provide a feature.rst and change back to FEATURE? for integrators this is a sooooo nice feature which should really not get lost!!!
  80. Andreas Kienast commented on patch set 22 CR -1 06/10/24, 13:26

    SelectCheckBoxTablePermissionsElement.php:2

    declare(strict_types=1) is missing
  81. Ayke Halder commented on patch set 22 V 0 CR -1 06/10/24, 14:00

    SelectCheckBoxTablePermissionsElement.php:101

    We can't have any attribute here, which must not become part of the HTML code. So we might need to reintroduce the use of the item-object for these attributes: * `$item['icon']` * `$item['title']` * `$item['help']` Current-state: ```html <td class="col-checkbox"> <input type="checkbox" class="t3js-checkbox" id="formengine-select-checkbox-666702aea43a9867435772-item-1-tables_select" value="sys_category" name="data[be_groups][2][tables_select][1]" data-restriction-type="select" aria-labelledby="formengine-select-header-read-666702aea439f540540775 formengine-select-checkbox-666702aea43a9867435772-item-1-tables_select" checked="checked" data-formengine-field-change-event="click" data-formengine-field-change-items="[{&quot;name&quot;:&quot;typo3-backend-form-update-value&quot;,&quot;data&quot;:{&quot;tableName&quot;:&quot;be_groups&quot;,&quot;identifier&quot;:&quot;2&quot;,&quot;fieldName&quot;:&quot;tables_select&quot;,&quot;elementName&quot;:&quot;data[be_groups][2][tables_select]&quot;}}] <!-- these attributes must be removed --> icon="<span class=&quot;t3js-icon icon icon-size-small icon-state-default icon-mimetypes-x-sys_category&quot; data-identifier=&quot;mimetypes-x-sys_category&quot; aria-hidden=&quot;true&quot;> <span class=&quot;icon-markup&quot;> <svg class=&quot;icon-color&quot;><use xlink:href=&quot;/typo3/sysext/core/Resources/Public/Icons/T3Icons/sprites/mimetypes.svg#mimetypes-x-sys_category&quot; /></svg> </span> </span>" title="Category" help=""> </td> ```
  82. Marcin Sągol uploaded patch set 23 CR +1 V +1 06/10/24, 14:03

  83. Marcin Sągol commented on patch set 23 06/10/24, 14:04

    SelectCheckBoxTablePermissionsElement.php:2 Reply

    Done
  84. Marcin Sągol commented on patch set 23 06/10/24, 14:07

    SelectCheckBoxTablePermissionsElement.php:101 Reply

    Would it be ok if we filter them out from $tableModifyElement before rendering attributes?
  85. core-ci voted on patch set 23 V +1 06/10/24, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59015

  86. Marcin Sągol uploaded patch set 24 V +1 06/10/24, 14:23

  87. Marcin Sągol commented on patch set 23 06/10/24, 14:25

    SelectCheckBoxTablePermissionsElement.php:101 Reply

    To distinguish the attributes form the other settings, I have put them (attributes) inside the separate array.
  88. core-ci voted on patch set 24 V +1 06/10/24, 14:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59016

  89. Ayke Halder commented on patch set 23 06/10/24, 14:31

    SelectCheckBoxTablePermissionsElement.php:101 Reply

    To go with the idea of having no item-object: ```php $groups[$currentGroup]['items'][] = [ self::RESTRICTION_TYPES[self::FIELD_SELECT] => $tableSelectElement, self::RESTRICTION_TYPES[self::FIELD_MODIFY] => $tableModifyElement, 'config' => [ 'title' => …, 'icon' => …, 'value' => …, 'help' => …, ] ]; ``` May we add a title-element like this there? With: ```php foreach ($group['items'] as $modifySelectElements) { $tableRows[] = '<tr>' // TODO: re-add comment about order to self::RESTRICTION_TYPES foreach (self::RESTRICTION_TYPES as $type) { $tableRows[] = '<td class="col-checkbox">'; $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($modifySelectElements[$type], true, true) . '>'; $tableRows[] = '</td>'; } $tableRows[] = '<td class="col-title">'; $tableRows[] = '<span class="inline-icon">' . $$modifySelectElements['config']['icon'] . '</span>'; $tableRows[] = htmlspecialchars($this->appendValueToLabelInDebugMode($modifySelectElements['config']['title'], $modifySelectElements['config']['value']), ENT_COMPAT, 'UTF-8', false); $tableRows[] = '</td>'; $tableRows[] = '<td class="text-end">' . $modifySelectElements['config']['help'] . '</td>'; $tableRows[] = '</tr>'; ``` And we actually need to keep the 'title' attribute for the checkboxes or otherwise change `aria-labelledby="$writeColumnId . ' ' . $titleLabelId"` - and add this id to the title-label.
  90. Ayke Halder commented on patch set 24 06/10/24, 15:09

    SelectCheckBoxTablePermissionsElement.php:101 Reply

    About this added sub-key 'attributes' - this results in this data structure: ``` php $groups[$currentGroup]['items'][] = [ 'select' => [ 'attributes' => [ // <-- used for select-checkbox only 'type' => …, 'class' => …, 'id' => …, 'value' => …, 'name' => …, 'data-restriction-type' => …, 'aria-labelledby' => …, ], 'icon' => …, // <-- not used anywhere 'title' => …, // <-- not used anywhere 'help' => …, // <-- not used anywhere ], 'modify' => [ 'attributes' => [ // <-- used for modify-checkbox and partly for col-label 'type' => …, 'class' => …, 'id' => …, 'value' => …, // <-- used for modify-checkbox and also for col-label 'name' => …, 'data-restriction-type' => …, 'aria-labelledby' => …, ], 'icon' => …, // <-- only used for col-label 'title' => …, // <-- only used for col-label 'help' => …, // <-- only used for col-help ], ]; ``` ---- IMHO would rather go for a data-structure similar to this: ```php $groups[$currentGroup]['items'][] = [ 'select' => [ // <-- used for select-checkbox only 'type' => …, 'class' => …, 'id' => …, 'value' => …, 'name' => …, 'data-restriction-type' => …, 'aria-labelledby' => …, ], 'modify' => [ // <-- used for modify-checkbox only 'type' => …, 'class' => …, 'id' => …, 'value' => …, 'name' => …, 'data-restriction-type' => …, 'aria-labelledby' => …, ], 'label' => [ // <-- used for col-label only 'value' => …, 'icon' => …, 'title' => …, ], 'help' => …, // <-- used for col-help only ]; ```
  91. Marcin Sągol uploaded patch set 25 V +1 06/10/24, 15:34

  92. Marcin Sągol commented on patch set 24 06/10/24, 15:36

    SelectCheckBoxTablePermissionsElement.php:101 Reply

    I have used the second approach, so for each item we now have an array with select, modify, label and help keys.
  93. core-ci voted on patch set 25 V +1 06/10/24, 15:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59041

  94. Ayke Halder commented on patch set 25 06/10/24, 17:09

    We need to fix the attribute `aria-labelledby` for the checkboxes as the checkboxes do not have the attribute `title` anymore. Maybe re-introduce the `label`-tag in the label-column and reference to this. Thereby the `id`-attributes of the checkboxes become obsolete. ```patch diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php --- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php (revision 90ca01e48c8ccf9bc1dd574295442a36bfc0cd2d) +++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php (date 1718039000405) @@ -67,7 +67,7 @@ $currentGroup = 0; $counter = 0; // Those ids are needed to generate combined aria-labelledby attribute for the checkboxes. - // The aria-labelledby value will be a concatenation of this id field and the field label itself. + // The aria-labelledby value will be a concatenation of this id field and the elements label id. $readColumnId = StringUtility::getUniqueId('formengine-select-header-read-'); $writeColumnId = StringUtility::getUniqueId('formengine-select-header-write-'); $elementIdPrefix = StringUtility::getUniqueId('formengine-select-checkbox-'); @@ -86,6 +86,8 @@ continue; } + $labelId = $elementIdPrefix . '-item-' . $counter . '-label'; + // Help text is expected to be an associative array with two keys: "title" and "description". // For the sake of backwards compatibility, we test if the help text is a string and use it // as a description (this could happen if items are modified with an itemProcFunc) @@ -98,16 +100,14 @@ $checkedForModify = isset($itemArrayModify[$item['value']]); $checkedForSelect = $checkedForModify || isset($itemArraySelect[$item['value']]); - $checkboxModifyId = $elementIdPrefix . '-item-' . $counter . '-' . self::FIELD_MODIFY; // Build configuration array for related checkboxes elements (the table_modify and table_select fields) $tableModifyElementAttrs = [ 'type' => 'checkbox', 'class' => 't3js-checkbox', - 'id' => $checkboxModifyId, 'value' => $item['value'], 'name' => $parameterArray['itemFormElName'] . '[' . $counter . ']', 'data-restriction-type' => self::RESTRICTION_TYPES[self::FIELD_MODIFY], - 'aria-labelledby' => $writeColumnId . ' ' . $checkboxModifyId, + 'aria-labelledby' => $writeColumnId . ' ' . $labelId, ]; if ($checkedForModify) { @@ -118,10 +118,9 @@ } $tableSelectElementAttrs = $tableModifyElementAttrs; - $tableSelectElementAttrs['id'] = self::replaceFieldModifyByFieldSelect($tableSelectElementAttrs['id']); $tableSelectElementAttrs['name'] = self::replaceFieldModifyByFieldSelect($parameterArray['itemFormElName'] . '[' . $counter . ']'); $tableSelectElementAttrs['data-restriction-type'] = self::RESTRICTION_TYPES[self::FIELD_SELECT]; - $tableSelectElementAttrs['aria-labelledby'] = $readColumnId . ' ' . self::replaceFieldModifyByFieldSelect($tableSelectElementAttrs['id']); + $tableSelectElementAttrs['aria-labelledby'] = $readColumnId . ' ' . $labelId; if ($checkedForSelect) { $tableSelectElementAttrs['checked'] = 'checked'; @@ -143,6 +142,7 @@ self::RESTRICTION_TYPES[self::FIELD_SELECT] => $tableSelectElementAttrs, self::RESTRICTION_TYPES[self::FIELD_MODIFY] => $tableModifyElementAttrs, 'label' => [ + 'id' => $labelId, 'icon' => FormEngineUtility::getIconHtml(!empty($item['icon']) ? $item['icon'] : 'empty-empty'), 'title' => $item['label'], 'value' => $item['value'], @@ -201,10 +201,11 @@ $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($modifySelectElements[$restrictionType], true, true) . '>'; $tableRows[] = '</td>'; } - $modifyElementConfig = $modifySelectElements[self::RESTRICTION_TYPES[self::FIELD_MODIFY]]; $tableRows[] = '<td class="col-title">'; - $tableRows[] = '<span class="inline-icon">' . $modifySelectElements['label']['icon'] . '</span>'; - $tableRows[] = htmlspecialchars($this->appendValueToLabelInDebugMode($modifySelectElements['label']['title'], $modifySelectElements['label']['value']), ENT_COMPAT, 'UTF-8', false); + $tableRows[] = '<label class="label-block nowrap-disabled" id="' . $modifySelectElements['label']['id'] . '">'; + $tableRows[] = '<span class="inline-icon">' . $modifySelectElements['label']['icon'] . '</span>'; + $tableRows[] = htmlspecialchars($this->appendValueToLabelInDebugMode($modifySelectElements['label']['title'], $modifySelectElements['label']['value']), ENT_COMPAT, 'UTF-8', false); + $tableRows[] = '</label>'; $tableRows[] = '</td>'; $tableRows[] = '<td class="text-end">' . $modifySelectElements['help'] . '</td>'; $tableRows[] = '</tr>'; ```

    SelectCheckBoxTablePermissionsElement.php:204

    `$modifyElementConfig = $modifySelectElements[…];` can be removed.
  95. Marcin Sągol uploaded patch set 26 V +1 06/10/24, 17:46

  96. Marcin Sągol commented on patch set 25 06/10/24, 17:46

    SelectCheckBoxTablePermissionsElement.php:204 Reply

    Done
  97. core-ci voted on patch set 26 V +1 06/10/24, 17:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59063

  98. Ayke Halder commented on patch set 26 CR +1 V +1 06/10/24, 18:06

    All and everything really looks perfect now! Again, great job! 🎉 Everyone - please review.
  99. Michael Telgkamp commented on patch set 26 CR +1 V +1 06/10/24, 19:11

    Thank you for the patch and the good additional improvements!
  100. Michael Telgkamp commented on patch set 26 CR -1 06/11/24, 07:46

    I will adjust the title of the feature to make it more clear.
  101. Michael Telgkamp uploaded patch set 27 CR +1 V +1 06/11/24, 07:54

  102. Michael Telgkamp commented on patch set 27 CR +1 V +1 06/11/24, 07:55

    Only adjusted title of patch and inside rst
  103. Ayke Halder commented on patch set 27 CR -1 06/11/24, 08:00

    Reply

    Should the title not be more clear about the fact that this is an UI change only and does not change anything about the underlying implementation of the permission table? E.g. "[FEATURE] Change table restrictions UI to combine read and write permissions"
  104. Ayke Halder commented on patch set 27 CR +1 V +1 06/11/24, 08:09

    Reply

    Resolved: The title as-is is percieved as sufficient.
  105. core-ci voted on patch set 27 V +1 06/11/24, 08:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59125

  106. Andreas Kienast commented on patch set 27 06/11/24, 10:02

    I personally do not like that when I accidentally click "write" for the wrong table, I have to uncheck two checkboxes now. This feels cumbersome and that's nothing I'd expect.
  107. Georg Ringer commented on patch set 27 06/11/24, 20:01

    Reply

    I really like it but understand that there is now more to click to get rid of it. as suggestion: what about if the read is not disabled and if it is checked and it is clicked, it unchecks both checkboxes? so just like with write
  108. Ayke Halder commented on patch set 27 06/11/24, 21:32

    Reply

    @a.fernandez@scripting-base.de On the idea of clicking the "write" checkbox on accident, click again and then also revert the "read" checkbox state to the old state, please also have a look at these comments: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/comment/1a237347_20b5023a/ > [The checkboxes] should not be changed now. ---- @georg.ringer@gmail.com On the idea of clicking the disabled read checkbox to uncheck both checkboxes, please also have a look at these comments: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/comment/6a914294_68b55be2/ > I have discussed this with UI/UX team and from their perspective it is ok to have the first checkbox disabled. > [It has been] discussed [internaly] with UI/UX team, this is the how it will be for now. > We might introduce the suggested behaviour in the future by an extra patch like this: > https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/7..8
  109. Jasmina Ließmann rebased onto patch set 28 CR +1 V +1 06/12/24, 09:52

  110. Jasmina Ließmann commented on patch set 28 V -1 06/12/24, 09:56

    The multi record selection has been updated (please see https://review.typo3.org/c/Packages/TYPO3.CMS/+/84602). This patch uses the old implementation in 'selectCheckBoxTablePermissions' and needs to be adapted.
  111. Jasmina Ließmann commented on patch set 28 06/12/24, 09:59

    Reply

    I accidentally marked the answer as "solved". But it is unsolved.
  112. core-ci voted on patch set 28 V +1 06/12/24, 09:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59304

  113. Marcin Sągol commented on patch set 28 06/12/24, 10:09

    Reply

    I will take a look and update it.
  114. Marcin Sągol commented on patch set 28 06/12/24, 13:52

    Reply

    How should those checkboxes behave when the Toggle Selection option is clicked? We now have 3 possible states/combinations for Read and Write checkbox pair: 1. Checked + Disabled / Checked 2. Checked / Not Checked 3. Not Checked / Not Checked Now if we click the Toggle Selection option, we will have: 1. Not Checked / Not Checked 2. Checked + Disabled / Checked 3. Checked + Disabled / Checked Next Toggle Selection click and we will end up with: 1. Checked + Disabled / Checked 2. Not Checked / Not Checked 3. Not Checked / Not Checked And from now on if we do not change anything manually but click the Toggle Selection, the states will be toggled the same way as the logic forces that if the Write checkbox gets selected, the previous one also will be selected (and disabled). So for example for a current state: Checked / Not Checked we will never go back to it after first click on Toggle Selection. It will be: Checked / Not Checked -> Checked + Disabled / Checked -> Not Checked / Not Checked -> Checked + Disabled / Checked ...
  115. Marcin Sągol uploaded patch set 29 V +1 06/12/24, 14:30

  116. Rachel Foucard commented on patch set 28 06/12/24, 14:33

    Reply

    I don't think that a toggle option is relevant in this situation: It is possible to toggle something that has only 2 possible states not 3. even if we propose checkboxes in the UI, the reality is that we ask for 3 possible choices: - no permission - read only - write Even if a select box or a radio button would better fit for the logic, I prefer the checkboxes because they are easier to handle than the select box, and they use less space than 3 radio buttons. However, a toggle is not logical when we have 3 possible choices.
  117. core-ci voted on patch set 29 V -1 06/12/24, 14:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59338

  118. Michael Telgkamp commented on patch set 29 06/12/24, 14:37

    Reply

    I have added a new UI suggestion in http://forge.typo3.org/issues/103521#note-35. Having this we could have a new "toggle" selector with the options "No for all", "Read for all" and "Read & write for all".
  119. Ayke Halder commented on patch set 29 CR -1 06/12/24, 18:34

    If we implement multi-record-select like it is now, all the checkboxes belong to one group. That is not how we need it. E.g. multi-select via * "click" on first "read"-checkbox * then `[Shift]` + "click" on another "read"-checkbox further down This results in also selecting the "write"-checkboxes. But it should only select the "read"-checkboxes. ---- As we have two groups of checkboxes - `select` and `modify` - we need to introduce two groups and add each checkbox to the correct group. Then also add two "toggle-all"-action-checkboxes to the header. TODO: unchecking all "read"-checkboxes via "toggle-all" does not uncheck the "write"-checkboxes. Now there is need for a 2-way-coupling of the checkboxes. ``` diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php --- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php (revision c9dc8981d07e377674ff4d4b18390eaf3486f15a) +++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxTablePermissionsElement.php (date 1718216256912) @@ -178,7 +178,7 @@ $hasGroupHeader = is_array($group['header'] ?? false); - $html[] = '<div id="' . $groupId . '" class="panel panel-default" data-multi-record-selection-identifier="' . $groupId . '">'; + $html[] = '<div id="' . $groupId . '" class="panel panel-default">'; if ($hasGroupHeader) { $html[] = '<div class="panel-heading">'; $html[] = '<a data-bs-toggle="collapse" href="#' . $groupCollapsibleId . '" aria-expanded="false" aria-controls="' . $groupCollapsibleId . '">'; @@ -194,9 +194,9 @@ // with two keys: 'modify' and 'select' containing the configuration for the // table_modify and table_select HTML checkbox elements foreach ($group['items'] as $modifySelectElements) { - $tableRows[] = '<tr data-multi-record-selection-element="true">'; + $tableRows[] = '<tr>'; foreach (self::RESTRICTION_TYPES as $restrictionType) { - $tableRows[] = '<td class="col-checkbox">'; + $tableRows[] = '<td class="col-checkbox" data-multi-record-selection-identifier="' . $groupId . '-' . $restrictionType . '" data-multi-record-selection-element="true">'; $tableRows[] = '<span class="form-check form-check-type-toggle">'; $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($modifySelectElements[$restrictionType], true, true) . '>'; $tableRows[] = '</span>'; @@ -226,13 +226,15 @@ // Add table header with actions, in case the element is not readOnly $html[] = '<thead>'; $html[] = '<tr role="none">'; - $html[] = '<th class="col-checkbox" colspan="2">' . $this->getRecordSelectionCheckActions() . '</th>'; - $html[] = '<th class="col-title" colspan="2">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.th.name')) . '</th>'; + foreach (self::RESTRICTION_TYPES as $restrictionType) { + $html[] = '<th class="col-checkbox" data-multi-record-selection-identifier="' . $groupId . '-' . $restrictionType . '">' . $this->getRecordSelectionCheckActions() . '</th>'; + } + $html[] = '<th colspan="2"></th>'; $html[] = '</tr>'; $html[] = '<tr>'; $html[] = '<th id="' . $readColumnId . '">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups.tables.read')) . '</th>'; $html[] = '<th id="' . $writeColumnId . '">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups.tables.write')) . '</th>'; - $html[] = '<th></th>'; + $html[] = '<th class="col-title">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.th.name')) . '</th>'; $html[] = '<th></th>'; $html[] = '</tr>'; $html[] = '</thead>'; ```
  120. Michael Telgkamp commented on patch set 29 06/12/24, 19:08

    We had a longer discussion on how we could implement the behavior with checkboxes in a way that allows users to use it in a good way. I want to present a new idea adding onto the previous ideas: No checkbox should be disabled. Here are the options available - nothing selected - read is clicked, result: read is selected - write is clicked, result: both are selected - read is selected - read is clicked, result: nothing selected - write is clicked, result: both are selected - read and write are selected - read is clicked, result: nothing selected - write is clicked, result: read is selected In this way every state change is possible with one click.
  121. Ayke Halder commented on patch set 29 06/12/24, 19:20

    Reply

    Sounds perfect! So we just need to: * Remove all code which un-/sets the `disabled`-attribute. * Make it 2-way-coupling: click on already checked "read" -> unchecks "read" and must also uncheck "write".
  122. Marcin Sągol uploaded patch set 30 CR -1 V -1 06/13/24, 08:22

  123. core-ci voted on patch set 30 V -1 06/13/24, 08:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59425

  124. Marcin Sągol uploaded patch set 31 V -1 06/13/24, 08:40

  125. core-ci voted on patch set 31 V +1 06/13/24, 08:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59428

  126. Michael Telgkamp commented on patch set 31 CR -1 V -1 06/13/24, 09:18

    I get `Cannot read properties of undefined` errors when using the checkboxes and the combined toggeling does not work in Chrome based browsers.

    select-check-box-table-permissions-element.ts:57

    `explicitOriginalTarget` is non standard and only available in Firefox according to https://developer.mozilla.org/en-US/docs/Web/API/Event/explicitOriginalTarget Please use the `target` or `currentTarget` property.
  127. Michael Telgkamp commented on patch set 31 06/13/24, 09:54

    To ensure accessibility there needs to be a live region that announces the additional (unexpected) changes done by JS. So actually when selecting a write field with an unselected read field it needs to be announced "Read and write field checked". The other announcement would be when both are selected and read is toggled, the announcement would be "Read and write field not checked". More information on live regions: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions If further information is needed feel free to get in contact with me.
  128. Ayke Halder commented on patch set 31 06/13/24, 10:01

    select-check-box-table-permissions-element.ts:45

    May we just add _one_ event-listener in total for all the checkboxes. Right now there is one event-listener for each checkbox registered, resulting in many event listeners. See docs on "Bind to multiple elements" https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Events/JavaScript/Index.html#bind-to-multiple-elements E.g. look into `multi-record-selection.ts`: ```ts private registerDispatchCheckboxStateChangedEvent(): void { new RegularEvent('change', (e: Event, target: HTMLInputElement): void => { target.dispatchEvent(new CustomEvent('multiRecordSelection:checkbox:state:changed',{ detail: { identifier: MultiRecordSelection.getIdentifier(target) }, bubbles: true, cancelable: false })); }).delegateTo(document, MultiRecordSelectionSelectors.checkboxSelector); } ``` So maybe here we might add the event-listener somehow to `this.table` - untested pseudo-code: ```ts import RegularEvent from '@typo3/core/event/regular-event'; new RegularEvent('multiRecordSelection:checkbox:state:changed', (e: CustomEvent): void => { this.handleSingleItemChange(e as CustomEvent & { explicitOriginalTarget?: any }); }).delegateTo(this.table, Identifier.singleItem); ```

    SelectCheckBoxTablePermissionsElement.php:133

    In this block we set field-change-attributes for both "modify" and "select". Setting the "checked" and "disabled" attributes for "modify" and "select" is split up. May we combine them in one place? Maybe like this: ``` if ($checkedForModify) { $tableModifyElementAttrs['checked'] = 'checked'; } if ($checkedForSelect) { $tableSelectElementAttrs['checked'] = 'checked'; } if ($readOnly) { $tableModifyElementAttrs['disabled'] = 'disabled'; $tableSelectElementAttrs['disabled'] = 'disabled'; } ```

    SelectCheckBoxTablePermissionsElement.php:227

    This one header-row with the checkbox-toggle-menus must not be shown in `$readOnly` state.
  129. Marcin Sągol uploaded patch set 32 CR -1 V +1 06/13/24, 11:43

  130. Marcin Sągol commented on patch set 31 06/13/24, 11:43

    Reply

    Fixed.

    select-check-box-table-permissions-element.ts:45 Reply

    Done

    select-check-box-table-permissions-element.ts:57 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:133 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:227 Reply

    Done
  131. Marcin Sągol commented on patch set 32 06/13/24, 11:44

    Reply

    @michael.telgkamp@mindscreen.de is the current implementation with 2 checkboxes ok for you?

    Reply

    Done
  132. core-ci voted on patch set 32 V -1 06/13/24, 11:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59472

  133. Marcin Sągol uploaded patch set 33 V -1 06/13/24, 11:52

  134. core-ci voted on patch set 33 V +1 06/13/24, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59475

  135. Marcin Sągol uploaded patch set 34 V +1 06/13/24, 12:05

  136. Jasmina Ließmann wrote 06/13/24, 12:06

    Removed reviewer Jasmina Ließmann.
  137. Marcin Sągol commented on patch set 34 06/13/24, 12:07

    Reply

    Done

    Reply

    Done
  138. core-ci voted on patch set 34 V +1 06/13/24, 12:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59477

  139. Ayke Halder commented on patch set 34 06/13/24, 12:22

    SelectCheckBoxTablePermissionsElement.php:219

    This `<thead>` must always be there - please move it up and outside `if (!$readonly) {…}`
  140. Marcin Sągol uploaded patch set 35 V +1 06/13/24, 12:30

  141. Marcin Sągol commented on patch set 34 06/13/24, 12:30

    SelectCheckBoxTablePermissionsElement.php:219 Reply

    Done
  142. core-ci voted on patch set 35 V +1 06/13/24, 12:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59480

  143. Michael Telgkamp commented on patch set 35 CR +1 V +1 06/14/24, 08:24

    Reply

    Done

    Reply

  144. Georg Ringer voted on patch set 35 CR +1 V +1 06/14/24, 08:26

  145. Oli Bartsch commented on patch set 35 CR -2 06/17/24, 08:43

    select-check-box-table-permissions-element.ts:24

    This should be a webcomponent

    SelectCheckBoxTablePermissionsElement.php:30

    Form elements should not extend other form elements but always extend from AbstractFormElement.

    SelectCheckBoxTablePermissionsElement.php:62

    We might want to add a dedicated DataProvider instead of using two different sources for the current data.

    SelectCheckBoxTablePermissionsElement.php:123

    This currently does not prevent the checkbox from being changed. However, could also be a bug in multi record selection.

    SelectCheckBoxTablePermissionsElement.php:286

    Any reason for using a private static function instead of "just" a protected one?

    be_groups.php:134

    Actually we are about to replace renderType's with dedicated TCA types. Adding another renderType, which additionally is utilizing two different TCA columns does not comply with this strategy.

    be_groups.php:144

    `passthrough` is no valid renderType for TCA type select. "passthrough" should be used as TCA type.
  146. Oli Bartsch commented on patch set 35 06/17/24, 08:56

    the
    behaviour
    ` missing
    Let's use ` here as well
    it if wasn't before
    Let's use ` here as well
    form the first columns `tables_select`, both will be unchecked.

    SelectCheckBoxTablePermissionsElement.php:288

    Also not sure whether this might lead to problems in case $subject somehow contains self::FIELD_MODIFY multiple times.
  147. Marcin Sągol updated the commit message in patch set 36 CR +1 V +1 06/17/24, 13:58

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  148. Marcin Sągol commented on patch set 35 06/17/24, 13:58

    Reply

    Done

    Reply

    Done

    Reply

    Done

    Reply

    Done

    Reply

    Done

    Reply

    Done

    Reply

    Done
  149. Marcin Sągol updated the commit message in patch set 37 06/17/24, 13:59

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  150. core-ci voted on patch set 36 V +1 06/17/24, 14:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59732

  151. core-ci voted on patch set 37 V +1 06/17/24, 14:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59733

  152. Marcin Sągol commented on patch set 37 06/17/24, 14:13

    SelectCheckBoxTablePermissionsElement.php:62 Reply

    What kind of data provider? At this stage we have access to the `$this->data['databaseRow']` which contains whole `be_grops` record data.

    SelectCheckBoxTablePermissionsElement.php:123 Reply

    When i have tested it, if the checkbox was disabled but we clicked outside it, indeed it was changed - but all of them bahave the same (from other elements). I asked about it on slack, but had no response if it is bug (I think it is). Yet if we post the changes, the data won't change even if you was able to check/uncheck disabled checkbox.

    SelectCheckBoxTablePermissionsElement.php:286 Reply

    It was suggested by reviewer here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/comment/c94e9a5e_a43db83b/ I can make it just protected or even private as this class won't be extended.

    SelectCheckBoxTablePermissionsElement.php:288 Reply

    It could if you will use this function

    be_groups.php:134 Reply

    What approach do you suggest here?

    be_groups.php:144 Reply

    Right, so if we set type to `passthrough` then resoved data type in the `$this->data['databaseRow']` will be different for the `tables_modify` (an array) and `tables_select` (string). Across the T3 code the `tables_select` is just use to check permissions through `$backendUser->check('tables_select', $this->table)` so this shouldn't break anything, but still there be some inconsistency of data type as I have mentioned. Should the be some different approach for this?
  153. Ayke Halder commented on patch set 37 06/17/24, 16:03

    SelectCheckBoxTablePermissionsElement.php:30 Reply

    Can we then declare this class as `final`? And maybe use `private` over `protected` on any property or function that is not `public` here?

    SelectCheckBoxTablePermissionsElement.php:123 Reply

    This is a bug in `data-multi-record-selection` as it became the new UI for `SelectCheckBoxElement`. See https://forge.typo3.org/issues/104133

    SelectCheckBoxTablePermissionsElement.php:286 Reply

    This is just a helper-function to not repeat the identical `str_replace()` - which is also `static` - multiple times. It is `private` so it still can be totally changed with no further notice in the future. So it should never be used in context of another class or anywhere else. It is `static` as it does not change the state of the object.

    SelectCheckBoxTablePermissionsElement.php:288 Reply

    If `$subject` contains `self::FIELD_MODIFY` multiple times, this function does indeed replace `self::FIELD_MODIFY` multiple times. And that is what we like the function to do. E.g. some pseudo `id`-attribute like `formengine-select-checkbox-<UID>-group-table_modify-item-6-table_modify` should become `formengine-select-checkbox-<UID>-group-table_select-item-6-table_select` As this function is `private` it will only be used in context of this class and nowhere else. So I think this would not lead to problems.
  154. Marcin Sągol uploaded patch set 38 V +1 06/17/24, 16:25

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  155. Marcin Sągol commented on patch set 37 06/17/24, 16:26

    SelectCheckBoxTablePermissionsElement.php:30 Reply

    I can make it final, but i can't/don't want to make all the properties private as i would have to change definition in the `AbstractNode` wchich will require chnages in all form elements. I do not want to do this in this patch. Lets follow current definitions in this patch and after merge there can be separate task to modify defionitions in the abstract classess and implementations.
  156. core-ci voted on patch set 38 V -1 06/17/24, 16:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59748

  157. Marcin Sągol uploaded patch set 39 V -1 06/17/24, 16:40

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  158. core-ci voted on patch set 39 V +1 06/17/24, 16:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59749

  159. Marcin Sągol commented on patch set 39 06/17/24, 17:06

    select-check-box-table-permissions-element.ts:24 Reply

    So you would like to have here whole element rendering? Is yes, can we postpone this as a next step and have it merged as it is now (this task is part of community budget for Q2 and we are reaching end date and this task is taking changes since several days already - i want to avoid situation when we won't be able to finish it on time due to constant changes after reviews).
  160. Georg Ringer voted on patch set 39 CR +1 V +1 06/17/24, 19:41

  161. Ayke Halder commented on patch set 39 CR +1 V +1 06/19/24, 07:22

    Looks good and works perfectly!
  162. Oli Bartsch commented on patch set 39 CR -2 06/21/24, 15:21

    select-check-box-table-permissions-element.ts:24 Reply

    It's more about best practice for the JS part of new from engine elements. Making a web component shouldn't be to time consuimg. have a look at related patch for select-check-box: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84749

    SelectCheckBoxElement.php:67

    Please do not change this as it's unrelated to the patch.

    SelectCheckBoxTablePermissionsElement.php:57

    I think we don't need any wizard here, especially no localization related wizards since be_groups is not translateable.

    SelectCheckBoxTablePermissionsElement.php:62 Reply

    A FormEngine DataProvider, see e.g. https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/FormEngine/DataCompiling/Index.html#data-groups-and-providers. However, we would also resolve this easily by having just one field with the corresponding configuration.

    SelectCheckBoxTablePermissionsElement.php:111

    Please stick to either the "select" / "modify" or to the "read" / "write" naming consistently.

    SelectCheckBoxTablePermissionsElement.php:116

    The whole group header functionality can be omitted for this specific element. Thats also the reason, why I suggest to have a dedicated TCA type. We would not need the itemsProcFunc in the TCA but could call corresponding logic in a DataProvider or directly in the element here.

    SelectCheckBoxTablePermissionsElement.php:123 Reply

    This has been fixed.

    SelectCheckBoxTablePermissionsElement.php:135

    IMO also not relevant for this element

    SelectCheckBoxTablePermissionsElement.php:170

    I suggest to drop this "feature" for this element.

    be_groups.php:140

    We might want to remove this from showitem.

    be_groups.php:144 Reply

    Actually what we IMO should do is to combine those fields (e.g. `table_permissions`) and store the configuration as JSON in the database. We can then either have a new TCA type or use type=user with corresponding renderType just for this new single field. Manually combining those fields in the new FormEngine Element by setting one of the fields to the invalid "passthrough" renderType seems to be just an intermediate solution.

    Feature-103521-CombineReadAndWritePermissionsForTableRestrictions.rst:16

    Are there cases when they do not list the same items?

    Feature-103521-CombineReadAndWritePermissionsForTableRestrictions.rst:23

    Actually this is just done visually.
  163. Oli Bartsch commented on patch set 39 06/22/24, 07:32

    be_groups.php:134 Reply

    I suggest to combine the fields and introduce one new Element (either as dedicated TCA type or as a renderType of TCA type user).
  164. Marcin Sągol commented on patch set 39 06/25/24, 08:00

    be_groups.php:134 Reply

    @bo@cedev.de by `combine` you mean change how the permissions are stored and processed in TYPO3? So not 2 separate fields but a single one that stores information about tables read/write permissions?
  165. Oli Bartsch commented on patch set 39 06/25/24, 08:17

    be_groups.php:134 Reply

    Yes exactly. That would IMO be the best solution, since it's actually what you want to achieve in the end. Having those fields combined. Visually and also data-wise.
  166. Ayke Halder commented on patch set 39 06/25/24, 09:24

    be_groups.php:134 Reply

    I think combining these two fields in the database is a very big change. TYPO3 handles permissions since the beginning by using two fields.

    be_groups.php:144 Reply

    If this data is combined as JSON in one db-field. How will TYPO3s data-model use this new permission data-structure? Does this new permission data-structure get mapped to `tables_select`/`tables_modify` so that these permission checks are handled like before? `$this->getBackendUserAuthentication()->check('tables_select', 'pages')`

    Feature-103521-CombineReadAndWritePermissionsForTableRestrictions.rst:23 Reply

    Also bringing up this old one again - which was already decided on a sprint: Should the title not be more clear about the fact that this is an UI change only and does not change anything about the underlying implementation of the permission table As-is: [FEATURE] Combine read and write permissions for table restrictions Suggestion: [FEATURE] Change table restrictions UI to combine read and write permissions Also see https://review.typo3.org/c/Packages/TYPO3.CMS/+/83743/comments/6a7c0354_d15f58d6
  167. Oli Bartsch commented on patch set 39 06/25/24, 10:46

    be_groups.php:134 Reply

    Yes sure. Nevertheless, I think the benefits are totally worth the effort.

    be_groups.php:144 Reply

    Yes, this is something which needs to be defined. I've not done any conceptual work on this topic yet. However, API functionality like `$this->getBackendUserAuthentication()->check('tables_select', 'pages')` needs to be preserved for sure.

    Feature-103521-CombineReadAndWritePermissionsForTableRestrictions.rst:23 Reply

    Sure, if this is the intention of the patch, this should be changed as you suggested. Anyways, I still tend to block this patch until my remarks regarding invalid renderType usages, JS component etc. are resolved. Because even if we only make visual changes - not migrating the fields to - this should be done on a basis, which will allow as to do so afterwards.
  168. Marcin Sągol uploaded patch set 40 CR +1 V +1 06/25/24, 11:06

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  169. core-ci voted on patch set 40 V +1 06/25/24, 11:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60283

  170. Marcin Sągol uploaded patch set 41 V +1 06/25/24, 12:23

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  171. Marcin Sągol commented on patch set 40 06/25/24, 12:23

    SelectCheckBoxElement.php:67 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:57 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:111 Reply

    I will use "select" / "modify" name sin the code as they will align with the real DB column names. The only usage of "Read" and "Write" will be for column titles.

    SelectCheckBoxTablePermissionsElement.php:116 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:135 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:170 Reply

    Done

    Feature-103521-CombineReadAndWritePermissionsForTableRestrictions.rst:16 Reply

    Not that i know of. Removin it.

    Feature-103521-CombineReadAndWritePermissionsForTableRestrictions.rst:23 Reply

    Updated/fixed.
  172. core-ci voted on patch set 41 V -1 06/25/24, 12:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60292

  173. Marcin Sągol uploaded patch set 42 V -1 06/26/24, 09:02

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  174. Marcin Sągol commented on patch set 42 06/26/24, 09:05

    SelectCheckBoxTablePermissionsElement.php:62 Reply

    Done

    be_groups.php:134 Reply

    For now as suggested, we have a new data provider for this field, which combines the select and modify pemrissions.
  175. core-ci voted on patch set 42 V -1 06/26/24, 09:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60362

  176. Marcin Sągol uploaded patch set 43 V -1 06/26/24, 09:10

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  177. core-ci voted on patch set 43 V -1 06/26/24, 09:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60363

  178. Ayke Halder commented on patch set 43 06/26/24, 09:17

    TablePermissionsElement.php:71

    Maybe rename `$selectItmes` to `$permissionItems` or something else. ``` $fieldConfig['config']['items'] = $this->getAvailableTables(); ```
  179. Ayke Halder commented on patch set 43 06/26/24, 09:32

    be_groups.php:142

    Do we still need to call this itemsProcFunc here?
  180. Marcin Sągol uploaded patch set 44 V -1 06/26/24, 09:33

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  181. Marcin Sągol commented on patch set 44 06/26/24, 09:38

    TablePermissionsElement.php:71 Reply

    Could be renamed, indeed. Since items stores/provides just database table names, maybe just use related name like `tables` || `dbTableNames` || `tableNames`?

    be_groups.php:142 Reply

    The reason I have left it, is that maybe someone can have some custom code where this is needed, and since with this patch we do not remove the filed, i think keeping it unchanged will be the best solution (until we move for a single filed to handle tables permissions).

    be_groups.php:144 Reply

    For this task, can we agree that we do not use the `passthrough` as `renderType` and keep the filed configuation unchanged, but we remove it from the showitems?
  182. core-ci voted on patch set 44 V -1 06/26/24, 09:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60365

  183. Ayke Halder commented on patch set 44 06/26/24, 09:55

    TcaTablePermissions.php:45

    This could be reduced to: ``` private function combineTablesPermissions(array $databaseRow, string $fieldName, string $selectField): array { return [ 'modify' => array_values(array_unique($this->processDatabaseFieldValue($databaseRow, $fieldName))), 'select' => array_values(array_unique($this->processDatabaseFieldValue($databaseRow, $selectField))), ]; } ```
  184. Marcin Sągol uploaded patch set 45 V -1 06/26/24, 09:57

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  185. core-ci voted on patch set 45 V +1 06/26/24, 10:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60366

  186. Marcin Sągol uploaded patch set 46 V +1 06/26/24, 10:12

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  187. Marcin Sągol commented on patch set 45 06/26/24, 10:12

    TablePermissionsElement.php:71 Reply

    Done

    TcaTablePermissions.php:45 Reply

    Done
  188. Marcin Sągol commented on patch set 46 06/26/24, 10:13

    be_groups.php:140 Reply

    Done
  189. core-ci voted on patch set 46 V +1 06/26/24, 10:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60367

  190. Marcin Sągol uploaded patch set 47 V +1 06/26/24, 10:35

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  191. Marcin Sągol commented on patch set 46 06/26/24, 10:36

    select-check-box-table-permissions-element.ts:24 Reply

    Done
  192. core-ci voted on patch set 47 V -1 06/26/24, 10:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60370

  193. Marcin Sągol uploaded patch set 48 V -1 06/26/24, 10:43

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  194. core-ci voted on patch set 48 V -1 06/26/24, 10:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60372

  195. Marcin Sągol uploaded patch set 49 V -1 06/26/24, 11:00

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  196. core-ci voted on patch set 49 V -1 06/26/24, 11:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60373

  197. Marcin Sągol uploaded patch set 50 V -1 06/26/24, 11:43

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  198. Marcin Sągol uploaded patch set 51 06/26/24, 11:46

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  199. core-ci voted on patch set 50 V -1 06/26/24, 11:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60379

  200. core-ci voted on patch set 51 V -1 06/26/24, 11:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60380

  201. Marcin Sągol rebased onto patch set 52 V -1 06/26/24, 12:24

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  202. Marcin Sągol uploaded patch set 53 06/26/24, 12:26

    Copied Votes: * Code-Review-2 (copy condition: "**changekind:NO_CHANGE** OR **is:MIN**")
  203. core-ci voted on patch set 52 V +1 06/26/24, 12:31 Copied votes on follow-up patch sets have been updated: * Verified+1 has been copied to patch set 53 (copy condition: "changekind:NO_CHANGE"). Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60384

  204. core-ci voted on patch set 53 V +1 06/26/24, 12:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60385

  205. Oli Bartsch uploaded patch set 54 V +1 06/27/24, 10:12

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  206. Oli Bartsch uploaded patch set 55 06/27/24, 10:14

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  207. core-ci voted on patch set 54 V -1 06/27/24, 10:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60444

  208. core-ci voted on patch set 55 V -1 06/27/24, 10:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60445

  209. Oli Bartsch uploaded patch set 56 V -1 06/27/24, 10:32

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  210. core-ci voted on patch set 56 V +1 06/27/24, 10:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60448

  211. Oli Bartsch uploaded patch set 57 V +1 06/27/24, 11:06

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  212. core-ci voted on patch set 57 V -1 06/27/24, 11:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60450

  213. Oli Bartsch uploaded patch set 58 V -1 06/27/24, 11:21

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  214. core-ci voted on patch set 58 V +1 06/27/24, 11:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60452

  215. Oli Bartsch commented on patch set 57 CR -2 06/27/24, 11:28

    Hi Marcin, I just updated the patch. Should be fine now from my side. Could you please update the RST and the commit message? Additionally, please also add some tests for the new Element and the new DataProvider. You can have a look at e.g. those patches as reference: * https://review.typo3.org/c/Packages/TYPO3.CMS/+/77798 * https://review.typo3.org/c/Packages/TYPO3.CMS/+/76891

    SelectCheckBoxTablePermissionsElement.php:286 Reply

    Done

    SelectCheckBoxTablePermissionsElement.php:288 Reply

    Done

    be_groups.php:142 Reply

    IMO this is no public API. For consistency, we should drop it all together.

    be_groups.php:144 Reply

    Just removing the field from showitem isn't sufficient. We need to use `passthrough` to also hide the column e.g. from the "Show Columns" selection etc.
  216. Ayke Halder commented on patch set 58 CR -1 06/27/24, 12:25

    BackendUtility.php:1717

    We must not remove elements from the view that are in the database. Especially if they should not be in the database in the first place, they must stay visible here to be recognizable.

    DataHandler.php:2407

    If this is not an array the field-value is invalid, isn't it? Then we should drop it.

    DataHandler.php:2408

    Here we must ensure that all the table-names are allowed to be stored in the db-record. Implement the filter function for "allowed table names" which currently is implemented in `BackendUtility:: getProcessedValue`.

    FormatTableSelectPermissions.php:34

    Same here as for `DataHandler::checkvalueForTablePermission`: * If this is not an array the field-value is invalid, isn't it? Then we should drop it. * Here we must ensure that all the table-names are allowed to be stored in the db-record. Implement the filter function for "allowed table names" which currently is implemented in BackendUtility.
  217. Marcin Sągol uploaded patch set 59 CR -1 V +1 06/27/24, 12:53

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  218. Ayke Halder voted on patch set 59 CR -1 06/27/24, 12:55

  219. core-ci voted on patch set 59 V -1 06/27/24, 12:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60457

  220. Marcin Sągol uploaded patch set 60 CR -1 V -1 06/27/24, 13:20

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  221. core-ci voted on patch set 60 V +1 06/27/24, 13:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60460

  222. Ayke Halder commented on patch set 60 CR -1 06/27/24, 13:34

    Filtering of "allowed table names" should be implemented - see unresolved comments.
  223. Oli Bartsch commented on patch set 60 CR -2 06/27/24, 14:16

    DataHandler.php:2407 Reply

    Might be an empty string when all tables are unselect or for new records, not having any table selected.
  224. Marcin Sągol uploaded patch set 61 CR -1 V +1 06/27/24, 15:10

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  225. Marcin Sągol commented on patch set 60 06/27/24, 15:11

    Reply

    Please check if not it is ok.
  226. core-ci voted on patch set 61 V -1 06/27/24, 15:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60472

  227. Marcin Sągol uploaded patch set 62 V -1 06/27/24, 15:28

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  228. Marcin Sągol updated the commit message in patch set 63 06/27/24, 15:31

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  229. core-ci voted on patch set 62 V +1 06/27/24, 15:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60474

  230. core-ci voted on patch set 63 V +1 06/27/24, 15:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60475

  231. Marcin Sągol uploaded patch set 64 V +1 06/27/24, 15:39

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  232. Marcin Sągol commented on patch set 64 06/27/24, 15:40

    BackendUtility.php:1717 Reply

    @bo@cedev.de do you agree on this?
  233. core-ci voted on patch set 64 V +1 06/27/24, 15:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60477

  234. Ayke Halder commented on patch set 64 CR -1 06/27/24, 17:42

    Still about BackendUtility: We must not hide any value that is already stored in the db - they must all be visible in the backend. And wrong values coming from the backend-form (e.g. an arbitrary manipulated string) must be removed by DataHandler and must not be stored in db.

    DataHandler.php:2407 Reply

    Then we can just return an empty string for any non-array value: ``` public function checkValueForTablePermission(string|array $value): array { if (!is_array($value)) { return ['value' => '']; } // Filter array for allowed table-names and implode it around a comma: $value = array_filter($value, static function ($tableName) { return isset($GLOBALS['TCA'][$tableName]) && !($GLOBALS['TCA'][$tableName]['ctrl']['adminOnly'] ?? false); }); $value = implode(',', $value); return ['value' => $value]; } ```

    DataHandler.php:2408 Reply

    Done

    FormatTableSelectPermissions.php:34 Reply

    We might declare `DataHandler::checkvalueForTablePermission` as public and re-use it here: ``` public function processDatamap_preProcessFieldArray(&$incomingFieldArray, $table, $id, DataHandler $dataHandler) { if ($table !== 'be_groups' || !isset($incomingFieldArray['tables_select'])) { return; } $incomingFieldArray['tables_select'] = $dataHandler->checkValueForTablePermission($incomingFieldArray['tables_select'])['value'] ?? ''; } ```

    be_groups.php:142 Reply

    Done
  235. Ayke Halder commented on patch set 64 06/27/24, 18:05

    Still about BackendUtility: We must not hide any value that is already stored in the db - they must all be visible in the backend. And wrong values coming from the backend-form (e.g. an arbitrary manipulated string) must be cleaned by DataHandler.

    DataHandler.php:2407 Reply

    We have to account for copying be_group-records: In that case `$value` is a non-empty string that contains comma-separated table-names from the original record. ``` public function checkValueForTablePermission(string|array $value): array { if (is_string($value)) { $value = GeneralUtility::trimExplode(',', $value, true); } // Filter array for allowed table-names and implode it around a comma: $value = array_filter($value, static function ($tableName) { return isset($GLOBALS['TCA'][$tableName]) && !($GLOBALS['TCA'][$tableName]['ctrl']['adminOnly'] ?? false); }); $value = implode(',', $value); return ['value' => $value]; } ```
  236. Marcin Sągol uploaded patch set 65 CR -1 V +1 06/27/24, 18:58

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  237. Marcin Sągol commented on patch set 65 06/27/24, 19:00

    Reply

    Is it ok now?

    DataHandler.php:2407 Reply

    Done, please check.
  238. Marcin Sągol updated the commit message in patch set 66 06/27/24, 19:01

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  239. core-ci voted on patch set 65 V +1 06/27/24, 19:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60484

  240. core-ci voted on patch set 66 V +1 06/27/24, 19:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60485

  241. Ayke Halder commented on patch set 66 CR -1 06/28/24, 05:28

    Reply

    Done

    Reply

    Done
    Please decide if we can re-use `DataHandler::checkvalueForTablePermission` in `Hooks/FormatTableSelectPermissions` Or copy-paste the newly implemented features from `DataHandler::checkvalueForTablePermission` into `Hooks/FormatTableSelectPermissions`.

    BackendUtility.php:1717 Reply

    Done

    DataHandler.php:2407 Reply

    Done

    FormatTableSelectPermissions.php:34 Reply

    Here we either call `DataHandler::checkvalueForTablePermission` or always copy-paste all the same features from `DataHandler::checkvalueForTablePermission`. Right now the string comma-explode is missing: ``` if (is_string($value)) { $value = GeneralUtility::trimExplode(',', $value, true); } ```
  242. Marcin Sągol uploaded patch set 67 CR -1 V +1 06/28/24, 09:34

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  243. Marcin Sągol commented on patch set 66 06/28/24, 09:36

    Reply

    For now i copied the code part. The function `DataHandler::checkvalueForTablePermission` is protected as other with similar role in the `DH` so lets keep it. The hook will be removed anyway when there will be only single field for storing the table permissions.

    FormatTableSelectPermissions.php:34 Reply

    Please check now.
  244. core-ci voted on patch set 67 V -1 06/28/24, 09:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60543

  245. Marcin Sągol uploaded patch set 68 V -1 06/28/24, 09:49

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  246. core-ci voted on patch set 68 V +1 06/28/24, 09:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60544

  247. Marcin Sągol commented on patch set 68 06/28/24, 09:57

    Reply

    I have added simple unit tests.
  248. Ayke Halder commented on patch set 68 06/28/24, 14:13

    Reply

    Looks good now!
    From my side the open unresolved issues are solved! Yesterday there was a merge of some TCA-feature: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75486 Maybe we need some more refactoring now.

    FormatTableSelectPermissions.php:34 Reply

    Done

    be_groups.php:144 Reply

    Some patchset introduced `passthrough` here - so this is solved.
  249. Oli Bartsch uploaded patch set 69 V +1 07/03/24, 09:16

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  250. core-ci voted on patch set 69 V +1 07/03/24, 09:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60897

  251. Ayke Halder commented on patch set 69 07/03/24, 18:53

    We should not change the db structure of `tables_select`.

    ext_tables.sql:28

    To keep this identical as before it must be: `tables_select longtext` Also no trailing commata needed here, as this is the last/only column.
  252. Oli Bartsch uploaded patch set 70 V +1 07/04/24, 10:08

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  253. core-ci voted on patch set 70 V +1 07/04/24, 10:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60959

  254. Oli Bartsch uploaded patch set 71 V +1 07/04/24, 10:21

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  255. Oli Bartsch commented on patch set 71 CR 0 07/04/24, 10:21

    Reply

    Acknowledged

    ext_tables.sql:28 Reply

    Done
  256. core-ci voted on patch set 71 V -1 07/04/24, 10:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60960

  257. Oli Bartsch uploaded patch set 72 V -1 07/04/24, 10:32

  258. core-ci voted on patch set 72 V +1 07/04/24, 10:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60961

  259. Oli Bartsch uploaded patch set 73 V +1 07/04/24, 11:44

  260. core-ci voted on patch set 73 V +1 07/04/24, 11:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60965

  261. Ayke Halder commented on patch set 73 CR -1 07/04/24, 15:20

    Maybe use enum instead of array.

    _table.scss:145

    Do not use a 'fixed' `min-width`. Languages other than english easily break this limit. Suggestion: remove `min-width` and do not wrap whitespaces instead: ```css .col-radiogroup { white-space: nowrap; } ```

    table-permission-element.ts:68

    Nice state-machine here - I really like this!

    TablePermissionElement.php:34

    How about the use of `enum`? An `array` does not fulfill checks for array-key-exists. Then instead of having this array we could go back to directly use strings (<-- I do not recommend this.) E.g. ```php // This runs but not as expected if ($permission === self::Permissions['none-with-typo']) {} $foo = '<input name="' . self::Permissions['none-with-typo'] . '">'; // vs // This will fail: if ($permission === Permission::noneWithTypo) {} $foo = '<input name="' . Permission::noneWithTypo->value . '">'; ``` ---- This should implement working enumeration: ```patch Index: typo3/sysext/backend/Classes/Form/Element/TablePermissionType.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/typo3/sysext/backend/Classes/Form/Element/TablePermissionType.php b/typo3/sysext/backend/Classes/Form/Element/TablePermissionType.php new file mode 100644 --- /dev/null (date 1720102679417) +++ b/typo3/sysext/backend/Classes/Form/Element/TablePermissionType.php (date 1720102679417) @@ -0,0 +1,10 @@ +<?php + +namespace TYPO3\CMS\Backend\Form\Element; + +enum TablePermissionType: string +{ + case none = 'none'; + case select = 'select'; + case modify = 'modify'; +} Index: typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php b/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php --- a/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php (revision 6038fdcaabb995d4dcf348b5d011d607e45687df) +++ b/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php (date 1720105198533) @@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\Form\Element; +use TYPO3\CMS\Backend\Form\Element\TablePermissionType as Permission; use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility; use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Imaging\IconSize; @@ -31,12 +32,6 @@ */ final class TablePermissionElement extends AbstractFormElement { - private const Permissions = [ - 'none' => 'none', - 'select' => 'select', - 'modify' => 'modify', - ]; - /** * Default field information enabled for this element. * @@ -59,11 +54,11 @@ $parameterArray = $this->data['parameterArray']; $config = $parameterArray['fieldConf']['config']; $elementFieldName = $parameterArray['itemFormElName']; - $currentValue = ['modify' => [], 'select' => []]; - if (is_array($parameterArray['itemFormElValue'] ?? null) - && array_key_exists('modify', $parameterArray['itemFormElValue']) - && array_key_exists('select', $parameterArray['itemFormElValue']) - ) { + $currentValue = [Permission::modify->value => [], Permission::select->value => []]; + if (isset( + $parameterArray['itemFormElValue'][Permission::modify->value], + $parameterArray['itemFormElValue'][Permission::select->value] + )) { $currentValue = $parameterArray['itemFormElValue']; } $readOnly = (bool)($config['readOnly'] ?? false); @@ -76,36 +71,38 @@ $tablesConfiguration = []; $lang = $this->getLanguageService(); - $itemArrayModify = array_flip($currentValue['modify']); - $itemArraySelect = array_flip($currentValue['select']); + $itemArrayModify = array_flip($currentValue[Permission::modify->value]); + $itemArraySelect = array_flip($currentValue[Permission::select->value]); $elementId = StringUtility::getUniqueId('formengine-table-permission-'); foreach ($availableTables as $table) { $permissions = []; - foreach (self::Permissions as $permission) { - $permissions[$permission] = [ - 'label' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups.tables_modify.permissions.' . $permission), + foreach (Permission::cases() as $permission) { + $permissions[$permission->value] = [ + 'label' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups.tables_modify.permissions.' . $permission->value), 'attributes' => [ 'type' => 'radio', 'class' => 'form-check-input t3js-table-permissions-item t3js-multi-record-selection-check', - 'value' => $permission, + 'value' => $permission->value, 'name' => $elementId . '[' . $table['value'] . ']', - 'id' => $elementId . '[' . $table['value'] . '][' . $permission . ']', + 'id' => $elementId . '[' . $table['value'] . '][' . $permission->value . ']', 'data-table' => $table['value'], ], ]; } if (isset($itemArrayModify[$table['value']])) { - $permissions[self::Permissions['modify']]['attributes']['checked'] = 'checked'; + $permissions[Permission::modify->value]['attributes']['checked'] = 'checked'; } elseif (isset($itemArraySelect[$table['value']])) { - $permissions[self::Permissions['select']]['attributes']['checked'] = 'checked'; + $permissions[Permission::select->value]['attributes']['checked'] = 'checked'; } else { - $permissions[self::Permissions['none']]['attributes']['checked'] = 'checked'; + $permissions[Permission::none->value]['attributes']['checked'] = 'checked'; } if ($readOnly) { - $permissions[self::Permissions['none']]['attributes']['disabled'] = $permissions[self::Permissions['select']]['attributes']['disabled'] = $permissions[self::Permissions['modify']]['attributes']['disabled'] = 'disabled'; + foreach (Permission::cases() as $permission) { + $permissions[$permission->value]['attributes']['disabled'] = 'disabled'; + } } $tablesConfiguration[] = [ @@ -130,8 +127,8 @@ $html[] = $fieldInformationHtml; if (!$readOnly) { - $html[] = '<input type="hidden" name="' . $modifyStateFieldName . '" value="' . implode(',', $currentValue['modify']) . '">'; - $html[] = '<input type="hidden" name="' . $selectStateFieldName . '" value="' . implode(',', $currentValue['select']) . '">'; + $html[] = '<input type="hidden" name="' . $modifyStateFieldName . '" value="' . implode(',', $currentValue[Permission::modify->value]) . '">'; + $html[] = '<input type="hidden" name="' . $selectStateFieldName . '" value="' . implode(',', $currentValue[Permission::select->value]) . '">'; } $html[] = '<div id="' . $elementId . '" class="panel panel-default">'; @@ -139,11 +136,11 @@ $tableRows = []; foreach ($tablesConfiguration as $tableConfiguration) { $tableRows[] = '<tr>'; - foreach ($tableConfiguration['permissions'] as $key => $permission) { + foreach ($tableConfiguration['permissions'] as $key => $permissionConf) { $tableRows[] = '<td class="col-radiogroup">'; $tableRows[] = '<div class="form-check form-check-inline" data-multi-record-selection-identifier="' . $elementId . '-' . $key . '" data-multi-record-selection-element="true">'; - $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($permission['attributes'], true, true) . '>'; - $tableRows[] = '<label class="form-check-label" for="' . $permission['attributes']['id'] . '">' . htmlspecialchars($permission['label']) . '</label>'; + $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($permissionConf['attributes'], true, true) . '>'; + $tableRows[] = '<label class="form-check-label" for="' . $permissionConf['attributes']['id'] . '">' . htmlspecialchars($permissionConf['label']) . '</label>'; $tableRows[] = '</div>'; $tableRows[] = '</td>'; } @@ -160,9 +157,9 @@ $html[] = '<table class="table table-transparent table-hover">'; $html[] = '<thead>'; $html[] = '<tr>'; - foreach (self::Permissions as $permission) { - $html[] = '<th data-multi-record-selection-identifier="' . $elementId . '-' . $permission . '">'; - $html[] = $this->getRecordSelectionCheckActions($permission === self::Permissions['none'] ? ['all'] : ['all', 'none', 'toggle'], $readOnly); + foreach (Permission::cases() as $permission) { + $html[] = '<th data-multi-record-selection-identifier="' . $elementId . '-' . $permission->value . '">'; + $html[] = $this->getRecordSelectionCheckActions($permission === Permission::none ? ['all'] : ['all', 'none', 'toggle'], $readOnly); $html[] = '</th>'; } $html[] = '<th class="col-title col-border-left">' . htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.th.name')) . '</th>'; ```
  262. Oli Bartsch uploaded patch set 74 CR -1 V +1 07/04/24, 15:54

  263. Oli Bartsch commented on patch set 74 07/04/24, 15:56

    Reply

    Actually I wanted to keep thne patch as simple as possible. Adding an enum (additional class) which is only used in this element seems a bit to much IMO.

    _table.scss:145 Reply

    Done

    table-permission-element.ts:68 Reply

    Acknowledged
  264. core-ci voted on patch set 74 V +1 07/04/24, 15:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60979

  265. Ayke Halder commented on patch set 74 CR -1 07/04/24, 16:06

    For A11y the 3 radio-buttons of a table row must become part of one radio-group.

    TablePermissionElement.php:141

    For A11y these 3 radio-buttons must become part of one radio-group. Maybe set `role="radiogroup" aria-labelledby="id-of-ctable-label"`to this table row. Then we must check if this works as expected or if we need to replicate the keyboard navigation in JS like it would natively work for this struct: ```html <fieldset> <legend>Which is the best color?</legend> <p> <input name="colorOption" type="radio" id="purple" /> <label for="purple">Purple</label> </p> <p> <input name="colorOption" type="radio" id="aubergine" /> <label for="aubergine">Aubergine</label> </p> <p> <input name="colorOption" type="radio" id="magenta" /> <label for="magenta">Magenta</label> </p> </fieldset> ``` Also see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role#keyboard_interactions
  266. Oli Bartsch uploaded patch set 75 CR -1 V +1 07/04/24, 16:16

  1. Oli Bartsch commented on patch set 74 07/04/24, 16:17

    Reply

    Done

    TablePermissionElement.php:141 Reply

    Done
  2. Ayke Halder commented on patch set 74 CR -1 07/04/24, 16:17

    Reply

    Maybe then just use some const instead: ```php private const PERMISSION_NONE = 'none'; private const PERMISSION_SELECT = 'select'; private const PERMISSION_MODIFY = 'modify'; private const PERMISSIONS = [ self::PERMISSION_NONE, self::PERMISSION_SELECT, self::PERMISSION_MODIFY ]; $itemArrayModify = array_flip($currentValue[self::PERMISSION_MODIFY]); foreach (self::PERMISSIONS as $permission) {} ```
  3. core-ci voted on patch set 75 V +1 07/04/24, 16:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60981

  4. Ayke Halder commented on patch set 75 CR -1 07/04/24, 16:49

    Please check TCA element dependencies - I'm not sure about them.

    TcaTablePermission.php:47

    Here is the other location where we might have used an enum for `select`/`modify`.

    DefaultConfiguration.php:678

    I'm not sure if the dependency here is in the right direction: Does `TcaInlineConfiguration::class` depend on `TcaTablePermission::class`? Or should this just be `TcaCategory::class` as before this patch?

    DefaultConfiguration.php:1014

    Same here - I'm not sure if the dependency here is in the right direction: Does `TcaInlineConfiguration::class` depend on `TcaTablePermission::class`? Or should this just be `TcaCategory::class` as before this patch?
  5. Ayke Halder commented on patch set 75 07/04/24, 16:54

    It is now possible to add arbitrary values into table `be_groups` field `tables_select` by manipulating the checkbox-value in the BE. There is no filtering of allowed table-names for the field `tables_select` anymore. Of course an admin account is needed to add arbitrary values, as other users do not have read/write permission for the table `be_groups`.
  6. Georg Ringer voted on patch set 75 CR +1 V +1 07/04/24, 20:57

  7. Oli Bartsch commented on patch set 75 07/04/24, 21:36

    Reply

    This is possible already and is possible for both `tables_modify` and `tables_select`. The reason is, DataHandler does not validate items from itemsProcFunc. This won't be changed with this patch as it's out of scope. We agreed on only do UI improvements - with necessary functional changed. Additionally, there is no point in adding invalid data to the DB as this won't have any implications.

    Reply

    They are correct. See given explanation on the other comment.

    TcaTablePermission.php:47 Reply

    Those are just array keys. I see no benefit in introducing enums just to replace those keys.

    DefaultConfiguration.php:678 Reply

    The data provider as all of the "TCA*" providers do not depend on each other. However wem once agreed when adding new providers to always use the provider before as dependency to keep the order comprehensible. Therefore, it's correct that `TcaInlineConfiguration` depends on `TcaTablePermission`, since it's the next provider after `TcaTablePermission`.

    DefaultConfiguration.php:1014 Reply

    Same reason as above.
  8. Oli Bartsch commented on patch set 75 07/04/24, 21:44

    Reply

    It might even be a bigger change in behaviour when sanitizing the tables. Please keep in mind that there might be situations when tables are gone temporarily, e.g. because an extension has been deactivated. Removing those tables from the DB might not be the desired behaviour and as mentioned we won't change such behaviour in this UX related patch.
  9. Christian Kuhn commented on patch set 75 CR -1 07/04/24, 23:12

    will review asap.
  10. Marcin Sągol voted on patch set 75 V +1 07/05/24, 09:23

  11. Ayke Halder commented on patch set 75 CR 0 07/05/24, 09:24

    Reply

    Thanks for looking into this: As you already mentioned the behaviour did not change with this patch. It was possible before this change to add arbitrary values to `tables_select` and `tables_modify`. For the situation where 'tables are gone temporarily': In that case if you edit a `be_group` record, the tables that are gone are also removed from the record. But also no change here, as this is behaving like before this change.

    TablePermissionElement.php:63

    This condition could be simplified to: ```php if (isset( $parameterArray['itemFormElValue']['modify'], $parameterArray['itemFormElValue']['select'] )) {} ```

    TablePermissionElement.php:108

    Maybe also use a loop here: ```php foreach (self::Permissions as $permission) { $permissions[$permission]['attributes']['disabled'] = 'disabled'; } ```
  12. Ayke Halder commented on patch set 75 07/05/24, 13:27

    UI: big radio buttons with no label See https://typo3.slack.com/archives/C027S88NY/p1720185843029429?thread_ts=1720101232.399569&cid=C027S88NY This patch changes the look of the radio buttons and removes the label. There is still need to re-add a table-header with the labels. ```patch Index: Build/Sources/Sass/component/_table.scss IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/Build/Sources/Sass/component/_table.scss b/Build/Sources/Sass/component/_table.scss --- a/Build/Sources/Sass/component/_table.scss (revision 3ac0543b639b200bdb5456bc5e16e6bdbfa072c0) +++ b/Build/Sources/Sass/component/_table.scss (date 1720184190184) @@ -62,6 +62,7 @@ .col-icon, .col-checkbox, + .col-radio, .col-avatar { padding-inline-end: 0; } @@ -76,6 +77,7 @@ } .col-checkbox, + .col-radio, .col-icon { width: 16px; min-width: 16px; Index: Build/Sources/Sass/component/_checkbox.scss IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/Build/Sources/Sass/component/_checkbox.scss b/Build/Sources/Sass/component/_checkbox.scss --- a/Build/Sources/Sass/component/_checkbox.scss (revision 3ac0543b639b200bdb5456bc5e16e6bdbfa072c0) +++ b/Build/Sources/Sass/component/_checkbox.scss (date 1720185257013) @@ -229,6 +229,43 @@ } } +// +// Radio +// A radio button. +// +// Markup: +// <div class="form-check form-check-type-radio"> +// <input +// type="radio" +// class="form-check-input" +// value="1" +// id="radio-button" +// > +// </div> +// +// Styleguide component.checkbox.4 +// +$form-radio-checked-color: $component-active-color !default; + +.form-check.form-check-type-radio { + display: inline-block; + padding-inline-start: 0; + margin: 0; + gap: .5em; + + .form-check-input[type="radio"] { + margin: 0; + margin-top: 1px; + float: none; + width: calc(16 / 12 * 1em); + height: calc(16 / 12 * 1em); + + &:active { + filter: brightness(100%); + } + } +} + // // Utility // Index: typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php b/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php --- a/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php (revision 3ac0543b639b200bdb5456bc5e16e6bdbfa072c0) +++ b/typo3/sysext/backend/Classes/Form/Element/TablePermissionElement.php (date 1720185528289) @@ -84,8 +84,8 @@ $permissions = []; foreach (self::Permissions as $permission) { $permissions[$permission] = [ - 'label' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups.tables_modify.permissions.' . $permission), 'attributes' => [ + 'aria-label' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups.tables_modify.permissions.' . $permission), 'type' => 'radio', 'class' => 'form-check-input t3js-table-permissions-item t3js-multi-record-selection-check', 'value' => $permission, @@ -141,10 +141,9 @@ foreach ($tablesConfiguration as $tableConfiguration) { $tableRows[] = '<tr role="radiogroup" aria-labelledby="' . $tableConfiguration['label']['id'] . '">'; foreach ($tableConfiguration['permissions'] as $key => $permission) { - $tableRows[] = '<td class="col-radiogroup">'; - $tableRows[] = '<div class="form-check form-check-inline" data-multi-record-selection-identifier="' . $elementId . '-' . $key . '" data-multi-record-selection-element="true">'; + $tableRows[] = '<td class="col-radio">'; + $tableRows[] = '<div class="form-check form-check-type-radio" data-multi-record-selection-identifier="' . $elementId . '-' . $key . '" data-multi-record-selection-element="true">'; $tableRows[] = '<input ' . GeneralUtility::implodeAttributes($permission['attributes'], true, true) . '>'; - $tableRows[] = '<label class="form-check-label" for="' . $permission['attributes']['id'] . '">' . htmlspecialchars($permission['label']) . '</label>'; $tableRows[] = '</div>'; $tableRows[] = '</td>'; } ```
  13. Christian Kuhn commented on patch set 75 07/06/24, 09:02

    Reply

    We'll keep the solution as is: the proposed constant solution is easy to grasp and internal, no need to abstract further.

    Reply

    Ayke. This patch went through 3 major refactorings already. We're aiming for a merge now, finally. Your proposal changes checkbox.css which has potentially more impact than the current patch. I suggest to push such a change as dedicated patch to have after this is merged to have a dedicated look at it in a new patch review loop.

    TablePermissionElement.php:34 Reply

    turning this private const into an enum class is over-abstraction and not needed here.

    TablePermissionElement.php:63 Reply

    Done

    TablePermissionElement.php:108 Reply

    Done
  14. Christian Kuhn commented on patch set 75 07/06/24, 09:06

    TablePermissionElement.php:63 Reply

    actually, there is a subtle difference when the value is null. we'll keep the array_key_exists() solution.
  15. Christian Kuhn uploaded patch set 76 CR +1 V +1 07/06/24, 09:20

  16. Christian Kuhn voted on patch set 76 CR +1 V +1 07/06/24, 09:20

  17. core-ci voted on patch set 76 V +1 07/06/24, 09:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61093

  18. Marcin Sągol voted on patch set 76 CR +1 V +1 07/06/24, 10:11

  19. Ayke Halder commented on patch set 76 07/06/24, 10:50

    TablePermissionElement.php:34

    Constants are usually written all upper-case. Just wondering why there is no PHP CS Fixer rule for this.
  20. Christian Kuhn commented on patch set 76 07/06/24, 11:05

    TablePermissionElement.php:34 Reply

    rejected. there is no hard rule and this is everything but important for a private constant that is strictly bound to this class.
  21. Georg Ringer voted on patch set 76 CR +1 V +1 07/06/24, 11:09

  22. Ayke Halder commented on patch set 76 07/06/24, 11:35

    To follow PSR-1/PSR-12/PER-CS2.0 constants must be all upper case. No need to discuss this here. I opened an issue for this: https://github.com/TYPO3/coding-standards/issues/138

    TablePermissionElement.php:34 Reply

    There are no hard rules but TYPO3 follows coding standards. --- ### PSR-1: Basic Coding Standard https://www.php-fig.org/psr/psr-1/#1-overview > * Class constants MUST be declared in all upper case with underscore separators. --- ### PSR-12: Extended Coding Style & PER Coding Style 2.0 https://www.php-fig.org/psr/psr-12/#21-basic-coding-standard https://www.php-fig.org/per/coding-style/#2-general > #### 2.1 Basic Coding Standard > Code MUST follow all rules outlined in PSR-1.
  23. Christian Kuhn commented on patch set 76 07/06/24, 12:06

    Reply

    core itself does not use this repo.

    TablePermissionElement.php:34 Reply

    this patch is not the right place to discuss general CGL topics.
  24. Oli Bartsch commented on patch set 76 CR +2 V +2 07/06/24, 17:25

    Thanks to all involved. Now, after three rounds of rework and a lot of discussions, the patch is now in a state where we should get it in as it's main goal, to combine those two fields UX-wise, is achieved. All further topics, e.g. change of labels, radio size / color, etc. should be handled in separate patches.
  25. Oli Bartsch merged patch set 77 07/06/24, 17:26