mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-04-27 07:38:38 +00:00
Add a new endpoint to search an account by SIP address as an admin
This commit is contained in:
parent
1804432e7d
commit
398867fa39
5 changed files with 19 additions and 1 deletions
|
|
@ -47,6 +47,11 @@ class AccountController extends Controller
|
|||
return Account::without(['passwords', 'admin'])->findOrFail($id)->makeVisible(['confirmation_key']);
|
||||
}
|
||||
|
||||
public function search(Request $request, string $sip)
|
||||
{
|
||||
return Account::sip($sip)->firstOrFail();
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
$account = Account::findOrFail($id);
|
||||
|
|
|
|||
|
|
@ -186,6 +186,9 @@ Retrieve all the accounts, paginated.
|
|||
#### `GET /accounts/{id}`
|
||||
Retrieve a specific account.
|
||||
|
||||
#### `GET /accounts/{sip}/search`
|
||||
Search for a specific account by sip address.
|
||||
|
||||
#### `DELETE /accounts/{id}`
|
||||
Delete a specific account and its related information.
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ Route::group(['middleware' => ['auth.digest_or_key']], function () {
|
|||
Route::get('accounts/{id}/deactivate', 'Api\Admin\AccountController@deactivate');
|
||||
Route::post('accounts', 'Api\Admin\AccountController@store');
|
||||
Route::get('accounts', 'Api\Admin\AccountController@index');
|
||||
Route::get('accounts/{sip}/search', 'Api\Admin\AccountController@search');
|
||||
Route::get('accounts/{id}', 'Api\Admin\AccountController@show');
|
||||
Route::delete('accounts/{id}', 'Api\Admin\AccountController@destroy');
|
||||
|
||||
|
|
|
|||
|
|
@ -582,6 +582,15 @@ class AccountApiTest extends TestCase
|
|||
->assertJson([
|
||||
'activated' => true
|
||||
]);
|
||||
|
||||
// Search feature
|
||||
$this->keyAuthenticated($admin->account)
|
||||
->get($this->route.'/'.$password->account->identifier.'/search')
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
'id' => $password->account->id,
|
||||
'activated' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function testGetAll()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#%define _datadir %{_datarootdir}
|
||||
#%define _docdir %{_datadir}/doc
|
||||
|
||||
%define build_number 114
|
||||
%define build_number 115
|
||||
%define var_dir /var/opt/belledonne-communications
|
||||
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue