randydev commited on
Commit
724afa1
·
verified ·
1 Parent(s): c82fac4

Update plugins/antiban.js

Browse files
Files changed (1) hide show
  1. plugins/antiban.js +7 -0
plugins/antiban.js CHANGED
@@ -466,12 +466,15 @@ AntibanRoutes.post("/api/v1/user/ban-user", authenticateApiKey, apiLimiter, asyn
466
  return res.status(401).json({ message: "API key not found" });
467
  }
468
 
 
469
  if (existingUserKey.owner === userIdNumber) {
470
  return res.status(200).json({
471
  message: `User ${userIdNumber} cannot be banned because they created the API key`,
472
  is_ban: false
473
  });
474
  }
 
 
475
  const result = await collectionKey.find({}).toArray();
476
  let userIds = [];
477
  for (const data of result) {
@@ -479,12 +482,16 @@ AntibanRoutes.post("/api/v1/user/ban-user", authenticateApiKey, apiLimiter, asyn
479
  userIds.push(data.owner);
480
  }
481
  }
 
 
482
  if (userIds.includes(userIdNumber)) {
483
  return res.status(403).json({
484
  message: `User ${userIdNumber} cannot be banned because they created the API key`,
485
  is_ban: false
486
  });
487
  }
 
 
488
  if (protectedUsers.includes(userIdNumber)) {
489
  return res.status(403).json({
490
  message: `User ${userIdNumber} is a protected admin and cannot be banned`,
 
466
  return res.status(401).json({ message: "API key not found" });
467
  }
468
 
469
+ /*
470
  if (existingUserKey.owner === userIdNumber) {
471
  return res.status(200).json({
472
  message: `User ${userIdNumber} cannot be banned because they created the API key`,
473
  is_ban: false
474
  });
475
  }
476
+ */
477
+
478
  const result = await collectionKey.find({}).toArray();
479
  let userIds = [];
480
  for (const data of result) {
 
482
  userIds.push(data.owner);
483
  }
484
  }
485
+
486
+ /*
487
  if (userIds.includes(userIdNumber)) {
488
  return res.status(403).json({
489
  message: `User ${userIdNumber} cannot be banned because they created the API key`,
490
  is_ban: false
491
  });
492
  }
493
+ */
494
+
495
  if (protectedUsers.includes(userIdNumber)) {
496
  return res.status(403).json({
497
  message: `User ${userIdNumber} is a protected admin and cannot be banned`,