fix adding meshes and user groups in a peering environment (#6534)

This commit is contained in:
ijustw0rkhere 2024-11-15 16:54:28 -05:00 committed by GitHub
parent 727080ab68
commit 3da60b43ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

26
db.js
View File

@ -4089,12 +4089,13 @@ module.exports.CreateDB = function (parent, func) {
} }
// Send the mesh update // Send the mesh update
if (mesh.deleted) { mesh.action = 'deletemesh'; } else { mesh.action = (added ? 'createmesh' : 'meshchange'); } var mesh2 = Object.assign({}, mesh); // Shallow clone
mesh.meshid = mesh._id; if (mesh2.deleted) { mesh2.action = 'deletemesh'; } else { mesh2.action = (added ? 'createmesh' : 'meshchange'); }
mesh.nolog = 1; mesh2.meshid = mesh2._id;
delete mesh.type; mesh2.nolog = 1;
delete mesh._id; delete mesh2.type;
parent.DispatchEvent(['*', mesh.meshid], obj, parent.webserver.CloneSafeMesh(mesh)); delete mesh2._id;
parent.DispatchEvent(['*', mesh2.meshid], obj, parent.webserver.CloneSafeMesh(mesh2));
} }
// Called when a user account has changed // Called when a user account has changed
@ -4138,12 +4139,13 @@ module.exports.CreateDB = function (parent, func) {
} }
// Send the user group update // Send the user group update
usergroup.action = (added ? 'createusergroup' : 'usergroupchange'); var usergroup2 = Object.assign({}, usergroup); // Shallow clone
usergroup.ugrpid = usergroup._id; usergroup2.action = (added ? 'createusergroup' : 'usergroupchange');
usergroup.nolog = 1; usergroup2.ugrpid = usergroup2._id;
delete usergroup.type; usergroup2.nolog = 1;
delete usergroup._id; delete usergroup2.type;
parent.DispatchEvent(['*', usergroup.ugrpid], obj, usergroup); delete usergroup2._id;
parent.DispatchEvent(['*', usergroup2.ugrpid], obj, usergroup2);
} }
function dbMergeSqlArray(arr) { function dbMergeSqlArray(arr) {