Added comprehensive authentication and authorization system: Authentication System: - Better Auth integration with session management - Login/logout pages and API routes - Middleware for route protection - Auth utilities and client libraries User Management: - User list, detail, and invite pages - User API endpoints (CRUD operations) - Session management for users - Profile settings page Role-Based Access Control: - Role management pages (list, create, edit) - Permission system with granular controls - Role assignment to users - Role API endpoints Admin Features: - Audit log page for tracking system events - Admin settings page - Audit service for logging user actions Additional Features: - Quotes management pages and components - SalesBldr API integration - Email service for notifications Configuration & Documentation: - Updated docker-compose.yml - MCP server configuration (mcp.json) - CVE-2025-55182 security review documentation - Standards guide and PRD documents - Re-enabling authentication documentation Database Migrations: - 012: Auth tables (users, sessions, accounts, verifications) - 013: Role tables (roles, permissions, role_permissions, user_roles) - 014: Admin settings table UI Updates: - Updated dashboard layout - Enhanced app layout with auth integration
41 lines
993 B
TypeScript
41 lines
993 B
TypeScript
"use client";
|
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Shield, ShieldCheck, User } from "lucide-react";
|
|
|
|
interface RoleBadgeProps {
|
|
role: string;
|
|
}
|
|
|
|
const roleConfig: Record<string, { label: string; variant: "default" | "secondary" | "destructive" | "outline"; icon: React.ReactNode }> = {
|
|
"super-admin": {
|
|
label: "Super Admin",
|
|
variant: "destructive",
|
|
icon: <ShieldCheck className="h-3 w-3 mr-1" />,
|
|
},
|
|
admin: {
|
|
label: "Admin",
|
|
variant: "default",
|
|
icon: <Shield className="h-3 w-3 mr-1" />,
|
|
},
|
|
user: {
|
|
label: "User",
|
|
variant: "secondary",
|
|
icon: <User className="h-3 w-3 mr-1" />,
|
|
},
|
|
};
|
|
|
|
export function RoleBadge({ role }: RoleBadgeProps) {
|
|
const config = roleConfig[role] || {
|
|
label: role,
|
|
variant: "outline" as const,
|
|
icon: <User className="h-3 w-3 mr-1" />,
|
|
};
|
|
|
|
return (
|
|
<Badge variant={config.variant} className="flex items-center w-fit">
|
|
{config.icon}
|
|
{config.label}
|
|
</Badge>
|
|
);
|
|
}
|