Use the SIP and not the id anymore for the set-admin console command

Bump the package number
This commit is contained in:
Timothée Jaussoin 2021-05-11 10:36:12 +02:00
parent 02f1491408
commit 8fcc6c1e46
2 changed files with 11 additions and 4 deletions

View file

@ -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;
}
}

View file

@ -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