mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Implemented user group permission query in the web app.
This commit is contained in:
parent
a85dc11ba3
commit
13cf8c12eb
3 changed files with 95 additions and 40 deletions
11
webserver.js
11
webserver.js
|
@ -4025,14 +4025,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
} else return 0;
|
||||
|
||||
// Check direct user to device group permissions
|
||||
var rights = 0;
|
||||
r = user.links[meshid];
|
||||
if ((r != null) && (r.rights == 0xFFFFFFFF)) { return r.rights; } // If the user has full access thru direct link, stop here.
|
||||
var rights = r.rights;
|
||||
if (r != null) {
|
||||
var rights = r.rights;
|
||||
if (rights == 0xFFFFFFFF) { return rights; } // If the user has full access thru direct link, stop here.
|
||||
}
|
||||
|
||||
// Check if we are part of any user groups that would give this user more access.
|
||||
for (var i in user.links) {
|
||||
if (i.startsWith('ugrp')) {
|
||||
const g = obj.usersGroups[i];
|
||||
const g = obj.userGroups[i];
|
||||
if (g) {
|
||||
r = g.links[meshid];
|
||||
if (r != null) {
|
||||
|
@ -4068,7 +4071,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
// Check if we are part of any user groups that would give this user visibility to this device group.
|
||||
for (var i in user.links) {
|
||||
if (i.startsWith('ugrp')) {
|
||||
const g = obj.usersGroups[i];
|
||||
const g = obj.userGroups[i];
|
||||
if (g && (g.links[meshid] != null)) { return true; } // If the user has a user group link, stop here.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue