From 48848d1d43eeaceb12aa93004d9efe3fad87d46f Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 21 Jul 2025 15:05:17 -0700 Subject: [PATCH] prevent demo user from being deleted --- server/controllers/authController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/controllers/authController.js b/server/controllers/authController.js index 1cc1a747a..ace63b662 100755 --- a/server/controllers/authController.js +++ b/server/controllers/authController.js @@ -340,7 +340,6 @@ class AuthController { if (!email) { throw new Error("No email in request"); } - // 1. Find all the monitors associated with the team ID if superadmin const teamId = req?.user?.teamId; const userId = req?.user?._id; @@ -354,7 +353,11 @@ class AuthController { } const roles = req.user.role; + if (roles.includes("demo")) { + throw new Error("Demo user cannot be deleted"); + } + // 1. Find all the monitors associated with the team ID if superadmin const result = await this.db.getMonitorsByTeamId({ teamId: teamId, });