mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Make -kkey-only a flag
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
9b6fd7e19a
commit
2f7c04362e
|
@ -19,14 +19,14 @@ class GeneratePersonalAccessToken extends Command
|
||||||
protected $signature = 'snipeit:make-api-key
|
protected $signature = 'snipeit:make-api-key
|
||||||
{user : The ID of the user to create the token for}
|
{user : The ID of the user to create the token for}
|
||||||
{--name= : The name of the new API token}
|
{--name= : The name of the new API token}
|
||||||
{--key-only= : Only return the value of the API key}';
|
{--key-only : Only return the value of the API key}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'Command description';
|
protected $description = 'This console command allows you to generate Personal API tokens to be used with the Snipe-IT JSON REST API on behalf of a user.';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,7 @@ class GeneratePersonalAccessToken extends Command
|
||||||
|
|
||||||
if ($user = User::find($this->argument('user'))) {
|
if ($user = User::find($this->argument('user'))) {
|
||||||
|
|
||||||
if ($this->option('key-only')=='true') {
|
if ($this->option('key-only')) {
|
||||||
$this->info($user->createToken($accessTokenName)->accessToken);
|
$this->info($user->createToken($accessTokenName)->accessToken);
|
||||||
} else {
|
} else {
|
||||||
$this->warn('Your API Token has been created. Be sure to copy this token now, as it will not be accessible again.');
|
$this->warn('Your API Token has been created. Be sure to copy this token now, as it will not be accessible again.');
|
||||||
|
|
Loading…
Reference in a new issue