Page MenuHomePhorge

A user create command
ClosedPublic

Authored by mollekopf on Dec 22 2023, 8:55 PM.
Tags
None
Referenced Files
F12009762: D4613.diff
Sat, May 4, 10:40 PM
Unknown Object (File)
Wed, Apr 17, 11:09 AM
Unknown Object (File)
Wed, Apr 17, 11:09 AM
Unknown Object (File)
Wed, Apr 17, 11:08 AM
Unknown Object (File)
Wed, Apr 17, 11:08 AM
Unknown Object (File)
Wed, Apr 17, 11:08 AM
Unknown Object (File)
Mon, Apr 15, 10:30 AM
Unknown Object (File)
Mon, Apr 15, 4:32 AM
Subscribers

Details

Reviewers
machniak
Group Reviewers
Restricted Project
Commits
rK96cf0b70d87e: A user create command

Diff Detail

Repository
rK kolab
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mollekopf created this revision.
mollekopf added a reviewer: Restricted Project.Dec 22 2023, 8:57 PM

I use this to create users in the k3s setup (the alternative would be to somehow interact with a seeder I suppose). Either way, seems like something that we should have besides the existing scalpel command.

Tests are missing so far, I can write one if this makes sense.

machniak subscribed.

And a test would be nice.

src/app/Console/Commands/User/CreateCommand.php
16

It's just {--password=}, i.e. without ?

46

Why not? Ah, because the wallet handling below. I suppose this limitation could be removed.

54

It would be good to use 3rd argument here. If email already exists, but is soft-deleted, an error will not be returned, but the transaction will fail. It would be good to handle this case nicely.

62

There is also "reseller" role. So, I'd replace --admin with --role=

74

Role isn't fillable, it won't work this way. You have to set it after user creation.

79

I'd use $this->getObject() here. It will take care of the tenant constraint automatically.

This revision now requires changes to proceed.Dec 23 2023, 8:46 AM
mollekopf marked 2 inline comments as done.

Adressed most comments, no fruther plans for now

machniak added inline comments.
src/app/Console/Commands/User/CreateCommand.php
62

You do return here, but below you have a code to force-delete the user. So, I suppose this whole if is not needed.

82

We should validate the role name. Either in this script or in UserObserver,

88

I think it would be better to validate packages existence before attempting to create the user.

This revision now requires changes to proceed.Jan 10 2024, 11:05 AM
machniak added inline comments.
src/app/Console/Commands/User/CreateCommand.php
75

A role can be also 'reseller'.

This revision now requires changes to proceed.Jan 10 2024, 3:14 PM
This revision was not accepted when it landed; it landed in state Needs Revision.Jan 11 2024, 9:07 AM
This revision was automatically updated to reflect the committed changes.