mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-06 08:40:06 -05:00
fix getDeviceDetails asking for all devices not including lastconnect #6833
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
b2cd84035b
commit
9398afd07e
13
meshuser.js
13
meshuser.js
@ -5077,9 +5077,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids
|
if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids
|
||||||
if (common.validateString(command.type, 3, 4) == false) break; // Check type
|
if (common.validateString(command.type, 3, 4) == false) break; // Check type
|
||||||
|
|
||||||
|
const links = parent.GetAllMeshIdWithRights(user);
|
||||||
|
const extraids = getUserExtraIds();
|
||||||
|
db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, obj.deviceSkip, obj.deviceLimit, function (err, docs) {
|
||||||
|
if (docs == null) return;
|
||||||
|
const ids = [];
|
||||||
|
if (command.nodeids != null) {
|
||||||
// Create a list of node ids and query them for last device connection time
|
// Create a list of node ids and query them for last device connection time
|
||||||
const ids = []
|
|
||||||
for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); }
|
for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); }
|
||||||
|
} else {
|
||||||
|
// Create a list of node ids for this user and query them for last device connection time
|
||||||
|
for (var i in docs) { ids.push('lc' + docs[i]._id); }
|
||||||
|
}
|
||||||
db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) {
|
db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) {
|
||||||
const lastConnects = {};
|
const lastConnects = {};
|
||||||
if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } }
|
if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } }
|
||||||
@ -5355,7 +5364,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { }
|
try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'endDesktopMultiplex': {
|
case 'endDesktopMultiplex': {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user