Page MenuHomePhorge

A user create command
ClosedPublic

Authored by mollekopf on Dec 22 2023, 8:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 9:44 PM
Unknown Object (File)
Sat, Sep 21, 12:10 AM
Unknown Object (File)
Sat, Sep 14, 6:27 PM
Unknown Object (File)
Sat, Sep 14, 3:29 PM
Unknown Object (File)
Fri, Sep 13, 8:29 AM
Unknown Object (File)
Thu, Sep 12, 4:05 PM
Unknown Object (File)
Thu, Sep 12, 12:39 PM
Unknown Object (File)
Wed, Sep 11, 6:25 AM
Subscribers

Details

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

Diff Detail

Repository
rK kolab
Lint
Lint Skipped
Unit
No Test Coverage
Build Status
Buildable 46340
Build 17846: arc lint + arc unit

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
74

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.