mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-31 09:43:40 -04:00
Fix for #2485
This commit is contained in:
parent
46622192e8
commit
2ded4c60d5
26
meshuser.js
26
meshuser.js
@ -4216,20 +4216,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
{
|
{
|
||||||
// Check if this user has rights on this nodeid
|
// Check if this user has rights on this nodeid
|
||||||
if (common.validateString(command.nodeid, 1, 1024) == false) break; // Check nodeid
|
if (common.validateString(command.nodeid, 1, 1024) == false) break; // Check nodeid
|
||||||
db.Get(command.nodeid, function (err, nodes) { // TODO: Make a NodeRights(user) method that also does not do a db call if agent is connected (???)
|
parent.GetNodeWithRights(domain, user, command.nodeid, function (node, rights, visible) {
|
||||||
if ((err == null) && (nodes.length == 1)) {
|
if ((node == null) || ((rights & MESHRIGHT_REMOTECONTROL) == 0) || (visible == false)) return; // Access denied.
|
||||||
if ((parent.GetMeshRights(user, nodes[0].meshid) & MESHRIGHT_REMOTECONTROL) != 0) {
|
|
||||||
// Add a user authentication cookie to a url
|
// Add a user authentication cookie to a url
|
||||||
var cookieContent = { userid: user._id, domainid: user.domain };
|
var cookieContent = { userid: user._id, domainid: user.domain };
|
||||||
if (command.nodeid) { cookieContent.nodeid = command.nodeid; }
|
if (command.nodeid) { cookieContent.nodeid = command.nodeid; }
|
||||||
if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want to agent to TCP connect to a remote address
|
if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want to agent to TCP connect to a remote address
|
||||||
if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want to agent to TCP connect to a remote port
|
if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want to agent to TCP connect to a remote port
|
||||||
if (command.ip) { cookieContent.ip = command.ip; } // Indicates the browser want to agent to relay a TCP connection to a IP:port
|
if (command.ip) { cookieContent.ip = command.ip; } // Indicates the browser want to agent to relay a TCP connection to a IP:port
|
||||||
command.cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey);
|
command.cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey);
|
||||||
command.trustedCert = parent.isTrustedCert(domain);
|
command.trustedCert = parent.isTrustedCert(domain);
|
||||||
try { ws.send(JSON.stringify(command)); } catch (ex) { }
|
try { ws.send(JSON.stringify(command)); } catch (ex) { }
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user