82822[BUGFIX] Create backend users via CLI respects TCA default options
Commit message
Review
-
Code review CR +2 Done
- Stefan Bürk +2
- Garvin Hicking +1
-
Verified V +2 Done
- Stefan Bürk +2
- Garvin Hicking +1
- core-ci +1 CI
Issues 1
Files 6
- typo3/sysext/backend/Classes/Command/CreateBackendUserCommand.php17+25 −15
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/Expected/be_users_after_admin.csvnew+11 −0
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/Expected/be_users_after_maint.csvnew+11 −0
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/Expected/be_users_after_normal.csvnew+11 −0
- typo3/sysext/backend/Tests/Functional/Command/Fixtures/be_groups_multiple.csvnew+7 −0
- typo3/sysext/backend/Tests/Functional/Command/CreateBackendUserCommandTest.phpnew+209 −0
Review log 4256
Show 2231 earlier messages
-
Lukas Maxheim uploaded patch set 1 02/06/24, 14:02
-
core-ci voted on patch set 1 V +1 02/06/24, 14:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52794
-
Stefan Bürk commented on patch set 1 02/07/24, 16:52
Thanks for your patch. Please read the contribution guide regarding rules for the commit message. You exceeding the max line length and fix your commit message. I'd say the bullet-list style is not needed, so remove that to and keep the sentances as is in some way. Out-of-scope - I'd question why the user creation is done with plain QueryBuilder at all and not using the `DataHandler`. Currently no time, but I would investigate first why this is done and consider if it would not be wiser to switch to that. Therefore, all default for columns are used anyway. TBH - not sure if this could work, but would be a general thing here. Otherwise, your approach looks at least good for the current implementation with the QueryBuilder insert. -
Stefan Bürk commented on patch set 1 02/07/24, 16:52
-
Lukas Maxheim updated the commit message in patch set 2
V +102/07/24, 17:06 -
core-ci voted on patch set 2 V +1 02/07/24, 17:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52869
-
Lukas Maxheim commented on patch set 2 02/07/24, 17:20
I am quite new to the process and just wanted to stick to the scope of the referenced issue, so thank you for your feedback - especially for the DataHandler approach. I shortened the commit message/description to match the requirements from the contribution guide. -
Lukas Maxheim commented on patch set 2 02/07/24, 17:26
Reply
Done -
Stefan Bürk commented on patch set 2 02/07/24, 21:01
Reply
Got that, and from that point of view that is okay and the way you provided that change. I mentioned the fact with the DataHandler and my thoughts for other reviewers and from a maintainer point of view as a general note - to think about it (not for you to take action for now). Will revisit and check that deeper the next days I hope, at least it is documented if some else from the casual reviewes/contributiors or core team members have a peak and have time to look into a eventually more suitable approach before I have it. Every thing done right so far (commit message aside). -
Stefan Bürk updated the commit message in patch set 3
V +102/07/24, 21:01 -
core-ci voted on patch set 3 V +1 02/07/24, 21:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52870
-
Benni Mack commented on patch set 3 CR -1 02/12/24, 14:17
CreateBackendUserCommand.php:343I think we need to use DataHandler here, so we can also log this / have a history entry that this record was created. -
Lukas Maxheim commented on patch set 3 02/12/24, 14:22
CreateBackendUserCommand.php:343ReplyAcknowledged -
Lukas Maxheim uploaded patch set 4
CR -1V +102/13/24, 11:47 -
Lukas Maxheim uploaded patch set 5 02/13/24, 11:53
-
core-ci voted on patch set 4 V +1 02/13/24, 11:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53165
-
core-ci voted on patch set 5 V +1 02/13/24, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53166
-
Mathias Brodala commented on patch set 5 CR -1 02/13/24, 12:57
CreateBackendUserCommand.php:347You can use the incoming plain-text password here, the DataHandler takes care of hashing. (See DataHandler::checkValueForPassword())CreateBackendUserCommand.php:350We can pass through the incoming array here, the DataHandler can handle this. -
Lukas Maxheim uploaded patch set 6
CR -1V +102/13/24, 13:05 -
Lukas Maxheim commented on patch set 6 02/13/24, 13:07
CreateBackendUserCommand.php:347ReplyThanks for the feedback, i updated this.CreateBackendUserCommand.php:350ReplyThanks for the feedback, i updated this. -
core-ci voted on patch set 6 V -1 02/13/24, 13:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53170
-
Lukas Maxheim uploaded patch set 7
V -102/13/24, 13:13 -
Lukas Maxheim uploaded patch set 8 02/13/24, 13:16
-
core-ci voted on patch set 7 V -1 02/13/24, 13:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53171
-
core-ci voted on patch set 8 V +1 02/13/24, 13:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53172
-
Mathias Brodala commented on patch set 8 CR -1 02/13/24, 13:48
CreateBackendUserCommand.php:339How about "$userId" ...CreateBackendUserCommand.php:359This can be reduced: $userId = $dataHandler->substNEWwithIDs[$userId] ?? null; -
Lukas Maxheim uploaded patch set 9
CR -1V +102/13/24, 13:54 -
Mathias Brodala commented on patch set 9 CR +1 02/13/24, 13:57
CreateBackendUserCommand.php:339ReplyDoneCreateBackendUserCommand.php:359ReplyDone -
Lukas Maxheim commented on patch set 8 02/13/24, 13:57
CreateBackendUserCommand.php:339ReplyIn my opinion the variable name is more precise, so I would keep it.CreateBackendUserCommand.php:359ReplyDone -
core-ci voted on patch set 9 V +1 02/13/24, 13:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53175
-
Garvin Hicking commented on patch set 9 CR +1 V -1 02/16/24, 15:44
This generally looks good, however - the users created with that command are now disabled by default. This is probably because the "default" in the TCA for "disable" is "1". Thus I think a "disable = 0" should be passed here?
-
Lukas Maxheim commented on patch set 9 02/16/24, 15:52
Reply
I appreciate your feedback. In my opinion this should respect TCA defaults regarding the initial scope - but i can add it. -
Garvin Hicking commented on patch set 9 02/16/24, 16:19
Reply
This is indeed a pickle. I'd argue that the CLI command needs to create a working user account. So the alternative would be to add a parameter option to indicate the disable/enabled state to override this? (BTW: Note https://review.typo3.org/c/Packages/TYPO3.CMS/+/83018 - currently, shortcut options are broken, found this out while testing your patch :)) -
Lukas Maxheim uploaded patch set 10
CR +1V +102/19/24, 07:45 -
Lukas Maxheim commented on patch set 10 02/19/24, 07:47
Reply
Done. -
core-ci voted on patch set 10 V +1 02/19/24, 07:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53325
-
Garvin Hicking commented on patch set 10 CR +1 V +1 02/19/24, 08:03
Thanks! ☺️ -
Andreas Kienast commented on patch set 10 CR -1 02/26/24, 12:50
CreateBackendUserCommand.php:349AFAICS the database column name is `disable`. Also, this command behaves differently than the user creation in the backend, as new users are disabled by default. What is the reason to ignore the TCA default here? -
Andreas Kienast commented on patch set 10 V -1 02/26/24, 12:56
CreateBackendUserCommand.php:349ReplyAs I suspected - `disabled` is an invalid field, hence DataHandler ignores it. TCA default of `disable` kicks in and the user is disabled upon creation. -
Lukas Maxheim uploaded patch set 11
CR +1V +102/26/24, 13:20 -
core-ci voted on patch set 11 V +1 02/26/24, 13:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53614
-
Lukas Maxheim commented on patch set 11 02/26/24, 13:31
CreateBackendUserCommand.php:349ReplyYou are completely right - i updated this to `disable` and can verify it. Sorry for this! I stated that the original scope should be respected but i updated the behaviour to take @gh@faktor-e.de 's feedback into account: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82822/comments/453dfb8b_0d32d811 Should I undo this approach or should it stay as it is? -
Andreas Kienast commented on patch set 11 V +1 02/26/24, 15:26
CreateBackendUserCommand.php:349Replytbh, I'm not sure. Anyway, the patch is fully functional now. -
Garvin Hicking commented on patch set 11 CR +1 V +1 02/26/24, 15:54
I'd really be expecting a working BE account when using the CLI, otherwise it would be a Breaking Change. That could also happen of course but would need an RST file then and couldn't backport to v12... and we should then have an option to the CLI to toggle disable=1 if wanted? Voting for the current implementation 😇 (I sadly tested it wrongly, sorry for missing the "disabled" key and thanks for noticing!) -
Stefan Bürk commented on patch set 11 CR -1 02/27/24, 20:32
I guess it's time to cover this cli command with some tests. Especially after the culprit with the `disabled <-> disable` field name. The `ext:core` has a abstract command tester class and also provides some command tests, for example https://github.com/TYPO3/typo3/blob/d2964e387186a9832dc259662f334c5def8c2dae/typo3/sysext/core/Tests/Functional/Command/CacheWarmupCommandTest.php#L26 With the different options and using `assertCsvDataset()` with csv fixtures afterward. Also different TCA presets can be tested if they are really taking into account and so on. What do you think ? Are you up to add some tests for the command ? Unrelated to this change - personally I prefere to keep commands slim and clean and handle stuff in services, but that's another topic to refactor eventually. -
Lukas Maxheim commented on patch set 11 02/29/24, 09:31
Reply
Yes this makes totally sense - i can tackle this. -
Garvin Hicking uploaded patch set 12
CR +1V +104/05/24, 12:55Add tests -
Garvin Hicking commented on patch set 12 CR +1 V +1 04/05/24, 12:57
Reply
I took the liberty to add tests to this patch, hopefully covering most issues that can be faced. I'd be happy if you can have a look at it and see if that's a viable approach. I do not specifically cover checking the sys_log and other things the DataHandler does, because that is covered by the DataHandler tests. -
core-ci voted on patch set 12 V +1 04/05/24, 12:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55383
-
Stefan Bürk uploaded patch set 13
CR +1V +104/07/24, 10:39 -
core-ci voted on patch set 13 V -1 04/07/24, 10:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55500
-
Stefan Bürk uploaded patch set 14
V -104/07/24, 10:49 -
core-ci voted on patch set 14 V +1 04/07/24, 10:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55501
-
Garvin Hicking voted on patch set 14 CR +1 V +1 04/07/24, 11:09
-
Stefan Bürk commented on patch set 14 CR +2 V +2 04/07/24, 11:15
Reply
Thanks Garvin for taking care of the requested tests. I moved them to `EXT:backend` which provides the tested command.CreateBackendUserCommand.php:349ReplyI get Andreas point here, but I'd say that this needs to be reconsidered in a follow up change along with a `enforce-enable` options or similar. It make sense to have the TCA default for backend user creation with a `disabled` default state, but the command is also used for (test pipeline) distribution or automatic instance deployments / creation and having the ability to create them `enabled` make sense. Due to the usage of direct database inserts, the database default (disabled = 0) has been used and adding a `disabled = 0` to the datahandler datamap respects this. Considering a change here is out-of-scope of this change, and would also eliminate the ability to backport it. Closing this now here, as the patch works now correctly in respect of what can and should be expected for this move. -
Stefan Bürk merged patch set 15 04/07/24, 12:04