feat: add About Me dialog showing user info, roles, and groups
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m48s
CI / docker (push) Successful in 1m45s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 37s

- Add GET /api/v1/auth/me endpoint returning current user's UserDetail
- Add AboutMeDialog component with role badges and group memberships
- Add userMenuItems prop to TopBar via design-system update
- Wire "About Me" menu item into user dropdown above Logout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-08 12:12:29 +02:00
parent a8b977a2db
commit 448a63adc9
7 changed files with 213 additions and 7 deletions

View File

@@ -0,0 +1,48 @@
import { useQuery } from '@tanstack/react-query';
import { config } from '../../config';
import { useAuthStore } from '../../auth/auth-store';
export interface RoleSummary {
id: string;
name: string;
system: boolean;
source: string;
}
export interface GroupSummary {
id: string;
name: string;
}
export interface UserDetail {
userId: string;
provider: string;
email: string;
displayName: string;
createdAt: string;
directRoles: RoleSummary[];
directGroups: GroupSummary[];
effectiveRoles: RoleSummary[];
effectiveGroups: GroupSummary[];
}
async function fetchMe(): Promise<UserDetail> {
const token = useAuthStore.getState().accessToken;
const res = await fetch(`${config.apiBaseUrl}/auth/me`, {
headers: {
...(token ? { Authorization: `Bearer ${token}` } : {}),
'X-Cameleer-Protocol-Version': '1',
},
});
if (!res.ok) throw new Error(`API error: ${res.status}`);
return res.json();
}
export function useMe(enabled = false) {
return useQuery({
queryKey: ['auth', 'me'],
queryFn: fetchMe,
enabled,
staleTime: 30_000,
});
}