Fix FLEXIAPI-142

This commit is contained in:
Timothée Jaussoin 2024-02-28 13:50:48 +00:00
parent 5930e78586
commit 53ad79b42e
4 changed files with 18 additions and 7 deletions

View file

@ -1,7 +1,7 @@
variables:
ROCKY_8_IMAGE_VERSION: 20230330_163028_remove_remi
ROCKY_9_IMAGE_VERSION: 20231019_170719_rocky9_php80_cleanup
DEBIAN_11_IMAGE_VERSION: 20230322_172926_missing_tools
DEBIAN_11_IMAGE_VERSION: 20240221_140459_package_upgrade_02_24
DEBIAN_12_IMAGE_VERSION: 20230925_143235_enable_debian12_packaging
PHP_REDIS_REMI_VERSION: php-pecl-redis5-5.3.6-1
PHP_IGBINARY_REMI_VERSION: php-pecl-igbinary-3.2.14-1

View file

@ -74,7 +74,7 @@ deb-only:
fakeroot alien -g -k --scripts $(OUTPUT_DIR)/rpmbuild/tmp.rpm
rm -r $(OUTPUT_DIR)/rpmbuild
rm -rf $(OUTPUT_DIR)/*.orig
sed -i 's/Depends:.*/Depends: $${shlibs:Depends}, php (>= 8.2), php8.2-xml, php8.2-pdo, php8.2-gd, php8.2-redis, php8.2-mysql, php8.2-mbstring, php8.2-sqlite3/g' $(OUTPUT_DIR)/bc-flexisip-account-manager*/debian/control
sed -i 's/Depends:.*/Depends: $${shlibs:Depends}, php (>= 8.0), php-xml, php-pdo, php-gd, php-redis, php-mysql, php-mbstring, php-sqlite3/g' $(OUTPUT_DIR)/bc-flexisip-account-manager*/debian/control
cd `ls -rt $(OUTPUT_DIR) | tail -1` && dpkg-buildpackage --no-sign
@echo "📦✅ DEB Package Created"

View file

@ -30,13 +30,13 @@ class UpdateAccountRequest extends FormRequest
new SIPUsername,
Rule::unique('accounts', 'username')->where(function ($query) {
$query->where('domain', resolveDomain($this));
})->ignore($this->route('account_id'), 'id'),
})->ignore($this->route('id'), 'id'),
'filled',
],
'email' => [
'nullable',
'email',
config('app.account_email_unique') ? Rule::unique('accounts', 'email')->ignore($this->route('account_id')) : null
config('app.account_email_unique') ? Rule::unique('accounts', 'email')->ignore($this->route('id')) : null
],
'role' => 'in:admin,end_user',
'dtmf_protocol' => 'nullable|in:' . Account::dtmfProtocolsRule(),
@ -44,8 +44,8 @@ class UpdateAccountRequest extends FormRequest
'nullable',
Rule::unique('accounts', 'username')->where(function ($query) {
$query->where('domain', resolveDomain($this));
})->ignore($this->route('account_id'), 'id'),
Rule::unique('aliases', 'alias')->ignore($this->route('account_id'), 'account_id'),
})->ignore($this->route('id'), 'id'),
Rule::unique('aliases', 'alias')->ignore($this->route('id'), 'account_id'),
new WithoutSpaces, 'starts_with:+'
]
];

View file

@ -578,6 +578,7 @@ class ApiAccountTest extends TestCase
$username = 'changed';
$algorithm = 'MD5';
$password = 'other';
$newDisplayName = 'new_display_name';
$this->keyAuthenticated($admin->account)
->json('PUT', $this->route . '/1234')
@ -590,6 +591,15 @@ class ApiAccountTest extends TestCase
])
->assertStatus(422);
$this->keyAuthenticated($admin->account)
->json('PUT', $this->route . '/' . $account->id, [
'username' => $username,
'algorithm' => $algorithm,
'password' => $password,
'display_name' => $newDisplayName
])
->assertStatus(200);
$this->keyAuthenticated($admin->account)
->json('PUT', $this->route . '/' . $account->id, [
'username' => $username,
@ -600,7 +610,8 @@ class ApiAccountTest extends TestCase
$this->assertDatabaseHas('accounts', [
'id' => $account->id,
'username' => $username
'username' => $username,
'display_name' => null
]);
$this->assertDatabaseHas('passwords', [