mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Fixed device chat permissions.
This commit is contained in:
parent
d1a9bd3ef4
commit
98d81ba631
2 changed files with 23 additions and 11 deletions
32
meshuser.js
32
meshuser.js
|
@ -1567,11 +1567,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
}
|
}
|
||||||
case 'meshmessenger':
|
case 'meshmessenger':
|
||||||
{
|
{
|
||||||
// Send a notification message to a user
|
|
||||||
if ((user.siteadmin & 2) == 0) break;
|
|
||||||
|
|
||||||
// Setup a user-to-user session
|
// Setup a user-to-user session
|
||||||
if (common.validateString(command.userid, 1, 2048)) {
|
if (common.validateString(command.userid, 1, 2048)) {
|
||||||
|
// Send a notification message to a user
|
||||||
|
if ((user.siteadmin & 2) == 0) break;
|
||||||
|
|
||||||
// Can only perform this operation on other users of our group.
|
// Can only perform this operation on other users of our group.
|
||||||
var chguser = parent.users[command.userid];
|
var chguser = parent.users[command.userid];
|
||||||
|
@ -1596,14 +1595,27 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
if (common.validateString(command.nodeid, 1, 2048)) {
|
if (common.validateString(command.nodeid, 1, 2048)) {
|
||||||
if (args.lanonly == true) { return; } // User-to-device chat is not support in LAN-only mode yet. We need the agent to replace the IP address of the server??
|
if (args.lanonly == true) { return; } // User-to-device chat is not support in LAN-only mode yet. We need the agent to replace the IP address of the server??
|
||||||
|
|
||||||
// Create the server url
|
// Get the device
|
||||||
var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified
|
db.Get(command.nodeid, function (err, nodes) {
|
||||||
var xdomain = (domain.dns == null) ? domain.id : '';
|
if ((nodes == null) || (nodes.length != 1)) return;
|
||||||
if (xdomain != '') xdomain += "/";
|
var node = nodes[0];
|
||||||
var url = "http" + (args.notls ? '' : 's') + "://" + parent.getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.nodeid) + "/" + encodeURIComponent(user._id) + "&title=" + encodeURIComponent(user.name);
|
|
||||||
|
|
||||||
// Create the notification message
|
// Get the mesh for this device
|
||||||
routeCommandToNode({ "action": "openUrl", "nodeid": command.nodeid, "userid": user._id, "username": user.name, "url": url });
|
mesh = parent.meshes[node.meshid];
|
||||||
|
if (mesh) {
|
||||||
|
// Check if this user has rights to do this
|
||||||
|
if (mesh.links[user._id] == null || ((mesh.links[user._id].rights & MESHRIGHT_REMOTECONTROL) == 0)) return;
|
||||||
|
|
||||||
|
// Create the server url
|
||||||
|
var httpsPort = ((args.aliasport == null) ? args.port : args.aliasport); // Use HTTPS alias port is specified
|
||||||
|
var xdomain = (domain.dns == null) ? domain.id : '';
|
||||||
|
if (xdomain != '') xdomain += "/";
|
||||||
|
var url = "http" + (args.notls ? '' : 's') + "://" + parent.getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.nodeid) + "/" + encodeURIComponent(user._id) + "&title=" + encodeURIComponent(user.name);
|
||||||
|
|
||||||
|
// Create the notification message
|
||||||
|
routeCommandToNode({ "action": "openUrl", "nodeid": command.nodeid, "userid": user._id, "username": user.name, "url": url });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.4.2-o",
|
"version": "0.4.2-p",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
|
Loading…
Reference in a new issue