@rbac/rbac
Version:
Blazing Fast, Zero dependency, Hierarchical Role-Based Access Control for Node.js
25 lines (24 loc) • 757 B
TypeScript
import type { Role, Roles } from '../types';
import type { RoleAdapter } from './adapter';
export interface MongoAdapterOptions {
uri: string;
dbName: string;
collection: string;
columns?: {
name?: string;
role?: string;
tenantId?: string;
};
}
export declare class MongoRoleAdapter<P = unknown> implements RoleAdapter<P> {
private options;
private client;
private db?;
private collectionName;
private defaultTenant;
constructor(options: MongoAdapterOptions);
private getCollection;
getRoles(tenantId?: string): Promise<Roles<P>>;
addRole(roleName: string, role: Role<P>, tenantId?: string): Promise<void>;
updateRoles(roles: Roles<P>, tenantId?: string): Promise<void>;
}