mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 01:58:07 +00:00
Fix FLEXIAPI-192 Clear and upgrade properly the account dictionary entries if...
This commit is contained in:
parent
747e308831
commit
aea9de7923
4 changed files with 27 additions and 7 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
v1.5
|
||||
---
|
||||
- Fix FLEXIAPI-192 Clear and upgrade properly the account dictionary entries if the entries are already existing
|
||||
- Fix FLEXIAPI-191 Add quotes for the pn-prid parameter in FlexisipPusherConnector
|
||||
- Fix FLEXIAPI-186 Ensure that empty objects are serialized in JSON as objects and not empty arrays
|
||||
- Fix FLEXIAPI-185 Return null if the account dictionary is empty in the API
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ namespace App;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -153,11 +152,8 @@ class Account extends Authenticatable
|
|||
|
||||
public function setDictionaryEntry(string $key, string $value): AccountDictionaryEntry
|
||||
{
|
||||
$entry = $this->dictionaryEntries->where('key', $key)->first();
|
||||
|
||||
if (!$entry) {
|
||||
$entry = new AccountDictionaryEntry;
|
||||
}
|
||||
$this->dictionaryEntries()->where('key', $key)->delete();
|
||||
$entry = new AccountDictionaryEntry;
|
||||
|
||||
$entry->account_id = $this->id;
|
||||
$entry->key = $key;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class ApiAccountDictionaryTest extends TestCase
|
|||
$this->keyAuthenticated($admin)
|
||||
->json($this->method, $this->route . '/' . $account->id . '/dictionary/' . $key, [
|
||||
'value' => $newValue
|
||||
])->assertStatus(200);
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||
|
|
|
|||
|
|
@ -400,6 +400,29 @@ class ApiAccountTest extends TestCase
|
|||
|
||||
// Account update
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->json('PUT', $this->route . '/' . $accountId, [
|
||||
'username' => 'john3',
|
||||
'password' => 'bar',
|
||||
'algorithm' => 'SHA-256',
|
||||
'dictionary' => [
|
||||
$entryNewKey => $entryNewValue
|
||||
]
|
||||
])
|
||||
->assertJsonMissing([
|
||||
'dictionary' => [
|
||||
$entryKey => $entryValue
|
||||
]
|
||||
])
|
||||
->assertJson([
|
||||
'dictionary' => [
|
||||
$entryNewKey => $entryNewValue
|
||||
]
|
||||
])
|
||||
->assertStatus(200);
|
||||
|
||||
// ...twice
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->json('PUT', $this->route . '/' . $accountId, [
|
||||
'username' => 'john3',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue