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
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.
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. |
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. |
src/app/Console/Commands/User/CreateCommand.php | ||
---|---|---|
75 | A role can be also 'reseller'. |