Review main Merged

77020[FEATURE] Add command to create a backend user

Jochen Roth CR +2 V +2 Hard +436 −35 updated 02/03/23, 12:50

Commit message

A new command has been intruduced named
"./bin/typo3 backend:user:create" which
allows to create a backend user via CLI
using environment variables, cli options
or a guided walk-through (questions/answers)

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 9

Review log 5373

Show 3548 earlier messages
  1. Jochen Roth uploaded patch set 1 12/12/22, 07:17

  2. Jochen Roth uploaded patch set 2 12/12/22, 07:23

  3. core-ci voted on patch set 1 V +1 12/12/22, 07:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34897

  4. Jochen Roth uploaded patch set 3 V +1 12/12/22, 07:28

  5. core-ci voted on patch set 2 V +1 12/12/22, 07:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34898

  6. core-ci voted on patch set 3 V +1 12/12/22, 07:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34899

  7. Guido Schmechel commented on patch set 3 12/12/22, 09:40

    CreateBackendUserCommand.php:178

    Can we use the password policies here to be able to maintain the project standards?
  8. Jochen Roth uploaded patch set 4 V +1 12/12/22, 23:37

  9. Jochen Roth commented on patch set 4 12/12/22, 23:39

    CreateBackendUserCommand.php:178 Reply

    Thanks for the hint, this will be fixed with: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77072
  10. core-ci voted on patch set 4 V +1 12/12/22, 23:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34964

  11. Benni Mack commented on patch set 4 12/13/22, 07:30

    You should check with Stefan Buerk on this change.
  12. Jochen Roth commented on patch set 4 12/13/22, 07:33

    Reply

    Yep, already talked to him. He'll have a look soonish
  13. Jochen Roth marked it work in progress 12/13/22, 09:05

  14. Jochen Roth uploaded patch set 5 V +1 12/13/22, 09:49

  15. Jochen Roth rebased onto patch set 6 12/13/22, 10:04

  16. Jochen Roth marked it ready for review 12/13/22, 10:15

  17. core-ci voted on patch set 5 V -1 12/13/22, 10:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35010

  18. core-ci voted on patch set 6 V -1 12/13/22, 10:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35014

  19. Jochen Roth uploaded patch set 7 V -1 12/13/22, 11:10

  20. core-ci voted on patch set 7 V +1 12/13/22, 11:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35026

  21. Guido Schmechel commented on patch set 7 CR -1 12/15/22, 22:26

    Short feedback: Everything is feasible for the time being. A user has been created and can log in. What needs to be clarified for me: - Could you formulate the texts/questions a little more? Then it might sound a bit friendlier ;-) - In the RST I would choose a different sample email - In the command there are functions that I would rather expect in the SetupService: UserName Validation, Password Validation. In the SetupService, createUser() is declared public and theoretically I could create users there without password rules. Therefore, for the time being, a light -1 from me until clarification.
  22. Chris Müller commented on patch set 7 CR -1 12/16/22, 06:38

    Feature-99341-AddCliCreateBeUserCommand.rst:14

    This is an incomplete duplicate of the next paragraph, so should be removed.

    Feature-99341-AddCliCreateBeUserCommand.rst:17

    be -> backend
  23. Oliver Klee commented on patch set 7 12/16/22, 10:03

    Feature-99341-AddCliCreateBeUserCommand.rst:49

    For example emails and domains, please always use example.com. That domain exists for exact that purpose so that the hosters of other domains don't get random automated emails or HTTP requests. :-)
  24. Frank Nägler commented on patch set 7 V -1 CR -1 12/16/22, 12:33

    Nice idea, I love the idea of this command. Anyway, it is not working yet ;)

    CreateBackendUserCommand.php:88

    I guess not ;)

    CreateBackendUserCommand.php:180

    Uncaught TYPO3 Exception Call to undefined method TYPO3\CMS\Install\Service\SetupDatabaseService::getBackendUserPasswordValidationErrors()
  25. Jochen Roth commented on patch set 7 12/17/22, 00:38

    @Frank, sorry i should have mentionend it depends on this patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/77072/ So, please look at 77072 first, as soon as that is in, i'll go through the comments and fix what needs fixing.
  26. Jochen Roth uploaded patch set 8 CR -1 V +1 12/17/22, 04:56

  27. core-ci voted on patch set 8 V +1 12/17/22, 05:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35211

  28. Jochen Roth commented on patch set 8 12/17/22, 05:10

    CreateBackendUserCommand.php:88 Reply

    Done

    CreateBackendUserCommand.php:180 Reply

    Feature-99341-AddCliCreateBeUserCommand.rst:14 Reply

    Ack

    Feature-99341-AddCliCreateBeUserCommand.rst:17 Reply

    Ack

    Feature-99341-AddCliCreateBeUserCommand.rst:49 Reply

    Ack
  29. Jochen Roth uploaded patch set 9 V +1 12/21/22, 01:46

  30. core-ci voted on patch set 9 V +1 12/21/22, 01:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35253

  31. Susi Moog commented on patch set 9 12/27/22, 08:54

    Nice one. I have some small remarks regarding the wording, otherwise this looks quite good already.

    CreateBackendUserCommand.php:70

    "a the" --> the

    CreateBackendUserCommand.php:83

    Maybe: "Create user with admin privileges" (same for maintainer, just a bit friendlier, but no must have)

    CreateBackendUserCommand.php:126

    I would remove the "BeUser" from all method names.

    CreateBackendUserCommand.php:138

    consistency: If we camel case userName here, we should add a space in the explanation text above (where we use "username" currently).

    CreateBackendUserCommand.php:177

    the previous method has been private this one is protected again, let's be consistent ;)

    CreateBackendUserCommand.php:194

    consistency: - remove "to be set" - the other messages do not include that. - write "the backend user" instead of "your" (see below)

    CreateBackendUserCommand.php:234

    why no dependency injection?

    CreateBackendUserCommand.php:277

    messages here should be in line with explanation for the arguments above.
  32. Jochen Roth uploaded patch set 10 V +1 01/02/23, 01:16

  33. Jochen Roth commented on patch set 10 01/02/23, 01:17

    Thanks.

    CreateBackendUserCommand.php:70 Reply

    Done

    CreateBackendUserCommand.php:83 Reply

    Done

    CreateBackendUserCommand.php:126 Reply

    Done - had to use `getUsername` because `getName` is already in use.

    CreateBackendUserCommand.php:138 Reply

    Done

    CreateBackendUserCommand.php:177 Reply

    Done

    CreateBackendUserCommand.php:194 Reply

    Done

    CreateBackendUserCommand.php:234 Reply

    Done

    CreateBackendUserCommand.php:277 Reply

    Done
  34. core-ci voted on patch set 10 V +1 01/02/23, 01:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35419

  35. Susi Moog voted on patch set 10 CR +1 01/05/23, 10:56

  36. Susi Moog voted on patch set 10 V +1 01/05/23, 14:44

  37. Jörg Bösche voted on patch set 10 CR +1 01/11/23, 09:27

  38. Christian Kuhn commented on patch set 10 CR -1 01/11/23, 11:31

    -1 for now. I think we should really sort out the ext:install dependency if this command is located in ext:backend.

    CreateBackendUserCommand.php:31

    I don't like these two dependencies from ext:backend to ext:install here: We're pretty close to make ext:install optional, it would be good to not introduce new ones. Which options do we have to circumvent this? As far as I can see, two methods are used, which don't have no additional ext:install dependencies. Any chance to circumvent this?
  39. Susi Moog commented on patch set 10 01/13/23, 07:07

    CreateBackendUserCommand.php:31 Reply

    From a quick look it might make sense to move both methods to EXT:backend in general and have the dependency the other way around - as "createBackendUser" is (or should not be) not specific to the install process but may belong to the backend extension logically.
  40. Christian Kuhn commented on patch set 10 01/13/23, 13:37

    CreateBackendUserCommand.php:31 Reply

    since the two methods are rather tiny and have no further dependencies, it would be ok to just copy them to the command, i suppose.
  41. Jochen Roth uploaded patch set 11 CR +1 V +1 01/30/23, 16:27

  42. Jochen Roth commented on patch set 11 01/30/23, 16:37

    CreateBackendUserCommand.php:31 Reply

    I moved the methods with this patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77641 Thought this might come in handy when adding more commands for e.g. user listing
  43. core-ci voted on patch set 11 V +1 01/30/23, 16:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36781

  44. Josef Glatz updated the commit message in patch set 12 V +1 01/30/23, 18:56

  45. core-ci voted on patch set 12 V +1 01/30/23, 19:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36789

  46. Jochen Roth uploaded patch set 13 V +1 01/31/23, 12:17

  47. Jochen Roth uploaded patch set 14 01/31/23, 12:23

  48. core-ci voted on patch set 14 V -1 01/31/23, 12:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36818

  1. Jochen Roth uploaded patch set 15 V -1 01/31/23, 12:48

  2. Jochen Roth uploaded patch set 16 01/31/23, 12:52

  3. core-ci voted on patch set 16 V +1 01/31/23, 13:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36820

  4. Jochen Roth commented on patch set 16 01/31/23, 13:15

    CreateBackendUserCommand.php:31 Reply

    Agreed with lolli on "just copy" the methods. Also simplified createUser in the installer to minimize code because this is only used by installer and all flags are needed anyways.
  5. Oliver Klee wrote 01/31/23, 15:01

    Removed cc Oliver Klee.
  6. Christian Kuhn commented on patch set 16 CR -1 02/01/23, 16:08

    will push.
  7. Christian Kuhn uploaded patch set 17 CR -1 V +1 02/01/23, 16:41

  8. core-ci voted on patch set 17 V +1 02/01/23, 16:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36890

  9. Christian Kuhn uploaded patch set 18 V +1 02/01/23, 17:05

  10. core-ci voted on patch set 18 V +1 02/01/23, 17:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36894

  11. Christian Kuhn commented on patch set 18 CR -1 02/01/23, 17:20

    codewise fine, smaller logic changes: * ask for maintainer first. if maintainer=yes, set admin automatically, don't ask admin flag, don't ask for groups * if maintainer=so, ask for admin, if admin=yes, don't ask for group * if admin=no, ask for group * in non-interactive: expect on maintainer=1+admin=0 as invalid combination
  12. Christian Kuhn commented on patch set 18 02/01/23, 17:37

    Feature-99341-AddCliCreateBeUserCommand.rst:32

    we should add a hint here that declaring a password as environment variable is a potential security risk since such passwords then tend to end up in shell history files. that's one reason that ssh does not accept passphrase via env-var or similar ... btw: when a bash shell command starts with an empty space, it is *not* put into history, which we may want to document as well. unsure about other shells, though. maybe we should even change the example command to not emphasize the p/w env-var, but state that it *should* be always 'asked' as interactive mode.
  13. Jochen Roth uploaded patch set 19 CR -1 V +1 02/01/23, 22:20

  14. Jochen Roth commented on patch set 19 02/01/23, 22:31

    Reply

    Done. > in non-interactive: expect on maintainer=1+admin=0 as invalid combination The admin flag is set to true, if maintainer was set. This leads to the situation where this does not make sense to me, because the values are silently changed to the required values.

    Feature-99341-AddCliCreateBeUserCommand.rst:32 Reply

    * Removed the "simple example" * Added warning in the feature rst * Password remove from command example
  15. core-ci voted on patch set 19 V -1 02/01/23, 23:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36900

  16. Jochen Roth uploaded patch set 20 V -1 02/01/23, 23:35

  17. core-ci voted on patch set 20 V +1 02/01/23, 23:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36901

  18. Jochen Roth uploaded patch set 21 V +1 02/02/23, 11:55

  19. core-ci voted on patch set 21 V +1 02/02/23, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36921

  20. Christian Kuhn uploaded patch set 22 V +1 02/03/23, 12:34

  21. core-ci voted on patch set 22 V +1 02/03/23, 12:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36984

  22. Christian Kuhn voted on patch set 22 V +1 CR +1 02/03/23, 12:44

  23. Benni Mack voted on patch set 22 V +1 CR +1 02/03/23, 12:49

  24. Christian Kuhn voted on patch set 22 V +2 CR +2 02/03/23, 12:50

  25. Christian Kuhn merged patch set 23 02/03/23, 12:50