nuxt-users
Version:
A comprehensive user management module for Nuxt 3 and Nuxt 4 applications with authentication, authorization, database support, and CLI tools
25 lines (24 loc) • 1.1 kB
TypeScript
import type { Permission } from '../../types.js';
/**
* Checks if a path matches a pattern (supports wildcards)
* @param path - The path to check
* @param pattern - The pattern to match against (supports * wildcard)
* @returns true if the path matches the pattern
*/
export declare const pathMatchesPattern: (path: string, pattern: string) => boolean;
/**
* Checks if a user has permission to access a specific path with a given method
* @param userRole - The user's role
* @param path - The path being accessed
* @param method - The HTTP method being used
* @param permissions - The permissions configuration
* @returns true if the user has permission
*/
export declare const hasPermission: (userRole: string, path: string, method: string, permissions: Record<string, (string | Permission)[]>) => boolean;
/**
* Checks if a path is accessible without authentication
* @param path - The path being accessed
* @param whitelist - Array of whitelisted paths
* @returns true if the path is whitelisted
*/
export declare const isWhitelisted: (path: string, whitelist: string[]) => boolean;