mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-26 07:57:56 +03:00
MongoDB change stream now updates memory objects.
This commit is contained in:
parent
eb6396705d
commit
7529dce77b
14
db.js
14
db.js
@ -812,6 +812,13 @@ module.exports.CreateDB = function (parent, func) {
|
||||
// Called when a device group has changed
|
||||
function dbMeshChange(meshChange, added) {
|
||||
const mesh = meshChange.fullDocument;
|
||||
|
||||
// Update the mesh object in memory
|
||||
const mmesh = parent.webserver.meshes[mesh._id];
|
||||
for (var i in mesh) { mmesh[i] = mesh[i]; }
|
||||
for (var i in mmesh) { if (mesh[i] == null) { delete mmesh[i]; } }
|
||||
|
||||
// Send the mesh update
|
||||
if (mesh.deleted) { mesh.action = 'deletemesh'; } else { mesh.action = (added ? 'createmesh' : 'meshchange'); }
|
||||
mesh.meshid = mesh._id;
|
||||
mesh.nolog = 1;
|
||||
@ -823,6 +830,13 @@ module.exports.CreateDB = function (parent, func) {
|
||||
// Called when a user account has changed
|
||||
function dbUserChange(userChange, added) {
|
||||
const user = userChange.fullDocument;
|
||||
|
||||
// Update the user object in memory
|
||||
const muser = parent.webserver.users[user._id];
|
||||
for (var i in user) { muser[i] = user[i]; }
|
||||
for (var i in muser) { if (user[i] == null) { delete muser[i]; } }
|
||||
|
||||
// Send the user update
|
||||
parent.DispatchEvent(['*', 'server-users', user._id], obj, { etype: 'user', username: user.name, account: parent.webserver.CloneSafeUser(user), action: (added ? 'accountcreate' : 'accountchange'), domain: user.domain, nolog: 1 });
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.3.5-p",
|
||||
"version": "0.3.5-r",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
Loading…
Reference in New Issue
Block a user