import { User, Permission, PermissionCheckResult, CheckOptions } from "./types"; import { RoleManager } from "./RoleManager"; import { PolicyManager } from "./PolicyManager"; /** * Main permission engine that manages users, roles, and permissions */ export declare class PermissionEngine { private users; private roleManager; private policyManager; constructor(); /** * Gets the role manager */ get roles(): RoleManager; /** * Gets the policy manager */ get policies(): PolicyManager; /** * Adds a user to the system */ addUser(user: User): void; /** * Gets a user by ID */ getUser(userId: string): User | undefined; /** * Removes a user */ removeUser(userId: string): boolean; /** * Updates a user */ updateUser(userId: string, updates: Partial): boolean; /** * Assigns a role to a user */ assignRole(userId: string, roleId: string): boolean; /** * Removes a role from a user */ removeRole(userId: string, roleId: string): boolean; /** * Gets all permissions for a user (from roles and direct permissions) */ getUserPermissions(userId: string): Permission[]; /** * Checks if a user has permission to perform an action on a resource (async version) */ checkPermissionAsync(userId: string, resource: string, action: string, options?: CheckOptions): Promise; /** * Checks if a user has permission to perform an action on a resource (sync version) * Note: This only works with synchronous conditions. Use checkPermissionAsync for async conditions. */ checkPermission(userId: string, resource: string, action: string, options?: CheckOptions): PermissionCheckResult; /** * Checks if a user has all specified permissions (async) */ checkAllPermissionsAsync(userId: string, checks: Array<{ resource: string; action: string; }>, options?: CheckOptions): Promise; /** * Checks if a user has any of the specified permissions (async) */ checkAnyPermissionAsync(userId: string, checks: Array<{ resource: string; action: string; }>, options?: CheckOptions): Promise; /** * Checks if a user has all specified permissions (sync) */ checkAllPermissions(userId: string, checks: Array<{ resource: string; action: string; }>, options?: CheckOptions): PermissionCheckResult; /** * Checks if a user has any of the specified permissions (sync) */ checkAnyPermission(userId: string, checks: Array<{ resource: string; action: string; }>, options?: CheckOptions): PermissionCheckResult; /** * Checks if a permission matches a resource and action */ private permissionMatches; /** * Checks if permission conditions match the context (sync) */ private conditionsMatch; /** * Checks if permission conditions match the context (async) */ private conditionsMatchAsync; /** * Grants a direct permission to a user */ grantPermission(userId: string, permission: Permission): boolean; /** * Revokes a direct permission from a user */ revokePermission(userId: string, resource: string, action: string): boolean; /** * Clears all data */ clear(): void; } //# sourceMappingURL=PermissionEngine.d.ts.map