Ensure the admin user always has full access to manage the application

Fixes admin role assignment, adds SQL scripts for manual correction, and provides debugging tools for production issues.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 4b008663-bd72-492b-b0b6-fa252367e730
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/4b008663-bd72-492b-b0b6-fa252367e730/nHdBv6m
This commit is contained in:
michaelschal committed 2025-07-19 15:50:22 +00:00
1 parent a1ff814f6b
commit 87722d8132
6 files changed
+180

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
# CORRECTION URGENTE ADMIN PRODUCTION
## Problème identifié
- En production: Utilisateur admin ID 3 avec rôle "admin" au lieu de "administrator"
- Logs montrent: `{"id":3,"username":"admin","email":"admin@exampl...`
## Solutions appliquées
### 1. Correction automatique (déjà ajoutée au code)
Le fichier `server/storage.ts` contient maintenant une correction automatique qui se déclenche au démarrage.
### 2. Correction manuelle SQL (si nécessaire)
**Commande Docker pour production:**
```bash
docker exec regisflow-regisflow-1 psql -U regisflow -d regisflow -f /app/force-admin-correction.sql
```
**Ou commande SQL directe:**
```bash
docker exec regisflow-regisflow-1 psql -U regisflow -d regisflow -c "UPDATE users SET role = 'administrator' WHERE username = 'admin';"
```
### 3. Vérification
```bash
docker exec regisflow-regisflow-1 psql -U regisflow -d regisflow -c "SELECT id, username, role FROM users WHERE username = 'admin';"
```
## Résultats attendus
Après correction, l'onglet "Administration" apparaîtra dans l'interface utilisateur.
## Si le problème persiste
1. Redémarrer le container: `docker restart regisflow-regisflow-1`
2. Vider le cache navigateur
3. Se reconnecter avec admin/admin123