1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed server file permissions for device groups, #3294

This commit is contained in:
Ylian Saint-Hilaire 2021-11-25 09:26:25 -08:00
parent 48f6d1e251
commit b0726e9a13
2 changed files with 17 additions and 26 deletions

View file

@ -7050,20 +7050,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if (i.startsWith('mesh/')) {
// Grant access to a device group thru a direct link
const m = obj.meshes[i];
if ((m) && (m.deleted == null) && ((rights == null) || ((user.links[i].rights & rights) != 0))) {
if (r.indexOf(m) == -1) { r.push(m); }
}
if ((m) && (r.indexOf(m) == -1) && (m.deleted == null) && ((rights == null) || ((user.links[i].rights & rights) != 0))) { r.push(m); }
} else if (i.startsWith('ugrp/')) {
// Grant access to a device group thru a user group
const g = obj.userGroups[i];
if (g && (g.links != null) && ((rights == null) || ((user.links[i].rights & rights) != 0))) {
for (var j in g.links) {
if (j.startsWith('mesh/')) {
const m = obj.meshes[j];
if ((m) && (m.deleted == null)) {
if (r.indexOf(m) == -1) { r.push(m); }
}
}
for (var j in g.links) {
if (j.startsWith('mesh/') && ((rights == null) || ((g.links[j].rights != null) && (g.links[j].rights & rights) != 0))) {
const m = obj.meshes[j];
if ((m) && (m.deleted == null) && (r.indexOf(m) == -1)) { r.push(m); }
}
}
}