feat: super admin promote/demote endpoint + admin panel UI

Fix require_engineer_or_admin missing "admin" account_role, add
PUT /admin/users/{id}/super-admin endpoint with audit logging,
and promote/demote button with confirmation modal on UserDetailPage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-24 23:05:42 -05:00
parent 645e86301b
commit 9dc667eb3c
4 changed files with 111 additions and 1 deletions

View File

@@ -38,6 +38,8 @@ export const adminApi = {
api.put(`/admin/users/${id}/role`, { role }).then(r => r.data),
updateAccountRole: (id: string, account_role: string) =>
api.put(`/admin/users/${id}/account-role`, { account_role }).then(r => r.data),
updateSuperAdminStatus: (id: string, is_super_admin: boolean) =>
api.put(`/admin/users/${id}/super-admin`, { is_super_admin }).then(r => r.data),
deactivateUser: (id: string) =>
api.put(`/admin/users/${id}/deactivate`).then(r => r.data),
activateUser: (id: string) =>