feat(user) : UI archivage/désarchivage des utilisateurs côté admin
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 1m18s
Pull Request — Quality gate / Frontend (build) (pull_request) Successful in 1m29s

- badge « Archivé » et libellé barré dans la liste admin
- popup de confirmation avant archivage (rappelle que c'est réversible)
- bouton de restauration (PATCH archived:false) pour les archivés
- case « Afficher les utilisateurs archivés » (filtre ?archived=true)
- masque l'action d'archivage sur son propre compte (évite le 403)
- service users : getArchived/restore, toast remove -> users.archived
- i18n FR : clés archived/restored/badge/confirmation
This commit is contained in:
Matthieu
2026-06-26 17:06:56 +02:00
parent f221976573
commit 89ce523019
5 changed files with 167 additions and 9 deletions
+2
View File
@@ -10,6 +10,8 @@ export type UserData = {
effectivePermissions?: string[]
avatarUrl?: string | null
apiToken?: string | null
// Soft-delete flag: an archived user keeps its data but cannot log in
archived?: boolean
// HR / absence management
isEmployee?: boolean
hireDate?: string | null
+17 -2
View File
@@ -10,6 +10,13 @@ export function useUserService() {
return extractHydraMembers(data)
}
// Archived users are hidden from the default collection; an admin lists
// them explicitly via the `archived` filter (handled server-side).
async function getArchived(): Promise<UserData[]> {
const data = await api.get<HydraCollection<UserData>>('/users?archived=true')
return extractHydraMembers(data)
}
async function getById(id: number): Promise<UserData> {
return api.get<UserData>(`/users/${id}`)
}
@@ -26,11 +33,19 @@ export function useUserService() {
})
}
// Deleting a user is a soft delete server-side: the account is archived
// (kept for referential integrity) rather than removed.
async function remove(id: number): Promise<void> {
await api.delete(`/users/${id}`, {}, {
toastSuccessKey: 'users.deleted',
toastSuccessKey: 'users.archived',
})
}
return { getAll, getById, create, update, remove }
async function restore(id: number): Promise<UserData> {
return api.patch<UserData>(`/users/${id}`, { archived: false }, {
toastSuccessKey: 'users.restored',
})
}
return { getAll, getArchived, getById, create, update, remove, restore }
}