@compugit/react-rbac
Version:
A comprehensive Role-Based Access Control (RBAC) library for React applications with support for groups, roles, permissions, and protected components
24 lines (23 loc) • 876 B
TypeScript
import type React from "react";
import type { User, RBACConfig, Permission, Role, Group } from "../types/rbac";
interface RBACState extends RBACConfig {
initialized: boolean;
}
interface RBACContextType extends RBACState {
setUser: (user: User | null) => void;
setLoading: (loading: boolean) => void;
setError: (error: string | null) => void;
updateUserPermissions: (permissions: Permission[]) => void;
updateUserRoles: (roles: Role[]) => void;
updateUserGroups: (groups: Group[]) => void;
clearAuth: () => void;
refreshUser: () => Promise<void>;
}
interface RBACProviderProps {
children: React.ReactNode;
onUserLoad?: () => Promise<User | null>;
onRefreshUser?: () => Promise<User | null>;
}
export declare const RBACProvider: React.FC<RBACProviderProps>;
export declare const useRBACContext: () => RBACContextType;
export {};