test(user) : couvre le soft-delete + désarchivage admin et corrige les retours de review
- ajoute des tests fonctionnels (archive au DELETE, exclusion de la
collection, listing/désarchivage admin, anti-auto-archivage) et un test
unitaire du ArchivedUserChecker
- expose un filtre BooleanFilter `archived` + bypass admin dans
ExcludeArchivedUserExtension pour lister les archivés (?archived=true)
- rend `archived` modifiable par un admin (groupe user:write + ApiProperty
ROLE_ADMIN) → désarchivage possible via PATCH /api/users/{id}
- RestoreMissingUsersCommand : ne compte que les insertions réelles
(ON CONFLICT DO NOTHING n'est plus comptabilisé à tort)
- relève memory_limit des tests à 512M (boot sérialiseur API Platform)
This commit is contained in:
@@ -102,7 +102,7 @@ final class RestoreMissingUsersCommand extends Command
|
||||
$created = 0;
|
||||
|
||||
foreach ($missingIds as $id) {
|
||||
$this->connection->executeStatement(
|
||||
$inserted = $this->connection->executeStatement(
|
||||
<<<'SQL'
|
||||
INSERT INTO "user"
|
||||
(id, username, first_name, last_name, roles, password, created_at,
|
||||
@@ -122,8 +122,14 @@ final class RestoreMissingUsersCommand extends Command
|
||||
'password' => $hash,
|
||||
],
|
||||
);
|
||||
++$created;
|
||||
$io->writeln(sprintf(' ✓ user #%d recreated (archived)', $id));
|
||||
|
||||
// ON CONFLICT may have skipped an already-present row — only count real inserts.
|
||||
if ($inserted > 0) {
|
||||
++$created;
|
||||
$io->writeln(sprintf(' ✓ user #%d recreated (archived)', $id));
|
||||
} else {
|
||||
$io->writeln(sprintf(' • user #%d already present — skipped', $id));
|
||||
}
|
||||
}
|
||||
|
||||
$io->success(sprintf('%d user(s) restored as archived. References are valid again — no data lost.', $created));
|
||||
|
||||
Reference in New Issue
Block a user