Added autoassign_licenses option to create admin
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
16ab2bec06
commit
0afaaa4a6b
1 changed files with 10 additions and 1 deletions
|
@ -20,13 +20,14 @@ class CreateAdmin extends Command
|
||||||
* @property string $password
|
* @property string $password
|
||||||
* @property boolean $activated
|
* @property boolean $activated
|
||||||
* @property boolean $show_in_list
|
* @property boolean $show_in_list
|
||||||
|
* @property boolean $autoassign_licenses
|
||||||
* @property \Illuminate\Support\Carbon|null $created_at
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
* @property mixed $created_by
|
* @property mixed $created_by
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected $signature = 'snipeit:create-admin {--first_name=} {--last_name=} {--email=} {--username=} {--password=} {show_in_list?}';
|
protected $signature = 'snipeit:create-admin {--first_name=} {--last_name=} {--email=} {--username=} {--password=} {show_in_list?} {autoassign_licenses?}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
|
@ -54,6 +55,9 @@ class CreateAdmin extends Command
|
||||||
$email = $this->option('email');
|
$email = $this->option('email');
|
||||||
$password = $this->option('password');
|
$password = $this->option('password');
|
||||||
$show_in_list = $this->argument('show_in_list');
|
$show_in_list = $this->argument('show_in_list');
|
||||||
|
$autoassign_licenses = $this->argument('autoassign_licenses');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (($first_name == '') || ($last_name == '') || ($username == '') || ($email == '') || ($password == '')) {
|
if (($first_name == '') || ($last_name == '') || ($username == '') || ($email == '') || ($password == '')) {
|
||||||
$this->info('ERROR: All fields are required.');
|
$this->info('ERROR: All fields are required.');
|
||||||
|
@ -70,6 +74,11 @@ class CreateAdmin extends Command
|
||||||
if ($show_in_list == 'false') {
|
if ($show_in_list == 'false') {
|
||||||
$user->show_in_list = 0;
|
$user->show_in_list = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($autoassign_licenses == 'false') {
|
||||||
|
$user->autoassign_licenses = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->save()) {
|
if ($user->save()) {
|
||||||
$this->info('New user created');
|
$this->info('New user created');
|
||||||
$user->groups()->attach(1);
|
$user->groups()->attach(1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue