This commit is contained in:
Matthias Hochmeister
2026-03-13 15:09:43 +01:00
parent 7833dca29c
commit 20d2c9093a
4 changed files with 52 additions and 6 deletions

View File

@@ -61,7 +61,7 @@ import {
function useCanWrite(): boolean {
const { user } = useAuth();
const groups: string[] = (user as any)?.groups ?? [];
return groups.includes('feuerwehr-admin') || groups.includes('feuerwehr-kommandant');
return groups.includes('dashboard_admin') || groups.includes('dashboard_kommando');
}
function useCurrentUserId(): string | undefined {
@@ -473,11 +473,36 @@ function MitgliedDetail() {
</Box>
{!profile && (
<Alert severity="info" sx={{ mt: 2 }}>
<Alert
severity="info"
sx={{ mt: 2 }}
action={
canWrite ? (
<Button
color="inherit"
size="small"
disabled={saving}
onClick={async () => {
if (!userId) return;
setSaving(true);
setSaveError(null);
try {
await membersService.createMemberProfile(userId, { status: 'aktiv' });
await loadMember();
} catch {
setSaveError('Profil konnte nicht erstellt werden.');
} finally {
setSaving(false);
}
}}
>
{saving ? <CircularProgress size={16} /> : 'Profil erstellen'}
</Button>
) : undefined
}
>
Für dieses Mitglied wurde noch kein Profil angelegt.
{canWrite
? ' Ein Kommandant kann das Profil unter "Stammdaten" erstellen.'
: ' Wende dich an einen Administrator, um dein Profil anlegen zu lassen.'}
{!canWrite && ' Wende dich an einen Administrator, um dein Profil anlegen zu lassen.'}
</Alert>
)}

View File

@@ -53,7 +53,7 @@ import {
function useCanWrite(): boolean {
const { user } = useAuth();
const groups: string[] = (user as any)?.groups ?? [];
return groups.includes('feuerwehr-admin') || groups.includes('feuerwehr-kommandant');
return groups.includes('dashboard_admin') || groups.includes('dashboard_kommando');
}
// ----------------------------------------------------------------