1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fix for #2663. Invitation codes are removed for deleted device groups.

This commit is contained in:
Ylian Saint-Hilaire 2021-05-21 09:01:06 -07:00
parent 76fde352f6
commit 29e30504f0
3 changed files with 8 additions and 2 deletions

View file

@ -3113,6 +3113,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
}
// Delete any invitation codes
delete mesh.invite;
// Delete all files on the server for this mesh
try {
var meshpath = parent.getServerRootFilePath(mesh);
@ -3187,7 +3190,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var dup = null;
for (var i in command.invite.codes) {
for (var j in parent.meshes) {
if ((j != command.meshid) && (parent.meshes[j].domain == domain.id) && (parent.meshes[j].invite != null) && (parent.meshes[j].invite.codes.indexOf(command.invite.codes[i]) >= 0)) { dup = command.invite.codes[i]; break; }
if ((j != command.meshid) && (parent.meshes[j].deleted == null) && (parent.meshes[j].domain == domain.id) && (parent.meshes[j].invite != null) && (parent.meshes[j].invite.codes.indexOf(command.invite.codes[i]) >= 0)) { dup = command.invite.codes[i]; break; }
}
}
if (dup != null) {