From 63a690d6b283354747ac760860f45f4e626d5eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Mon, 6 Sep 2021 17:12:44 +0200 Subject: [PATCH] Save the removed accounts in a "tombstones" table to prevent them to be recreated Add a Console commande to clear the old tombstones Update the documentation --- flexiapi/app/Account.php | 7 + flexiapi/app/AccountTombstone.php | 13 + .../Commands/ClearOldAccountsTombstones.php | 33 +++ .../Controllers/Account/AccountController.php | 8 + .../Account/RegisterController.php | 7 + .../Controllers/Api/AccountController.php | 19 +- .../Api/Admin/AccountController.php | 16 +- flexiapi/composer.lock | 270 +++++++++--------- ...6_132040_add_accounts_tombstones_table.php | 25 ++ .../api/documentation_markdown.blade.php | 2 +- flexiapi/tests/Feature/AccountApiTest.php | 3 + flexisip-account-manager.spec | 2 +- 12 files changed, 262 insertions(+), 143 deletions(-) create mode 100644 flexiapi/app/AccountTombstone.php create mode 100644 flexiapi/app/Console/Commands/ClearOldAccountsTombstones.php create mode 100644 flexiapi/database/migrations/2021_09_06_132040_add_accounts_tombstones_table.php diff --git a/flexiapi/app/Account.php b/flexiapi/app/Account.php index 082180a..c97af03 100644 --- a/flexiapi/app/Account.php +++ b/flexiapi/app/Account.php @@ -88,6 +88,13 @@ class Account extends Authenticatable return $this->hasOne('App\Admin'); } + public function hasTombstone() + { + return AccountTombstone::where('username', $this->attributes['username']) + ->where('domain', $this->attributes['domain']) + ->exists(); + } + public function activationExpiration() { return $this->hasOne('App\ActivationExpiration'); diff --git a/flexiapi/app/AccountTombstone.php b/flexiapi/app/AccountTombstone.php new file mode 100644 index 0000000..7854570 --- /dev/null +++ b/flexiapi/app/AccountTombstone.php @@ -0,0 +1,13 @@ +subDays($this->argument('days'))->toDateTimeString() + ); + + if ($this->option('apply')) { + $this->info($tombstones->count() . ' tombstones deleted'); + $tombstones->delete(); + } else { + $this->info($tombstones->count() . ' tombstones to delete'); + } + } +} diff --git a/flexiapi/app/Http/Controllers/Account/AccountController.php b/flexiapi/app/Http/Controllers/Account/AccountController.php index 9a85b79..b3e4d52 100644 --- a/flexiapi/app/Http/Controllers/Account/AccountController.php +++ b/flexiapi/app/Http/Controllers/Account/AccountController.php @@ -24,6 +24,7 @@ use Illuminate\Support\Facades\Auth; use App\Http\Controllers\Controller; use App\Account; +use App\AccountTombstone; use App\Helpers\Utils; class AccountController extends Controller @@ -64,6 +65,13 @@ class AccountController extends Controller { $request->validate(['identifier' => 'required|same:identifier_confirm']); + if (!$request->user()->hasTombstone()) { + $tombstone = new AccountTombstone; + $tombstone->username = $request->user()->username; + $tombstone->domain = $request->user()->domain; + $tombstone->save(); + } + $request->user()->delete(); Auth::logout(); diff --git a/flexiapi/app/Http/Controllers/Account/RegisterController.php b/flexiapi/app/Http/Controllers/Account/RegisterController.php index 1cff5d3..0c0bf49 100644 --- a/flexiapi/app/Http/Controllers/Account/RegisterController.php +++ b/flexiapi/app/Http/Controllers/Account/RegisterController.php @@ -28,6 +28,7 @@ use Illuminate\Validation\Rule; use Carbon\Carbon; use App\Account; +use App\AccountTombstone; use App\Alias; use App\Rules\WithoutSpaces; use App\Helpers\Utils; @@ -72,6 +73,9 @@ class RegisterController extends Controller Rule::unique('accounts', 'username')->where(function ($query) use ($request) { $query->where('domain', config('app.sip_domain')); }), + Rule::unique('accounts_tombstones', 'username')->where(function ($query) use ($request) { + $query->where('domain', config('app.sip_domain')); + }), 'filled', new WithoutSpaces ], @@ -113,6 +117,9 @@ class RegisterController extends Controller Rule::unique('accounts', 'username')->where(function ($query) use ($request) { $query->where('domain', config('app.sip_domain')); }), + Rule::unique('accounts_tombstones', 'username')->where(function ($query) use ($request) { + $query->where('domain', config('app.sip_domain')); + }), 'nullable', new WithoutSpaces ], diff --git a/flexiapi/app/Http/Controllers/Api/AccountController.php b/flexiapi/app/Http/Controllers/Api/AccountController.php index 00dd57a..e54e587 100644 --- a/flexiapi/app/Http/Controllers/Api/AccountController.php +++ b/flexiapi/app/Http/Controllers/Api/AccountController.php @@ -27,6 +27,7 @@ use App\Http\Controllers\Controller; use Carbon\Carbon; use App\Account; +use App\AccountTombstone; use App\Token; use App\Http\Controllers\Account\AuthenticateController as WebAuthenticateController; @@ -51,7 +52,14 @@ class AccountController extends Controller 'username' => [ 'required', Rule::unique('accounts', 'username')->where(function ($query) use ($request) { - $query->where('domain', config('app.sip_domain')); + $query->where('domain', $request->has('domain') && config('app.everyone_is_admin') + ? $request->get('domain') + : config('app.sip_domain')); + }), + Rule::unique('accounts_tombstones', 'username')->where(function ($query) use ($request) { + $query->where('domain', $request->has('domain') && config('app.everyone_is_admin') + ? $request->get('domain') + : config('app.sip_domain')); }), 'filled', ], @@ -75,7 +83,7 @@ class AccountController extends Controller $account->username = $request->get('username'); $account->email = $request->get('email'); $account->activated = false; - $account->domain = $request->has('domain') + $account->domain = $request->has('domain') && config('app.everyone_is_admin') ? $request->get('domain') : config('app.sip_domain'); $account->ip_address = $request->ip(); @@ -143,6 +151,13 @@ class AccountController extends Controller public function delete(Request $request) { + if (!$request->user()->hasTombstone()) { + $tombstone = new AccountTombstone; + $tombstone->username = $request->user()->username; + $tombstone->domain = $request->user()->domain; + $tombstone->save(); + } + return Account::where('id', $request->user()->id) ->delete(); } diff --git a/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php b/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php index 9cb05b9..fed0235 100644 --- a/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php +++ b/flexiapi/app/Http/Controllers/Api/Admin/AccountController.php @@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Log; use Carbon\Carbon; use App\Account; +use App\AccountTombstone; use App\ActivationExpiration; use App\Admin; use App\Alias; @@ -48,6 +49,14 @@ class AccountController extends Controller public function destroy(Request $request, $id) { $account = Account::findOrFail($id); + + if (!$account->hasTombstone()) { + $tombstone = new AccountTombstone; + $tombstone->username = $account->username; + $tombstone->domain = $account->domain; + $tombstone->save(); + } + $account->delete(); } @@ -74,8 +83,11 @@ class AccountController extends Controller $request->validate([ 'username' => [ 'required', - Rule::unique('accounts', 'username')->where(function ($query) { - $query->where('domain', config('app.sip_domain')); + Rule::unique('accounts', 'username')->where(function ($query) use ($request) { + $query->where('domain', $request->has('domain') && config('app.everyone_is_admin') + ? $request->get('domain') + : config('app.sip_domain') + ); }), 'filled', ], diff --git a/flexiapi/composer.lock b/flexiapi/composer.lock index 93cdafa..995250b 100644 --- a/flexiapi/composer.lock +++ b/flexiapi/composer.lock @@ -536,16 +536,16 @@ }, { "name": "endroid/qr-code", - "version": "4.2.2", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/endroid/qr-code.git", - "reference": "53bfce79da95bf082484301fecbc1d77a3907f78" + "reference": "98f6d4024289ad3a8d7f3e63cab947ef6929dcdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/endroid/qr-code/zipball/53bfce79da95bf082484301fecbc1d77a3907f78", - "reference": "53bfce79da95bf082484301fecbc1d77a3907f78", + "url": "https://api.github.com/repos/endroid/qr-code/zipball/98f6d4024289ad3a8d7f3e63cab947ef6929dcdb", + "reference": "98f6d4024289ad3a8d7f3e63cab947ef6929dcdb", "shasum": "" }, "require": { @@ -596,7 +596,7 @@ ], "support": { "issues": "https://github.com/endroid/qr-code/issues", - "source": "https://github.com/endroid/qr-code/tree/4.2.2" + "source": "https://github.com/endroid/qr-code/tree/4.3.0" }, "funding": [ { @@ -604,7 +604,7 @@ "type": "github" } ], - "time": "2021-08-16T22:08:35+00:00" + "time": "2021-08-28T12:29:40+00:00" }, { "name": "erusev/parsedown", @@ -716,31 +716,26 @@ }, { "name": "graham-campbell/result-type", - "version": "v1.0.1", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb" + "reference": "84afea85c6841deeea872f36249a206e878a5de0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/7e279d2cd5d7fbb156ce46daada972355cea27bb", - "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/84afea85c6841deeea872f36249a206e878a5de0", + "reference": "84afea85c6841deeea872f36249a206e878a5de0", "shasum": "" }, "require": { - "php": "^7.0|^8.0", - "phpoption/phpoption": "^1.7.3" + "php": "^7.0 || ^8.0", + "phpoption/phpoption": "^1.8" }, "require-dev": { - "phpunit/phpunit": "^6.5|^7.5|^8.5|^9.0" + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { "psr-4": { "GrahamCampbell\\ResultType\\": "src/" @@ -753,7 +748,7 @@ "authors": [ { "name": "Graham Campbell", - "email": "graham@alt-three.com" + "email": "hello@gjcampbell.co.uk" } ], "description": "An Implementation Of The Result Type", @@ -766,7 +761,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.1" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.2" }, "funding": [ { @@ -778,7 +773,7 @@ "type": "tidelift" } ], - "time": "2020-04-13T13:17:36+00:00" + "time": "2021-08-28T21:34:50+00:00" }, { "name": "guzzlehttp/guzzle", @@ -983,16 +978,16 @@ }, { "name": "laravel/framework", - "version": "v8.55.0", + "version": "v8.58.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "997e2aa23e9103137715018ae926c52f8a1703f2" + "reference": "1b819bf99d87bd543a4d4895e5b3350f61ea7a23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/997e2aa23e9103137715018ae926c52f8a1703f2", - "reference": "997e2aa23e9103137715018ae926c52f8a1703f2", + "url": "https://api.github.com/repos/laravel/framework/zipball/1b819bf99d87bd543a4d4895e5b3350f61ea7a23", + "reference": "1b819bf99d87bd543a4d4895e5b3350f61ea7a23", "shasum": "" }, "require": { @@ -1147,7 +1142,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-08-17T14:13:34+00:00" + "time": "2021-08-31T13:55:57+00:00" }, { "name": "laravel/tinker", @@ -1638,16 +1633,16 @@ }, { "name": "nesbot/carbon", - "version": "2.52.0", + "version": "2.53.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe" + "reference": "875f62a876f476d8a6040381e4b2673b3d4a28fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/369c0e2737c56a0f39c946dd261855255a6fccbe", - "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/875f62a876f476d8a6040381e4b2673b3d4a28fe", + "reference": "875f62a876f476d8a6040381e4b2673b3d4a28fe", "shasum": "" }, "require": { @@ -1659,7 +1654,7 @@ }, "require-dev": { "doctrine/orm": "^2.7", - "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", @@ -1728,7 +1723,7 @@ "type": "tidelift" } ], - "time": "2021-08-14T19:10:52+00:00" + "time": "2021-09-06T07:30:54+00:00" }, { "name": "nikic/php-parser", @@ -1954,29 +1949,29 @@ }, { "name": "phpoption/phpoption", - "version": "1.7.5", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525" + "reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525", - "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/5455cb38aed4523f99977c4a12ef19da4bfe2a28", + "reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0" + "php": "^7.0 || ^8.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -1995,7 +1990,7 @@ }, { "name": "Graham Campbell", - "email": "graham@alt-three.com" + "email": "hello@gjcampbell.co.uk" } ], "description": "Option Type for PHP", @@ -2007,7 +2002,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.7.5" + "source": "https://github.com/schmittjoh/php-option/tree/1.8.0" }, "funding": [ { @@ -2019,7 +2014,7 @@ "type": "tidelift" } ], - "time": "2020-07-20T17:29:33+00:00" + "time": "2021-08-28T21:27:29+00:00" }, { "name": "psr/container", @@ -2645,16 +2640,16 @@ }, { "name": "symfony/console", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2" + "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/51b71afd6d2dc8f5063199357b9880cea8d8bfe2", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2", + "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", + "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", "shasum": "" }, "require": { @@ -2724,7 +2719,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.6" + "source": "https://github.com/symfony/console/tree/v5.3.7" }, "funding": [ { @@ -2740,7 +2735,7 @@ "type": "tidelift" } ], - "time": "2021-07-27T19:10:22+00:00" + "time": "2021-08-25T20:02:16+00:00" }, { "name": "symfony/css-selector", @@ -2877,16 +2872,16 @@ }, { "name": "symfony/error-handler", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "281f6c4660bcf5844bb0346fe3a4664722fe4c73" + "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/281f6c4660bcf5844bb0346fe3a4664722fe4c73", - "reference": "281f6c4660bcf5844bb0346fe3a4664722fe4c73", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", + "reference": "3bc60d0fba00ae8d1eaa9eb5ab11a2bbdd1fc321", "shasum": "" }, "require": { @@ -2925,7 +2920,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.3.4" + "source": "https://github.com/symfony/error-handler/tree/v5.3.7" }, "funding": [ { @@ -2941,20 +2936,20 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-28T15:07:08+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f2fd2208157553874560f3645d4594303058c4bd" + "reference": "ce7b20d69c66a20939d8952b617506a44d102130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f2fd2208157553874560f3645d4594303058c4bd", - "reference": "f2fd2208157553874560f3645d4594303058c4bd", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ce7b20d69c66a20939d8952b617506a44d102130", + "reference": "ce7b20d69c66a20939d8952b617506a44d102130", "shasum": "" }, "require": { @@ -3010,7 +3005,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.4" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.7" }, "funding": [ { @@ -3026,7 +3021,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-04T21:20:46+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -3109,16 +3104,16 @@ }, { "name": "symfony/finder", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "17f50e06018baec41551a71a15731287dbaab186" + "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/17f50e06018baec41551a71a15731287dbaab186", - "reference": "17f50e06018baec41551a71a15731287dbaab186", + "url": "https://api.github.com/repos/symfony/finder/zipball/a10000ada1e600d109a6c7632e9ac42e8bf2fb93", + "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93", "shasum": "" }, "require": { @@ -3151,7 +3146,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.4" + "source": "https://github.com/symfony/finder/tree/v5.3.7" }, "funding": [ { @@ -3167,7 +3162,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:54:19+00:00" + "time": "2021-08-04T21:20:46+00:00" }, { "name": "symfony/http-client-contracts", @@ -3249,16 +3244,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a8388f7b7054a7401997008ce9cd8c6b0ab7ac75" + "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a8388f7b7054a7401997008ce9cd8c6b0ab7ac75", - "reference": "a8388f7b7054a7401997008ce9cd8c6b0ab7ac75", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", + "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", "shasum": "" }, "require": { @@ -3302,7 +3297,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.3.6" + "source": "https://github.com/symfony/http-foundation/tree/v5.3.7" }, "funding": [ { @@ -3318,20 +3313,20 @@ "type": "tidelift" } ], - "time": "2021-07-27T17:08:17+00:00" + "time": "2021-08-27T11:20:35+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "60030f209018356b3b553b9dbd84ad2071c1b7e0" + "reference": "a3a78e37935a527b50376c22ac1cec35b57fe787" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/60030f209018356b3b553b9dbd84ad2071c1b7e0", - "reference": "60030f209018356b3b553b9dbd84ad2071c1b7e0", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a3a78e37935a527b50376c22ac1cec35b57fe787", + "reference": "a3a78e37935a527b50376c22ac1cec35b57fe787", "shasum": "" }, "require": { @@ -3341,7 +3336,7 @@ "symfony/error-handler": "^4.4|^5.0", "symfony/event-dispatcher": "^5.0", "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^5.3", + "symfony/http-foundation": "^5.3.7", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16" @@ -3414,7 +3409,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.6" + "source": "https://github.com/symfony/http-kernel/tree/v5.3.7" }, "funding": [ { @@ -3430,20 +3425,20 @@ "type": "tidelift" } ], - "time": "2021-07-29T07:06:27+00:00" + "time": "2021-08-30T12:37:19+00:00" }, { "name": "symfony/mime", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "633e4e8afe9e529e5599d71238849a4218dd497b" + "reference": "ae887cb3b044658676129f5e97aeb7e9eb69c2d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/633e4e8afe9e529e5599d71238849a4218dd497b", - "reference": "633e4e8afe9e529e5599d71238849a4218dd497b", + "url": "https://api.github.com/repos/symfony/mime/zipball/ae887cb3b044658676129f5e97aeb7e9eb69c2d8", + "reference": "ae887cb3b044658676129f5e97aeb7e9eb69c2d8", "shasum": "" }, "require": { @@ -3497,7 +3492,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.3.4" + "source": "https://github.com/symfony/mime/tree/v5.3.7" }, "funding": [ { @@ -3513,7 +3508,7 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2021-08-20T11:40:01+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4325,16 +4320,16 @@ }, { "name": "symfony/process", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d16634ee55b895bd85ec714dadc58e4428ecf030" + "reference": "38f26c7d6ed535217ea393e05634cb0b244a1967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d16634ee55b895bd85ec714dadc58e4428ecf030", - "reference": "d16634ee55b895bd85ec714dadc58e4428ecf030", + "url": "https://api.github.com/repos/symfony/process/zipball/38f26c7d6ed535217ea393e05634cb0b244a1967", + "reference": "38f26c7d6ed535217ea393e05634cb0b244a1967", "shasum": "" }, "require": { @@ -4367,7 +4362,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.4" + "source": "https://github.com/symfony/process/tree/v5.3.7" }, "funding": [ { @@ -4383,20 +4378,20 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:54:19+00:00" + "time": "2021-08-04T21:20:46+00:00" }, { "name": "symfony/routing", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "0a35d2f57d73c46ab6d042ced783b81d09a624c4" + "reference": "be865017746fe869007d94220ad3f5297951811b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/0a35d2f57d73c46ab6d042ced783b81d09a624c4", - "reference": "0a35d2f57d73c46ab6d042ced783b81d09a624c4", + "url": "https://api.github.com/repos/symfony/routing/zipball/be865017746fe869007d94220ad3f5297951811b", + "reference": "be865017746fe869007d94220ad3f5297951811b", "shasum": "" }, "require": { @@ -4457,7 +4452,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.3.4" + "source": "https://github.com/symfony/routing/tree/v5.3.7" }, "funding": [ { @@ -4473,7 +4468,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:55:36+00:00" + "time": "2021-08-04T21:42:42+00:00" }, { "name": "symfony/service-contracts", @@ -4556,16 +4551,16 @@ }, { "name": "symfony/string", - "version": "v5.3.3", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1" + "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", + "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", + "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", "shasum": "" }, "require": { @@ -4619,7 +4614,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.3" + "source": "https://github.com/symfony/string/tree/v5.3.7" }, "funding": [ { @@ -4635,20 +4630,20 @@ "type": "tidelift" } ], - "time": "2021-06-27T11:44:38+00:00" + "time": "2021-08-26T08:00:08+00:00" }, { "name": "symfony/translation", - "version": "v5.3.4", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d89ad7292932c2699cbe4af98d72c5c6bbc504c1" + "reference": "4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d89ad7292932c2699cbe4af98d72c5c6bbc504c1", - "reference": "d89ad7292932c2699cbe4af98d72c5c6bbc504c1", + "url": "https://api.github.com/repos/symfony/translation/zipball/4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6", + "reference": "4d595a6d15fd3a2c67f6f31d14d15d3b7356d7a6", "shasum": "" }, "require": { @@ -4714,7 +4709,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.3.4" + "source": "https://github.com/symfony/translation/tree/v5.3.7" }, "funding": [ { @@ -4730,7 +4725,7 @@ "type": "tidelift" } ], - "time": "2021-07-25T09:39:16+00:00" + "time": "2021-08-26T08:22:53+00:00" }, { "name": "symfony/translation-contracts", @@ -4812,16 +4807,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.3.6", + "version": "v5.3.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "3dd8ddd1e260e58ecc61bb78da3b6584b3bfcba0" + "reference": "3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3dd8ddd1e260e58ecc61bb78da3b6584b3bfcba0", - "reference": "3dd8ddd1e260e58ecc61bb78da3b6584b3bfcba0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f", + "reference": "3ad5af4aed07d0a0201bbcfc42658fe6c5b2fb8f", "shasum": "" }, "require": { @@ -4880,7 +4875,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.6" + "source": "https://github.com/symfony/var-dumper/tree/v5.3.7" }, "funding": [ { @@ -4896,7 +4891,7 @@ "type": "tidelift" } ], - "time": "2021-07-27T01:56:02+00:00" + "time": "2021-08-04T23:19:25+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -5386,16 +5381,16 @@ }, { "name": "facade/ignition", - "version": "2.11.4", + "version": "2.12.0", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "1b8d83c5dac7c5ee8429daf284ce3f19b1d17ea2" + "reference": "74dcc32a2895a126d1e5f2cd3bbab499cac66db1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/1b8d83c5dac7c5ee8429daf284ce3f19b1d17ea2", - "reference": "1b8d83c5dac7c5ee8429daf284ce3f19b1d17ea2", + "url": "https://api.github.com/repos/facade/ignition/zipball/74dcc32a2895a126d1e5f2cd3bbab499cac66db1", + "reference": "74dcc32a2895a126d1e5f2cd3bbab499cac66db1", "shasum": "" }, "require": { @@ -5458,7 +5453,7 @@ "issues": "https://github.com/facade/ignition/issues", "source": "https://github.com/facade/ignition" }, - "time": "2021-08-17T11:45:33+00:00" + "time": "2021-08-24T09:53:54+00:00" }, { "name": "facade/ignition-contracts", @@ -5515,16 +5510,16 @@ }, { "name": "filp/whoops", - "version": "2.14.0", + "version": "2.14.1", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "fdf92f03e150ed84d5967a833ae93abffac0315b" + "reference": "15ead64e9828f0fc90932114429c4f7923570cb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/fdf92f03e150ed84d5967a833ae93abffac0315b", - "reference": "fdf92f03e150ed84d5967a833ae93abffac0315b", + "url": "https://api.github.com/repos/filp/whoops/zipball/15ead64e9828f0fc90932114429c4f7923570cb1", + "reference": "15ead64e9828f0fc90932114429c4f7923570cb1", "shasum": "" }, "require": { @@ -5574,7 +5569,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.14.0" + "source": "https://github.com/filp/whoops/tree/2.14.1" }, "funding": [ { @@ -5582,7 +5577,7 @@ "type": "github" } ], - "time": "2021-07-13T12:00:00+00:00" + "time": "2021-08-29T12:00:00+00:00" }, { "name": "fzaninotto/faker", @@ -5887,16 +5882,16 @@ }, { "name": "nunomaduro/collision", - "version": "v5.8.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "0c3c393462eada1233513664e2d22bb9f69ca393" + "reference": "63456f5c3e8c4bc52bd573e5c85674d64d84fd43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/0c3c393462eada1233513664e2d22bb9f69ca393", - "reference": "0c3c393462eada1233513664e2d22bb9f69ca393", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/63456f5c3e8c4bc52bd573e5c85674d64d84fd43", + "reference": "63456f5c3e8c4bc52bd573e5c85674d64d84fd43", "shasum": "" }, "require": { @@ -5971,7 +5966,7 @@ "type": "patreon" } ], - "time": "2021-08-13T14:23:01+00:00" + "time": "2021-08-26T15:32:09+00:00" }, { "name": "phar-io/manifest", @@ -6629,16 +6624,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.8", + "version": "9.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb" + "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb", - "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", + "reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b", "shasum": "" }, "require": { @@ -6716,7 +6711,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9" }, "funding": [ { @@ -6728,7 +6723,7 @@ "type": "github" } ], - "time": "2021-07-31T15:17:34+00:00" + "time": "2021-08-31T06:47:40+00:00" }, { "name": "sebastian/cli-parser", @@ -7583,6 +7578,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { diff --git a/flexiapi/database/migrations/2021_09_06_132040_add_accounts_tombstones_table.php b/flexiapi/database/migrations/2021_09_06_132040_add_accounts_tombstones_table.php new file mode 100644 index 0000000..a8c5e37 --- /dev/null +++ b/flexiapi/database/migrations/2021_09_06_132040_add_accounts_tombstones_table.php @@ -0,0 +1,25 @@ +id(); + $table->string('username'); + $table->string('domain'); + $table->timestamps(); + + $table->unique(['username', 'domain']); + }); + } + + public function down() + { + Schema::dropIfExists('accounts_tombstones'); + } +} diff --git a/flexiapi/resources/views/api/documentation_markdown.blade.php b/flexiapi/resources/views/api/documentation_markdown.blade.php index 18d70d0..8ae1c70 100644 --- a/flexiapi/resources/views/api/documentation_markdown.blade.php +++ b/flexiapi/resources/views/api/documentation_markdown.blade.php @@ -80,7 +80,7 @@ JSON parameters: * `username` unique username, minimum 6 characters * `password` required minimum 6 characters * `algorithm` required, values can be `SHA-256` or `MD5` -* `domain` optional, the value is set to the default registration domain if not set +* `domain` **not configurable except during test deployments** the value is enforced to the default registration domain set in the global configuration * `token` the unique token #### `GET /accounts/{sip}/info` diff --git a/flexiapi/tests/Feature/AccountApiTest.php b/flexiapi/tests/Feature/AccountApiTest.php index e808041..259245f 100644 --- a/flexiapi/tests/Feature/AccountApiTest.php +++ b/flexiapi/tests/Feature/AccountApiTest.php @@ -21,6 +21,7 @@ namespace Tests\Feature; use App\Password; use App\Account; +use App\AccountTombstone; use App\ActivationExpiration; use App\Admin; use Carbon\Carbon; @@ -664,6 +665,8 @@ class AccountApiTest extends TestCase ->delete($this->route.'/'.$password->account->id) ->assertStatus(200); + $this->assertEquals(1, AccountTombstone::count()); + $this->keyAuthenticated($admin->account) ->get($this->route.'/'.$password->account->id) ->assertStatus(404); diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index 84f11e0..68ddaa1 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 99 +%define build_number 100 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager