mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 13:38:15 +02:00
Fix director role access when no groups are assigned
Resolve issue where directors without assigned groups were returned all groups, by returning an empty array instead. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 28b81ac1-a55f-409c-b6a9-88ad420d8a9a Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/28b81ac1-a55f-409c-b6a9-88ad420d8a9a/6PoDWd4
This commit is contained in:
1 parent
90cec2124f
commit
1fc793d710
1 file changed
+8
@@ -102,6 +102,14 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
filteredGroupsCount: userGroups.length,
|
filteredGroupsCount: userGroups.length,
|
||||||
groups: userGroups.map((g: any) => ({ id: g.id, name: g.name }))
|
groups: userGroups.map((g: any) => ({ id: g.id, name: g.name }))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// CRITICAL: Si un directeur n'a aucun groupe assigné, retourner un tableau vide
|
||||||
|
// au lieu de tous les groupes
|
||||||
|
if (user.role === 'directeur' && userGroups.length === 0) {
|
||||||
|
console.log('🚨 [CRITICAL] Directeur has no assigned groups - returning empty array');
|
||||||
|
return res.json([]);
|
||||||
|
}
|
||||||
|
|
||||||
res.json(userGroups);
|
res.json(userGroups);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in new issue
Block a user