mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-23 20:53:15 -05:00
Fixed self device group permission change and agent group uninstall.
This commit is contained in:
parent
74539037da
commit
288e42ad2c
16
meshuser.js
16
meshuser.js
@ -1838,6 +1838,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
for (var i in command.usernames) {
|
for (var i in command.usernames) {
|
||||||
// Check if the user exists
|
// Check if the user exists
|
||||||
var newuserid = 'user/' + domain.id + '/' + command.usernames[i].toLowerCase(), newuser = parent.users[newuserid];
|
var newuserid = 'user/' + domain.id + '/' + command.usernames[i].toLowerCase(), newuser = parent.users[newuserid];
|
||||||
|
if (newuserid == obj.user._id) { continue; } // Can't add or modify self
|
||||||
if (newuser != null) {
|
if (newuser != null) {
|
||||||
// Add mesh to user
|
// Add mesh to user
|
||||||
if (newuser.links == null) newuser.links = {};
|
if (newuser.links == null) newuser.links = {};
|
||||||
@ -1872,18 +1873,19 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
{
|
{
|
||||||
var err = null;
|
var err = null;
|
||||||
try {
|
try {
|
||||||
if (common.validateString(command.userid, 1, 1024) == false) { err = 'Invalid userid'; } // Check userid
|
if (common.validateString(command.userid, 1, 1024) == false) { err = "Invalid userid"; } // Check userid
|
||||||
if (common.validateString(command.meshid, 1, 1024) == false) { err = 'Invalid groupid'; } // Check meshid
|
if (common.validateString(command.meshid, 1, 1024) == false) { err = "Invalid groupid"; } // Check meshid
|
||||||
if (command.userid.indexOf('/') == -1) { command.userid = 'user/' + domain.id + '/' + command.userid; }
|
if (command.userid.indexOf('/') == -1) { command.userid = 'user/' + domain.id + '/' + command.userid; }
|
||||||
if ((command.userid.split('/').length != 3) || (command.userid.split('/')[1] != domain.id)) { err = 'Invalid userid'; } // Invalid domain, operation only valid for current domain
|
if (command.userid == obj.user._id) { err = "Can't remove self"; } // Can't add of modify self
|
||||||
|
if ((command.userid.split('/').length != 3) || (command.userid.split('/')[1] != domain.id)) { err = "Invalid userid"; } // Invalid domain, operation only valid for current domain
|
||||||
else {
|
else {
|
||||||
if (command.meshid.indexOf('/') == -1) { command.meshid = 'mesh/' + domain.id + '/' + command.meshid; }
|
if (command.meshid.indexOf('/') == -1) { command.meshid = 'mesh/' + domain.id + '/' + command.meshid; }
|
||||||
mesh = parent.meshes[command.meshid];
|
mesh = parent.meshes[command.meshid];
|
||||||
if (mesh == null) { err = 'Unknown device group'; }
|
if (mesh == null) { err = "Unknown device group"; }
|
||||||
else if (mesh.links[user._id] == null || ((mesh.links[user._id].rights & 2) == 0)) { err = 'Permission denied'; }
|
else if (mesh.links[user._id] == null || ((mesh.links[user._id].rights & 2) == 0)) { err = "Permission denied"; }
|
||||||
else if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) { err = 'Invalid domain'; } // Invalid domain, operation only valid for current domain
|
else if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) { err = "Invalid domain"; } // Invalid domain, operation only valid for current domain
|
||||||
}
|
}
|
||||||
} catch (ex) { err = 'Validation exception: ' + ex; }
|
} catch (ex) { err = "Validation exception: " + ex; }
|
||||||
|
|
||||||
// Handle any errors
|
// Handle any errors
|
||||||
if (err != null) {
|
if (err != null) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.4.3-f",
|
"version": "0.4.3-g",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
@ -2349,11 +2349,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function groupActionFunction() {
|
function groupActionFunction() {
|
||||||
var addedOptions = '';
|
var addedOptions = '', nodeids = getCheckedDevices();
|
||||||
|
|
||||||
// Check if any of the selected devices have a MQTT connection active
|
// Check if any of the selected devices have a MQTT connection active
|
||||||
if (features & 0x00400000) {
|
if (features & 0x00400000) {
|
||||||
var nodeids = getCheckedDevices();
|
|
||||||
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Send MQTT Message" + '</option>'; break; } }
|
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Send MQTT Message" + '</option>'; break; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3331,11 +3331,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function groupActionFunction() {
|
function groupActionFunction() {
|
||||||
var addedOptions = '';
|
var addedOptions = '', nodeids = getCheckedDevices();
|
||||||
|
|
||||||
// Check if any of the selected devices have a MQTT connection active
|
// Check if any of the selected devices have a MQTT connection active
|
||||||
if (features & 0x00400000) {
|
if (features & 0x00400000) {
|
||||||
var nodeids = getCheckedDevices();
|
|
||||||
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Send MQTT Message" + '</option>'; break; } }
|
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Send MQTT Message" + '</option>'; break; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2349,11 +2349,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function groupActionFunction() {
|
function groupActionFunction() {
|
||||||
var addedOptions = '';
|
var addedOptions = '', nodeids = getCheckedDevices();
|
||||||
|
|
||||||
// Check if any of the selected devices have a MQTT connection active
|
// Check if any of the selected devices have a MQTT connection active
|
||||||
if (features & 0x00400000) {
|
if (features & 0x00400000) {
|
||||||
var nodeids = getCheckedDevices();
|
|
||||||
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Envoyer un Message MQTT" + '</option>'; break; } }
|
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Envoyer un Message MQTT" + '</option>'; break; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3329,11 +3329,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function groupActionFunction() {
|
function groupActionFunction() {
|
||||||
var addedOptions = '';
|
var addedOptions = '', nodeids = getCheckedDevices();
|
||||||
|
|
||||||
// Check if any of the selected devices have a MQTT connection active
|
// Check if any of the selected devices have a MQTT connection active
|
||||||
if (features & 0x00400000) {
|
if (features & 0x00400000) {
|
||||||
var nodeids = getCheckedDevices();
|
|
||||||
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Envoyer un Message MQTT" + '</option>'; break; } }
|
for (var i in nodeids) { if ((getNodeFromId(nodeids[i]).conn & 16) != 0) { addedOptions += '<option value=103>' + "Envoyer un Message MQTT" + '</option>'; break; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user