import { SupabaseClient, User } from '@supabase/supabase-js'; export interface ServerRbacUser extends User { role?: string; roleLevel?: number; permissions?: string[]; context?: Record; } /** * Server-side RBAC utilities for Next.js App Router * These functions run on the server and have access to cookies */ export declare class ServerRbac { private supabase; constructor(supabase: SupabaseClient); /** * Get the current user with RBAC data from JWT claims */ getCurrentUser(): Promise; /** * Check if the current user has a specific role */ hasRole(roles: string | string[]): Promise; /** * Check if the current user has minimum role level */ hasRoleLevel(minLevel: number): Promise; /** * Check if the current user has a specific permission */ hasPermission(permission: string): Promise; /** * Check if the current user has all specified permissions */ hasAllPermissions(permissions: string[]): Promise; /** * Check if the current user has any of the specified permissions */ hasAnyPermission(permissions: string[]): Promise; /** * Check context (e.g., country, team_id) */ checkContext(key: string, value: string): Promise; /** * Require authentication or throw */ requireAuth(): Promise; /** * Require specific role or throw */ requireRole(roles: string | string[]): Promise; /** * Require minimum role level or throw */ requireRoleLevel(minLevel: number): Promise; /** * Require specific permission or throw */ requirePermission(permission: string): Promise; /** * Require all specified permissions or throw */ requireAllPermissions(permissions: string[]): Promise; /** * Require specific context or throw */ requireContext(key: string, value: string): Promise; /** * Get all users with a specific role (admin function) */ getUsersByRole(roleName: string): Promise; /** * Get all available roles (admin function) */ getAllRoles(): Promise; /** * Assign role to user (admin function) */ assignRole(userId: string, roleName: string, context?: Record, expiresAt?: string | null): Promise; /** * Revoke role from user (admin function) */ revokeRole(userId: string, roleName: string): Promise; } /** * Create a server-side RBAC instance for Next.js App Router * This should be used in Server Components and API routes */ export declare function createServerRbac(supabaseUrl: string, supabaseAnonKey: string): Promise; /** * Convenience function to get server RBAC with existing Supabase client */ export declare function getServerRbac(supabase: SupabaseClient): ServerRbac; //# sourceMappingURL=rbacServer.d.ts.map