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.quebec/public_html/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/public_html/scripts/make-super-admin.ts
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

async function makeSuperAdmin(email: string) {
  try {
    console.log(`šŸ” Looking for user with email: ${email}`);
    
    const user = await prisma.user.findUnique({
      where: { email },
      select: {
        id: true,
        email: true,
        name: true,
        role: true
      }
    });

    if (!user) {
      console.error(`āŒ User with email ${email} not found!`);
      process.exit(1);
    }

    console.log(`šŸ‘¤ Found user:`, {
      id: user.id,
      email: user.email,
      name: user.name,
      currentRole: user.role
    });

    if (user.role === 'SUPERADMIN' || user.role === 'SUPERADMIN') {
      console.log(`āœ… User ${email} is already a SUPERADMIN!`);
      process.exit(0);
    }

    console.log(`šŸ”„ Promoting ${email} to SUPERADMIN...`);
    
    const updatedUser = await prisma.user.update({
      where: { email },
      data: { role: 'SUPERADMIN' },
      select: {
        id: true,
        email: true,
        name: true,
        role: true
      }
    });

    console.log(`šŸŽ‰ Successfully promoted user:`, {
      id: updatedUser.id,
      email: updatedUser.email,
      name: updatedUser.name,
      newRole: updatedUser.role
    });

    console.log(`\n✨ ${email} is now a SUPERADMIN and can:`);
    console.log(`   • Impersonate other users`);
    console.log(`   • Access all admin functions`);
    console.log(`   • Manage user roles`);
    console.log(`   • Access super admin dashboard`);

  } catch (error) {
    console.error('āŒ Error promoting user to super admin:', error);
    process.exit(1);
  } finally {
    await prisma.$disconnect();
  }
}

// Get email from command line arguments
const email = process.argv[2];

if (!email) {
  console.error('āŒ Please provide an email address!');
  console.log('Usage: npm run make-super-admin <email>');
  console.log('Example: npm run make-super-admin dannywperez@msn.com');
  process.exit(1);
}

makeSuperAdmin(email); 

CasperSecurity Mini