diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 853c59f..3f06491 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/Makefile b/Makefile index 708ef06..e491328 100644 --- a/Makefile +++ b/Makefile @@ -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" diff --git a/flexiapi/app/Http/Requests/UpdateAccountRequest.php b/flexiapi/app/Http/Requests/UpdateAccountRequest.php index da381bc..ec507e1 100644 --- a/flexiapi/app/Http/Requests/UpdateAccountRequest.php +++ b/flexiapi/app/Http/Requests/UpdateAccountRequest.php @@ -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:+' ] ]; diff --git a/flexiapi/tests/Feature/ApiAccountTest.php b/flexiapi/tests/Feature/ApiAccountTest.php index 8ad4bd7..4b4f7a1 100644 --- a/flexiapi/tests/Feature/ApiAccountTest.php +++ b/flexiapi/tests/Feature/ApiAccountTest.php @@ -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', [