feat: phase 4 - frontend groups UI, permission-matrix, usePermission hook, field-level permissions tab, authStore permissions

This commit is contained in:
Agent Zero
2026-07-15 23:27:11 +02:00
parent beaca24480
commit bb6466b53d
7 changed files with 1055 additions and 30 deletions
+15
View File
@@ -14,6 +14,9 @@ export interface User {
role: string;
avatar_url: string | null;
tenants: Tenant[];
permissions?: string[];
is_system_admin?: boolean;
field_permissions?: Record<string, any>;
}
export interface AuthState {
@@ -26,6 +29,7 @@ export interface AuthState {
setAuthenticated: (authed: boolean) => void;
setLoading: (loading: boolean) => void;
setError: (error: string | null) => void;
setPermissions: (perms: string[], isSystemAdmin: boolean, fieldPerms: Record<string, any>) => void;
logout: () => void;
}
@@ -45,6 +49,17 @@ export const useAuthStore = create<AuthState>((set) => ({
setAuthenticated: (authed) => set({ isAuthenticated: authed }),
setLoading: (loading) => set({ isLoading: loading }),
setError: (error) => set({ error }),
setPermissions: (perms, isSystemAdmin, fieldPerms) =>
set((state) => ({
user: state.user
? {
...state.user,
permissions: perms,
is_system_admin: isSystemAdmin,
field_permissions: fieldPerms,
}
: null,
})),
logout: () =>
set({
user: null,