T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.ca/private_html/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/private_html/scripts/test-all-dashboards.js
const { PrismaClient } = require('@prisma/client');

const prisma = new PrismaClient();

async function testAllDashboards() {
  try {
    console.log('๐Ÿงช Testing All Dashboard Access for SUPERADMIN...\n');

    // Get SUPERADMIN user
    const superAdmin = await prisma.user.findFirst({
      where: {
        role: 'SUPERADMIN'
      },
      select: {
        id: true,
        name: true,
        email: true,
        role: true
      }
    });

    if (!superAdmin) {
      console.log('โŒ No SUPERADMIN found in database');
      return;
    }

    console.log(`๐Ÿ‘‘ SUPERADMIN Found: ${superAdmin.name} (${superAdmin.email})`);

    // Test all dashboard routes
    const dashboardRoutes = [
      // Super Admin Routes
      { path: '/admin/super', name: 'Super Admin Dashboard', access: 'SUPERADMIN' },
      { path: '/admin/dashboard', name: 'Admin Dashboard', access: 'ADMIN+' },
      { path: '/admin/index', name: 'Admin Index', access: 'ADMIN+' },
      { path: '/admin/inde2', name: 'Admin Index 2', access: 'ADMIN+' },
      
      // User Management
      { path: '/admin/users', name: 'User Management', access: 'ADMIN+' },
      { path: '/admin/make-admin', name: 'Make Admin', access: 'ADMIN+' },
      
      // Case Management
      { path: '/admin/case-assignments', name: 'Case Assignments', access: 'ADMIN+' },
      { path: '/admin/case-management', name: 'Case Management', access: 'ADMIN+' },
      
      // Analytics & Monitoring
      { path: '/admin/analytics-dashboard', name: 'Analytics Dashboard', access: 'ADMIN+' },
      { path: '/admin/notifications', name: 'Notifications', access: 'ADMIN+' },
      { path: '/admin/newsletter', name: 'Newsletter', access: 'ADMIN+' },
      
      // System Management
      { path: '/admin/business-profiles', name: 'Business Profiles', access: 'ADMIN+' },
      { path: '/admin/system-automation', name: 'System Automation', access: 'ADMIN+' },
      { path: '/admin/options', name: 'System Options', access: 'ADMIN+' },
      
      // Lawyer Routes
      { path: '/lawyer/dashboard', name: 'Lawyer Dashboard', access: 'LAWYER+' },
      { path: '/lawyer/cases', name: 'Lawyer Cases', access: 'LAWYER+' },
      { path: '/lawyer/clients', name: 'Lawyer Clients', access: 'LAWYER+' },
      { path: '/lawyer/consultations', name: 'Lawyer Consultations', access: 'LAWYER+' },
      { path: '/lawyer/team', name: 'Lawyer Team', access: 'LAWYER+' },
      { path: '/lawyer/analytics', name: 'Lawyer Analytics', access: 'LAWYER+' },
      { path: '/lawyer/calendar', name: 'Lawyer Calendar', access: 'LAWYER+' },
      
      // Client Routes
      { path: '/client/dashboard', name: 'Client Dashboard', access: 'CLIENT' },
      
      // User Routes
      { path: '/user/dashboard', name: 'User Dashboard', access: 'USER+' },
      { path: '/user/profile', name: 'User Profile', access: 'USER+' },
      { path: '/user/business-profile', name: 'Business Profile', access: 'USER+' },
      { path: '/user/business-analytics', name: 'Business Analytics', access: 'USER+' },
      { path: '/user/subscription', name: 'Subscription', access: 'USER+' },
      
      // Hire Routes
      { path: '/hire/case-selection', name: 'Case Selection', access: 'PUBLIC' },
      { path: '/hire/consultation', name: 'Book Consultation', access: 'PUBLIC' },
      { path: '/hire/case-offer', name: 'Case Offer', access: 'PUBLIC' },
      { path: '/hire/new-case', name: 'New Case', access: 'PUBLIC' },
      { path: '/hire/retainer', name: 'Retainer', access: 'PUBLIC' },
      
      // Public Routes
      { path: '/', name: 'Home Page', access: 'PUBLIC' },
      { path: '/about', name: 'About', access: 'PUBLIC' },
      { path: '/contact', name: 'Contact', access: 'PUBLIC' },
      { path: '/faq', name: 'FAQ', access: 'PUBLIC' },
      { path: '/resources', name: 'Resources', access: 'PUBLIC' },
      { path: '/class-action', name: 'Class Action', access: 'PUBLIC' },
      { path: '/who', name: 'Who We Are', access: 'PUBLIC' },
      { path: '/terms', name: 'Terms', access: 'PUBLIC' },
      { path: '/privacy-policy', name: 'Privacy Policy', access: 'PUBLIC' },
      { path: '/accessibility', name: 'Accessibility', access: 'PUBLIC' },
      { path: '/cookie-policy', name: 'Cookie Policy', access: 'PUBLIC' },
      { path: '/legal-notice', name: 'Legal Notice', access: 'PUBLIC' }
    ];

    console.log('\n๐Ÿ“‹ Dashboard Access Summary:');
    console.log('=' .repeat(80));

    let accessibleCount = 0;
    let totalCount = dashboardRoutes.length;

    for (const route of dashboardRoutes) {
      const canAccess = canSuperAdminAccess(route.access);
      const status = canAccess ? 'โœ…' : 'โŒ';
      const accessLevel = route.access;
      
      console.log(`${status} ${route.name.padEnd(25)} | ${route.path.padEnd(30)} | ${accessLevel}`);
      
      if (canAccess) accessibleCount++;
    }

    console.log('=' .repeat(80));
    console.log(`๐Ÿ“Š Summary: ${accessibleCount}/${totalCount} dashboards accessible to SUPERADMIN`);

    // Test specific functionality
    console.log('\n๐Ÿ” Testing Specific Features:');

    // Test case selection population
    const cases = await prisma.legalCase.count();
    console.log(`   ๐Ÿ“‹ Cases in database: ${cases}`);

    const clients = await prisma.user.count({ where: { role: 'CLIENT' } });
    console.log(`   ๐Ÿ‘ฅ Clients in database: ${clients}`);

    const lawyers = await prisma.user.count({ where: { role: 'LAWYER' } });
    console.log(`   โš–๏ธ Lawyers in database: ${lawyers}`);

    const registrations = await prisma.registration.count();
    console.log(`   ๐Ÿ“ Registrations: ${registrations}`);

    const assignments = await prisma.caseAssignment.count();
    console.log(`   ๐Ÿ”— Case Assignments: ${assignments}`);

    // Test client-case relationships
    const clientCaseLinks = await prisma.registration.findMany({
      where: {
        userId: { not: null }
      },
      include: {
        user: {
          select: { name: true, email: true }
        },
        legalCase: {
          select: { caseNumber: true, title: true }
        }
      }
    });

    console.log(`\n๐Ÿ‘ฅ Client-Case Relationships:`);
    clientCaseLinks.forEach(link => {
      console.log(`   ๐Ÿ‘ค ${link.user?.name} โ†’ ${link.legalCase?.caseNumber || 'N/A'}: ${link.legalCase?.title || 'Unknown Case'}`);
    });

    console.log('\n๐ŸŽฏ Quick Access URLs:');
    console.log('   ๐ŸŒ HTTPS: https://localhost:3443');
    console.log('   ๐ŸŒ HTTP:  http://localhost:3000');
    console.log('\n   ๐Ÿ‘‘ Super Admin: https://localhost:3443/admin/super');
    console.log('   โš–๏ธ Lawyer: https://localhost:3443/lawyer/dashboard');
    console.log('   ๐Ÿ‘ค Client: https://localhost:3443/client/dashboard');
    console.log('   ๐Ÿ‘ฅ User: https://localhost:3443/user/dashboard');
    console.log('   ๐Ÿ“‹ Case Selection: https://localhost:3443/hire/case-selection');

    console.log('\nโœ… All dashboard testing completed!');
    console.log('\n๐ŸŽ‰ You can now access all dashboards as SUPERADMIN!');

  } catch (error) {
    console.error('โŒ Error testing dashboards:', error);
  } finally {
    await prisma.$disconnect();
  }
}

function canSuperAdminAccess(accessLevel) {
  switch (accessLevel) {
    case 'SUPERADMIN':
      case 'SUPERADMIN':
      case 'SUPERADMIN':
    case 'ADMIN+':
    case 'LAWYER+':
    case 'USER+':
    case 'PUBLIC':
      return true;
    case 'CLIENT':
      return true; // SUPERADMIN can access client features
    default:
      return false;
  }
}

// Run the test
testAllDashboards(); 

CasperSecurity Mini