mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 01:58:07 +00:00
Fix FLEXIAPI-431 Complete missing admin account dictionnary documentation
This commit is contained in:
parent
f883c3cee7
commit
85c939b4da
4 changed files with 54 additions and 4 deletions
|
|
@ -58,4 +58,10 @@ class DictionaryController extends Controller
|
||||||
return $request->space->accounts()
|
return $request->space->accounts()
|
||||||
->findOrFail($accountId)->dictionaryEntries()->where('key', $key)->delete();
|
->findOrFail($accountId)->dictionaryEntries()->where('key', $key)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clear(Request $request, int $accountId)
|
||||||
|
{
|
||||||
|
return $request->space->accounts()
|
||||||
|
->findOrFail($accountId)->dictionaryEntries()->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,16 @@
|
||||||
|
|
||||||
Get all the account dictionary entries.
|
Get all the account dictionary entries.
|
||||||
|
|
||||||
|
### `DELETE /accounts/{id}/dictionary/clear`
|
||||||
|
<span class="badge badge-warning">Admin</span>
|
||||||
|
|
||||||
|
Clear all the account dictionary entries.
|
||||||
|
|
||||||
|
### `GET /accounts/{id}/dictionary/{key}`
|
||||||
|
<span class="badge badge-warning">Admin</span>
|
||||||
|
|
||||||
|
Get an account dictionary entry.
|
||||||
|
|
||||||
### `POST /accounts/{id}/dictionary/{key}`
|
### `POST /accounts/{id}/dictionary/{key}`
|
||||||
<span class="badge badge-warning">Admin</span>
|
<span class="badge badge-warning">Admin</span>
|
||||||
|
|
||||||
|
|
@ -12,4 +22,9 @@ Add or update a new entry to the dictionary
|
||||||
|
|
||||||
JSON parameters:
|
JSON parameters:
|
||||||
|
|
||||||
* `value` **required**, the entry value
|
* `value` **required**, the entry value
|
||||||
|
|
||||||
|
### `DELETE /accounts/{id}/dictionary/{key}`
|
||||||
|
<span class="badge badge-warning">Admin</span>
|
||||||
|
|
||||||
|
Delete an account dictionary entry.
|
||||||
|
|
@ -190,6 +190,7 @@ Route::group(['middleware' => ['auth.jwt', 'auth.digest_or_key', 'auth.check_blo
|
||||||
|
|
||||||
Route::prefix('accounts/{id}/dictionary')->controller(DictionaryController::class)->group(function () {
|
Route::prefix('accounts/{id}/dictionary')->controller(DictionaryController::class)->group(function () {
|
||||||
Route::get('/', 'index');
|
Route::get('/', 'index');
|
||||||
|
Route::delete('/', 'clear');
|
||||||
Route::get('{key}', 'show');
|
Route::get('{key}', 'show');
|
||||||
Route::post('{key}', 'set');
|
Route::post('{key}', 'set');
|
||||||
Route::delete('{key}', 'destroy');
|
Route::delete('{key}', 'destroy');
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class ApiAccountDictionaryTest extends TestCase
|
||||||
$this->keyAuthenticated($admin)
|
$this->keyAuthenticated($admin)
|
||||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson([
|
->assertExactJson([
|
||||||
$key => $newValue
|
$key => $newValue
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ class ApiAccountDictionaryTest extends TestCase
|
||||||
$this->keyAuthenticated($admin)
|
$this->keyAuthenticated($admin)
|
||||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson([
|
->assertExactJson([
|
||||||
$key => $newValue,
|
$key => $newValue,
|
||||||
$secondKey => $newValue
|
$secondKey => $newValue
|
||||||
]);
|
]);
|
||||||
|
|
@ -106,8 +106,36 @@ class ApiAccountDictionaryTest extends TestCase
|
||||||
$this->keyAuthenticated($admin)
|
$this->keyAuthenticated($admin)
|
||||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJson([
|
->assertExactJson([
|
||||||
$secondKey => $newValue
|
$secondKey => $newValue
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Clear
|
||||||
|
$this->keyAuthenticated($admin)
|
||||||
|
->json($this->method, $this->route . '/' . $account->id . '/dictionary/' . $key, [
|
||||||
|
'value' => $value
|
||||||
|
])->assertStatus(201);
|
||||||
|
|
||||||
|
$this->keyAuthenticated($admin)
|
||||||
|
->json($this->method, $this->route . '/' . $account->id . '/dictionary/' . $secondKey, [
|
||||||
|
'value' => $newValue
|
||||||
|
])->assertStatus(201);
|
||||||
|
|
||||||
|
$this->keyAuthenticated($admin)
|
||||||
|
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertExactJson([
|
||||||
|
$key => $value,
|
||||||
|
$secondKey => $newValue
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->keyAuthenticated($admin)
|
||||||
|
->delete($this->route . '/' . $account->id . '/dictionary/')
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$this->keyAuthenticated($admin)
|
||||||
|
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertExactJson([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue