import { R as Role, c as RBACAdapter, P as Permission } from './index-CEh-y2dx.js'; /** * Get all permissions for a role * * @param role - The role name * @param adapter - RBAC adapter instance * @returns Array of permissions * * @example * ```typescript * const permissions = await getRolePermissions('admin', adapter); * console.log(permissions); // ['users.create', 'users.delete', ...] * ``` */ declare function getRolePermissions(role: Role, adapter: RBACAdapter): Promise; /** * Check if a user has a specific permission * * @param userId - User ID * @param permission - Permission to check * @param adapter - RBAC adapter instance * @returns Boolean indicating if user has permission * * @example * ```typescript * const canDelete = await hasPermission(userId, 'users.delete', adapter); * if (canDelete) { * // User can delete * } * ``` */ declare function hasPermission(userId: string, permission: Permission, adapter: RBACAdapter): Promise; /** * Check if a user has any of the specified permissions * * @param userId - User ID * @param permissions - Array of permissions to check * @param adapter - RBAC adapter instance * @returns Boolean indicating if user has at least one permission * * @example * ```typescript * const canManageUsers = await hasAnyPermission( * userId, * ['users.create', 'users.update', 'users.delete'], * adapter * ); * ``` */ declare function hasAnyPermission(userId: string, permissions: Permission[], adapter: RBACAdapter): Promise; /** * Check if a user has all of the specified permissions * * @param userId - User ID * @param permissions - Array of permissions to check * @param adapter - RBAC adapter instance * @returns Boolean indicating if user has all permissions * * @example * ```typescript * const canFullyManageUsers = await hasAllPermissions( * userId, * ['users.create', 'users.update', 'users.delete'], * adapter * ); * ``` */ declare function hasAllPermissions(userId: string, permissions: Permission[], adapter: RBACAdapter): Promise; /** * Check if a user has a specific role * * @param userId - User ID * @param role - Role to check * @param adapter - RBAC adapter instance * @returns Boolean indicating if user has role * * @example * ```typescript * const isAdmin = await hasRole(userId, 'admin', adapter); * if (isAdmin) { * // User is admin * } * ``` */ declare function hasRole(userId: string, role: Role, adapter: RBACAdapter): Promise; /** * Check if a user has any of the specified roles * * @param userId - User ID * @param roles - Array of roles to check * @param adapter - RBAC adapter instance * @returns Boolean indicating if user has at least one role * * @example * ```typescript * const canManage = await hasAnyRole(userId, ['admin', 'manager'], adapter); * ``` */ declare function hasAnyRole(userId: string, roles: Role[], adapter: RBACAdapter): Promise; /** * Require a specific permission or throw an error * * @param userId - User ID * @param permission - Permission to require * @param adapter - RBAC adapter instance * @throws Error if user lacks permission * * @example * ```typescript * // In API route * export async function POST(request: Request) { * const session = await auth(); * await requirePermission(session.user.id, 'users.create', adapter); * * // User has permission, proceed... * } * ``` */ declare function requirePermission(userId: string, permission: Permission, adapter: RBACAdapter): Promise; /** * Require a specific role or throw an error * * @param userId - User ID * @param role - Role to require * @param adapter - RBAC adapter instance * @throws Error if user lacks role * * @example * ```typescript * export async function POST(request: Request) { * const session = await auth(); * await requireRole(session.user.id, 'admin', adapter); * * // User is admin, proceed... * } * ``` */ declare function requireRole(userId: string, role: Role, adapter: RBACAdapter): Promise; /** * Require any of the specified permissions or throw an error * * @param userId - User ID * @param permissions - Array of permissions (user needs at least one) * @param adapter - RBAC adapter instance * @throws Error if user lacks all permissions */ declare function requireAnyPermission(userId: string, permissions: Permission[], adapter: RBACAdapter): Promise; /** * Require all of the specified permissions or throw an error * * @param userId - User ID * @param permissions - Array of permissions (user needs all) * @param adapter - RBAC adapter instance * @throws Error if user lacks any permission */ declare function requireAllPermissions(userId: string, permissions: Permission[], adapter: RBACAdapter): Promise; export { hasAnyPermission as a, hasAllPermissions as b, hasRole as c, hasAnyRole as d, requireRole as e, requireAnyPermission as f, getRolePermissions as g, hasPermission as h, requireAllPermissions as i, requirePermission as r };