From 8fcc6c1e46216246afd36c25ab484490388ad5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Tue, 11 May 2021 10:36:12 +0200 Subject: [PATCH] Use the SIP and not the id anymore for the set-admin console command Bump the package number --- flexiapi/app/Console/Commands/SetAccountAdmin.php | 13 ++++++++++--- flexisip-account-manager.spec | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/flexiapi/app/Console/Commands/SetAccountAdmin.php b/flexiapi/app/Console/Commands/SetAccountAdmin.php index 54b7a5b..27b8010 100644 --- a/flexiapi/app/Console/Commands/SetAccountAdmin.php +++ b/flexiapi/app/Console/Commands/SetAccountAdmin.php @@ -26,7 +26,7 @@ use App\Admin; class SetAccountAdmin extends Command { - protected $signature = 'accounts:set-admin {id}'; + protected $signature = 'accounts:set-admin {sip}'; protected $description = 'Give the admin role to an account'; public function __construct() @@ -36,12 +36,19 @@ class SetAccountAdmin extends Command public function handle() { - $account = Account::where('id', $this->argument('id'))->first(); + $account = Account::withoutGlobalScopes()->sip($this->argument('sip'))->first(); - if (!$account) $this->error('Account not found, please use an existing ID'); + if (!$account) { + $this->error('Account not found, please use an existing SIP address'); + return 1; + } $admin = new Admin; $admin->account_id = $account->id; $admin->save(); + + $this->info('Account '.$this->argument('sip').' is now admin'); + + return 0; } } diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index eecafe0..148a6de 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 69 +%define build_number 70 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager