ci/woodpecker/push/woodpecker Pipeline was successful
Refactor asset drilldowns with combined dimension filters, parent summaries and progressive loading. Add the hidden /who read-only permission preview with scoped authorization, identity mapping and audit logging. Refine inventory counts and AI问数 presentation.
28 lines
837 B
TypeScript
28 lines
837 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
export interface AuthUser {
|
|
userId: string;
|
|
userName: string;
|
|
loginName?: string;
|
|
permissionLevel: string;
|
|
depCode?: string;
|
|
depName: string;
|
|
roles?: string[];
|
|
}
|
|
export interface AuthState {
|
|
isLoading: boolean;
|
|
isAuthenticated: boolean;
|
|
user: AuthUser | null;
|
|
error: string | null;
|
|
actor?: AuthUser | null;
|
|
canPreview?: boolean;
|
|
preview?: { user: AuthUser; expiresAt: string } | null;
|
|
identityVersion?: number;
|
|
previewNotice?: string | null;
|
|
startPreview?: (userId: string) => Promise<void>;
|
|
stopPreview?: () => Promise<void>;
|
|
clearPreviewNotice?: () => void;
|
|
}
|
|
export const AuthContext = createContext<AuthState>({ isLoading: true, isAuthenticated: false, user: null, error: null });
|
|
export function useAuth() { return useContext(AuthContext); }
|