UNPKG

@mamoorali295/rbac

Version:

Complete RBAC (Role-Based Access Control) system for Node.js with Express middleware, NestJS integration, GraphQL support, MongoDB & PostgreSQL support, modern admin dashboard, TypeScript support, and dynamic permission management

66 lines (65 loc) 1.94 kB
/** * @fileoverview Core RBAC functionality without Express dependencies * * This module provides the core RBAC functionality that works with any framework, * including the database operations and user management without Express middleware. */ import { RBACConfig } from './types'; import { DatabaseAdapter } from './adapters/DatabaseAdapter'; /** * Core RBAC system without Express dependencies. * Provides database operations and user management for any framework. */ declare class CoreRBACSystem { private _config; private _initialized; private _dbAdapter; /** * Initialize the RBAC system with the provided configuration. */ init(config: RBACConfig): Promise<void>; private ensureInitialized; /** * Manually register a user in the RBAC system. */ registerUserManual(user_id: string, userData: { name?: string; email?: string; }): Promise<void>; /** * Update user information in the RBAC system. */ updateUser(user_id: string, userData: { name?: string; email?: string; }): Promise<void>; /** * Assign a role to a user in the RBAC system. */ assignRole(user_id: string, roleName: string): Promise<void>; /** * Get the role name assigned to a user. */ getUserRole(user_id: string): Promise<string | null>; /** * Get all permissions a user has for a specific feature. */ getFeaturePermissions(user_id: string, featureName: string): Promise<string[]>; /** * Get access to the database adapter for advanced operations. */ get dbAdapter(): DatabaseAdapter | null; /** * Get configuration */ get config(): RBACConfig | null; /** * Check if system is initialized */ get initialized(): boolean; } /** * Core RBAC instance for framework-agnostic usage */ export declare const CoreRBAC: CoreRBACSystem; export {};