mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Fix FLEXIAPI-185 Return null if the account dictionary is empty in the API
This commit is contained in:
parent
61a0339442
commit
9f908c3f7d
3 changed files with 22 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
v1.5
|
||||
----
|
||||
- Fix FLEXIAPI-185 Return null if the account dictionary is empty in the API
|
||||
- Fix FLEXIAPI-184 Append phone_change_code and email_change_code to the admin /accounts/<id> endpoint if they are available
|
||||
- Fix FLEXIAPI-183 Complete the account hooks on the dictionnary actions
|
||||
- Fix FLEXIAPI-181 Replace APP_ADMINS_MANAGE_MULTI_DOMAINS with APP_SUPER_ADMINS_SIP_DOMAINS
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ 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;
|
||||
|
|
@ -140,8 +141,10 @@ class Account extends Authenticatable
|
|||
return $this->hasMany(AccountDictionaryEntry::class);
|
||||
}
|
||||
|
||||
public function getDictionaryAttribute()
|
||||
public function getDictionaryAttribute(): ?Collection
|
||||
{
|
||||
if ($this->dictionaryEntries->isEmpty()) return null;
|
||||
|
||||
return $this->dictionaryEntries->keyBy('key')->map(function ($entry) {
|
||||
return $entry->value;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -423,6 +423,23 @@ class ApiAccountTest extends TestCase
|
|||
$entryNewKey => $entryNewValue
|
||||
]
|
||||
]);
|
||||
|
||||
// Clear
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->json('PUT', $this->route . '/' . $accountId, [
|
||||
'username' => 'john3',
|
||||
'password' => 'bar',
|
||||
'algorithm' => 'SHA-256',
|
||||
'dictionary' => []
|
||||
])
|
||||
->assertJson(['dictionary' => null])
|
||||
->assertStatus(200);
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->json('GET', $this->route . '/' . $accountId)
|
||||
->assertSee(['"dictionary":null'], false)
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testActivated()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue