feat(assets): add dimension analysis and authorized user previews
ci/woodpecker/push/woodpecker Pipeline was successful
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.
This commit is contained in:
+20
-18
@@ -1,25 +1,27 @@
|
||||
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: {
|
||||
userId: string;
|
||||
userName: string;
|
||||
permissionLevel: string;
|
||||
depName: string;
|
||||
roles?: string[];
|
||||
} | null;
|
||||
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);
|
||||
}
|
||||
export const AuthContext = createContext<AuthState>({ isLoading: true, isAuthenticated: false, user: null, error: null });
|
||||
export function useAuth() { return useContext(AuthContext); }
|
||||
|
||||
Reference in New Issue
Block a user