Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review

84995[FEATURE] Allow assigning users to groups in group editor

Krzysztof Gutkowski CR -1 V +1 Hard +922 −1 updated 11/10/26, 13:38

Commit message

This commit adds a custom, internal-only backend form field type
`selectGroupUsers`, which is used in the usergroup editor to
display a list of users belonging to said group.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 11
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/95/84995/11 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/95/84995/11 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -1 Needs a vote
    • Andreas Kienast -1
  • Verified V +1 Needs a vote
    • Guido Schmechel +1
    • core-ci +1 CI

Issues 1

Files 13

Review log 2435

Show 610 earlier messages
  1. Krzysztof Gutkowski uploaded patch set 1 06/28/24, 13:13

  2. core-ci voted on patch set 1 V -1 06/28/24, 13:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60563

  3. Marcin Sągol uploaded patch set 2 V -1 06/30/24, 19:37

  4. core-ci voted on patch set 2 V -1 06/30/24, 19:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60707

  5. Marcin Sągol uploaded patch set 3 V -1 06/30/24, 20:11

  6. core-ci voted on patch set 3 V -1 06/30/24, 20:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60708

  7. Marcin Sągol uploaded patch set 4 V -1 06/30/24, 20:19

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

  9. Mogens Fiebrandt commented on patch set 4 CR -1 06/30/24, 23:35

    Nice feature. Would love to have this.

    select-group-users-element.ts:161

    It's possible to add backend-user and admin-user to a group. You should consider to render the correct icon for the user here.

    TcaSelectGroupUsersAjaxFieldData.php:32

    The functions return type declaration is missing here.

    TcaSelectGroupUsers.php:52

    I think there is no need to iterate over all columns of the be_group table. You already know, that you are looking for the fieldname "users" here.

    TcaSelectGroupUsers.php:119

    The default value for itemsPerPage is set in the TCA of be_groups. If not set, an undefined array key warning exception is thrown in line 64. Maybe it would be better to check the default value ealier in your code and if not set, then set it to 5 like the default value in the TCA of the be_groups.
  10. Marcin Sągol uploaded patch set 5 CR -1 V +1 07/01/24, 08:53

  1. Marcin Sągol commented on patch set 5 07/01/24, 08:54

    select-group-users-element.ts:161 Reply

    Done

    TcaSelectGroupUsersAjaxFieldData.php:32 Reply

    Done

    TcaSelectGroupUsers.php:52 Reply

    @mogens.fiebrandt@googlemail.com here we are following convention how all other data providers checks if handle given field type and process the data for it.

    TcaSelectGroupUsers.php:119 Reply

    Done
  2. core-ci voted on patch set 5 V +1 07/01/24, 09:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60743

  3. Mogens Fiebrandt commented on patch set 5 CR -1 07/01/24, 09:23

    TcaSelectGroupUsers.php:52 Reply

    @marcin@soee.pl i would say your case is different from the other cases. Because you're fetching sensible data here. You already nailed the database in the data-provider. Maybe it would also be good to nail the field. Not sure if this else could become an sec issue somehow. Maybe someone from the security team could mention his thoughts to that.
  4. Marcin Sągol uploaded patch set 6 CR -1 V +1 07/01/24, 09:56

  5. core-ci voted on patch set 6 V +1 07/01/24, 10:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60760

  6. Tymoteusz Motylewski commented on patch set 6 07/09/24, 08:17

    just main. no need to target 13.2
  7. Krzysztof Gutkowski uploaded patch set 7 V +1 07/10/24, 08:42

  8. core-ci voted on patch set 7 V +1 07/10/24, 08:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/61298

  9. Tymoteusz Motylewski commented on patch set 7 09/02/24, 10:34

    Reply

    Done
  10. Guido Schmechel commented on patch set 7 09/02/24, 15:41

    Feature RST can be moved to 13.3 folder
  11. Oskar Dydo uploaded patch set 8 V +1 09/04/24, 13:10

  12. core-ci voted on patch set 8 V +1 09/04/24, 13:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64756

  13. Guido Schmechel commented on patch set 8 09/07/24, 16:09

    Basically, the feature works for me. But does it still make sense to restrict the new TCA type selectGroupUsers? Simply to avoid misunderstandings.
  14. Oskar Dydo uploaded patch set 9 V +1 09/13/24, 09:26

  15. core-ci voted on patch set 9 V +1 09/13/24, 09:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65645

  16. Oskar Dydo rebased onto patch set 10 V +1 09/13/24, 10:14

  17. core-ci voted on patch set 10 V +1 09/13/24, 10:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65655

  18. Markus Klein updated the commit message in patch set 11 V +1 09/13/24, 10:44

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

  20. Guido Schmechel voted on patch set 11 V +1 09/13/24, 14:51

  21. Stefan Bürk commented on patch set 11 09/14/24, 00:30

    Thanks for the work and providing this change. Not a full review yet, just played around with it in the backend. * editing a backend user group and adding/deleting a user from the group does this directly using ajax, which feels kind if counter-intuitive. For example a user is added or deleted, the modal closed and "closing" the group edit form a) does not ask for change/discard changes and reoping has the user added/deleted. In a form having a close/question-todiscard + explicitly safe logic that feels somehow wrong. * the record listing in the modal is not shown by default, and even searching does not listen the records - the collapsible state is here also counter intuitive * usually in modals, we have two ways - select a single item and close modal with one clikc (link chain in linkbrowser for example or other add modals) and a plus-sign selecting one without closing the modal. Not sure about the user experiance here - needs a look from more experianced people in that area.

    FormSelectGroupUsersAjaxController.php:30

    Add following phpdoc block ```php /** * @internal This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API. */ ```

    SelectGroupUsersElement.php:21 Unresolved

    commit message mentiones that this field is for internal use only. Let's add a @internal annotation to emphasize this. ```php /** * @internal This class is a specific Backend formengine implementation for a concreate use-case and is not considered part of the Public TYPO3 API. */ ``` On top of that I guess we should not document it - otherwise people want to use it.
  22. Stefan Bürk commented on patch set 11 09/14/24, 00:51

    Reply Unresolved

    Resolving these issues I'd postulate that a more generic type can be implemented in v14 so it can be used for similar relation but in a flexible way.

    FormSelectGroupUsersAjaxController.php:30 Reply Unresolved

    Additional we should consider to make the class final ....

    FormSelectGroupUsersAjaxController.php:37 Unresolved

    This action should throw an exception when current backend user is not a admin.

    FormSelectGroupUsersAjaxController.php:103 Unresolved

    This action should throw an exception when current backend user is not a admin.

    FormSelectGroupUsersAjaxController.php:105 Unresolved

    Let the connectionpool be injected, and create the QueryBuilder than from the retrieved service: ``` $queryBuilder = $this->connectionPool->getQueryBuilderForTable(); ```

    FormSelectGroupUsersAjaxController.php:110 Unresolved

    Please use here ``` $queryBuilder->createNamedPlaceholder(...) ``` and drop the `setParameter()` call below.

    FormSelectGroupUsersAjaxController.php:111 Unresolved

    add ``` ->setMaxResults(1) ``` here - granted, with uid only one record should be retrieved, but explicitly set the max results makes it clear that only one record is retrieved (and ensured that the resultset is properly closed and buffer cleared). Mainly because `fetchOne()` will only return the first column of the first row.

    FormSelectGroupUsersAjaxController.php:115 Unresolved

    Please set the 3rd argument to true so empty values will not resolve to `0` during int casts and dropped.

    SelectGroupUsersElement.php:25 Unresolved

    I'd say we should check the tablename `be_groups` and throw otherwise an `\RuntimeException`, so no one uses this type for other things as this can introduce information disclosures. Maybe also by making the class final to make it harder to missuse this implementation.
  23. Andreas Kienast commented on patch set 11 CR -1 09/16/24, 08:59

    SelectGroupUsersElement.php:36

    There's a whitespace missing at the end, otherwise the rendered output is ``` <typo3-backend-form-selectgroupuserscurrentGroup="XXX".../> ``` Also, web component CANNOT be self-closing.
  24. Marcin Sągol commented on patch set 11 08/08/26, 17:36

    SelectGroupUsersElement.php:36 Reply

    I am working on a completely different approach to this whoel feature. Will post the updated code soon.
  25. Benni Mack commented on patch set 11 11/10/26, 13:38

    SelectGroupUsersElement.php:36 Reply Unresolved

    any update? Or is it going to be a new patch?