prevent demo user from being deleted
This commit is contained in:
1 parent
c70ee26c8a
commit
48848d1d43
1 file changed
+4
-1
@@ -340,7 +340,6 @@ class AuthController {
|
|||||||
if (!email) {
|
if (!email) {
|
||||||
throw new Error("No email in request");
|
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 teamId = req?.user?.teamId;
|
||||||
const userId = req?.user?._id;
|
const userId = req?.user?._id;
|
||||||
@@ -354,7 +353,11 @@ class AuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const roles = req.user.role;
|
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({
|
const result = await this.db.getMonitorsByTeamId({
|
||||||
teamId: teamId,
|
teamId: teamId,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user