update
This commit is contained in:
@@ -18,6 +18,16 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import { adminApi } from '../../services/admin';
|
||||
import type { UserOverview } from '../../types/admin.types';
|
||||
|
||||
function getRoleFromGroups(groups: string[] | null): string {
|
||||
if (!groups) return 'Mitglied';
|
||||
if (groups.includes('dashboard_admin')) return 'Admin';
|
||||
if (groups.includes('dashboard_kommando')) return 'Kommandant';
|
||||
if (groups.includes('dashboard_gruppenfuehrer')) return 'Gruppenführer';
|
||||
if (groups.includes('dashboard_moderator')) return 'Moderator';
|
||||
if (groups.includes('dashboard_atemschutz')) return 'Atemschutz';
|
||||
return 'Mitglied';
|
||||
}
|
||||
|
||||
type SortKey = 'name' | 'email' | 'role' | 'is_active' | 'last_login_at';
|
||||
type SortDir = 'asc' | 'desc';
|
||||
|
||||
@@ -145,9 +155,9 @@ function UserOverviewTab() {
|
||||
<TableCell>{user.email}</TableCell>
|
||||
<TableCell>
|
||||
<Chip
|
||||
label={user.role}
|
||||
label={getRoleFromGroups(user.groups)}
|
||||
size="small"
|
||||
color={user.role === 'admin' ? 'error' : 'default'}
|
||||
color={getRoleFromGroups(user.groups) === 'Admin' ? 'error' : 'default'}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
|
||||
Reference in New Issue
Block a user