'use client' import React from 'react' import type { UserRole } from '../_types' import { formatDate, apiFetch } from '../_api' import { UserRoleLookup } from './UserRoleLookup' interface Props { userRoles: UserRole[] onOpenAssign: () => void onRevoke: (userId: string, roleId: string) => void setUserRoles: (rows: UserRole[]) => void setLoading: (v: boolean) => void setError: (msg: string | null) => void } export function UsersTab({ userRoles, onOpenAssign, onRevoke, setUserRoles, setLoading, setError }: Props) { return (

Benutzer-Rollen

{/* User ID lookup */}
{ setLoading(true) apiFetch(`user-roles/${userId}`) .then(data => setUserRoles(Array.isArray(data) ? data : data.roles || [])) .catch(e => setError(e instanceof Error ? e.message : 'Fehler')) .finally(() => setLoading(false)) }} />
{userRoles.length === 0 ? ( ) : userRoles.map(ur => ( ))}
User-ID Rolle Namespace Ablauf Aktionen
Keine Rollen zugewiesen
{ur.user_id} {ur.role_name || ur.role_id} {ur.namespace_id || 'Global'} {ur.expires_at ? formatDate(ur.expires_at) : 'Unbegrenzt'}
) }