diff --git a/meshuser.js b/meshuser.js index 73f27bdb..b790157e 100644 --- a/meshuser.js +++ b/meshuser.js @@ -487,8 +487,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Request a list of all meshes this user as rights to links = parent.GetAllMeshIdWithRights(user); - // Add any nodes with direct rights - if (obj.user.links != null) { for (var i in obj.user.links) { if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); } } } + // Add any nodes with direct rights or any nodes with user group direct rights + if (obj.user.links != null) { + for (var i in obj.user.links) { + if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); } + else if (i.startsWith('ugrp/')) { + const g = parent.userGroups[i]; + if ((g != null) && (g.links != null)) { + for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } } + } + } + } + } } else { // Request list of all nodes for one specific meshid meshid = command.meshid; diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index bc159944..e4770887 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -3539,6 +3539,13 @@ // Check direct device rights using device data if ((node.links != null) && (node.links[userid] != null)) { r |= node.links[userid].rights; } // TODO: Deal with reverse permissions + // Check direct device rights thru user groups + if ((node.links != null) && (userinfo.links != null)) { + for (var i in node.links) { + if (i.startsWith('ugrp/') && (userinfo.links[i] != null) && (node.links[i].rights != null)) { r |= node.links[i].rights; } + } + } + // Check direct device rights using user data /* if (userid == userinfo._id) { user = userinfo; } else { if (users != null) { user = users[userid]; } } diff --git a/views/default.handlebars b/views/default.handlebars index 6692398a..67a36004 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -8635,7 +8635,6 @@ QE('dp2meshid', selected == null); QE('dp2nodeid', selected == null); } else if (userid === 7) { - console.log('a1'); setDialogMode(2, (selected == null)?"Add Device Permissions":"Edit Device Permissions", 3, p20showAddMeshUserDialogEx, x, userid); QE('dp2meshid', selected == null); QE('dp2nodeid', selected == null); @@ -8739,7 +8738,6 @@ } function p20validateAddMeshUserDialog(updateId) { - console.log('p20validateAddMeshUserDialog', updateId); var ok = true; if (updateId === 4) { @@ -8871,7 +8869,7 @@ if (currentNode != null) { meshserver.send({ action: 'adddeviceuser', nodeid: currentNode._id, nodename: currentNode.name, userids: [ ugrpid ], rights: meshadmin }); } } else if (t === 7) { var nodeid = decodeURIComponent(Q('dp2nodeid').value), node = getNodeFromId(nodeid); - if (node != null) { meshserver.send({ action: 'adddeviceuser', nodeid: nodeid, nodename: node.name, userids: [ currentGroup._id ], rights: meshadmin }); } + if (node != null) { meshserver.send({ action: 'adddeviceuser', nodeid: nodeid, nodename: node.name, userids: [ currentUserGroup._id ], rights: meshadmin }); } } else { if (t == null) { var users = Q('dp20username').value.split(','), users2 = []; @@ -9762,6 +9760,15 @@ element.children[0].children[0].style['background-color'] = ((over == 0) ? '#c9c9c9' : '#b9b9b9'); } + // Highlights the user being hovered + function userMouseHover2(element, over) { + var e = element.children[0].children[0]; + e.children[1].classList.remove('g1s'); + e.children[2].classList.remove('g2s'); + if (over == 1) { e.children[1].classList.add('g1s'); e.children[2].classList.add('g2s'); } + element.children[0].children[0].style['background-color'] = ((over == 0) ? '#c9c9c9' : '#b9b9b9'); + } + function userChat(e, userid, name) { haltEvent(e); var url = '/messenger?id=meshmessenger/' + userid + '/' + encodeURIComponent(userinfo._id) + '&title=' + name; @@ -10057,7 +10064,7 @@ function addUserGroupHtml(group) { var usercount = 0, meshcount = 0; if (group.links) { for (var i in group.links) { if (i.startsWith('user/')) { usercount++; } if (i.startsWith('mesh/')) { meshcount++; } } } - var x = '