UNPKG

@kitstack/nest-powertools

Version:

A comprehensive collection of NestJS powertools, decorators, and utilities to supercharge your backend development

36 lines (35 loc) 1.35 kB
import type { ExecutionContext } from '@nestjs/common'; import type { CustomAuthGuard, GuardRegistry } from '../types'; export declare class GuardRegistryService { private static instance; private guards; private constructor(); static getInstance(): GuardRegistryService; registerGuard(name: string, guard: CustomAuthGuard): void; getGuard(name: string): CustomAuthGuard | undefined; getAllGuards(): GuardRegistry; removeGuard(name: string): boolean; } export declare class RoleBasedGuard implements CustomAuthGuard { private allowedRoles; constructor(allowedRoles: string[]); canActivate(context: ExecutionContext, user: any): boolean; } export declare class PermissionBasedGuard implements CustomAuthGuard { private requiredPermissions; constructor(requiredPermissions: string[]); canActivate(context: ExecutionContext, user: any): boolean; } export declare class OwnershipGuard implements CustomAuthGuard { private resourceIdParam; constructor(resourceIdParam?: string); canActivate(context: ExecutionContext, user: any): boolean; } export declare class TimeBasedGuard implements CustomAuthGuard { private allowedHours; constructor(allowedHours?: { start: number; end: number; }); canActivate(context: ExecutionContext, user: any): boolean; }