diff --git a/translate/translate.json b/translate/translate.json
index 555bef2d..4cebfd89 100644
--- a/translate/translate.json
+++ b/translate/translate.json
@@ -27645,4 +27645,4 @@
]
}
]
-}
+}
\ No newline at end of file
diff --git a/views/default.handlebars b/views/default.handlebars
index 8e0234f0..9f61c37c 100644
--- a/views/default.handlebars
+++ b/views/default.handlebars
@@ -474,6 +474,7 @@
+
@@ -5052,6 +5053,39 @@
if (lastTab != null && Q('p19ph-' + lastTab) != null) pluginHandler.callPluginPage(lastTab, Q('p19ph-' + lastTab));
}
+ // Show special user permissions
+ x = '';
+ if (urlargs.dp == 1) { // For testing only
+ x += ' ' + "Add User" + '';
+ x += '
' + "Special Permissions" + '
';
+ var count = 1;
+ if (currentNode.links != null) {
+ // Sort the list of users to display
+ var useridlist = [];
+ for (var i in currentNode.links) { if (i.startsWith('user/')) { useridlist.push(i); } }
+ useridlist.sort();
+ for (var i in useridlist) {
+ var trash = '', rights = '', userid = useridlist[i], srights = currentNode.links[userid].rights, rights = "Some Added Rights", username = userid.split('/')[2];
+ if ((users != null) && (users[userid] != null)) { username = users[userid].name; }
+
+ /*
+ var node = nodelist[i], r = currentUser.links[node._id].rights, trash = '', rights = "Partial Device Rights", cr = GetNodeRights(node);
+ if ((userinfo.links) && (userinfo.links[i] != null) && (userinfo.links[i].rights != null)) { cr = userinfo.links[i].rights; }
+ var nodename = node?EscapeHtml(node.name):('' + "Unknown Device" + '');
+ */
+ if (srights == 0xFFFFFFFF) rights = "Full Device Rights"; else if (srights == 0) rights = "No Added Rights";
+ if ((meshrights & 2) != 0) {
+ rights = '
' + rights + '
';
+ trash = '';
+ }
+ x += '
' + username + '
' + trash + '
' + rights + '
';
+ }
+ }
+ if (count == 1) { x += '
' + "No users with special device permissions" + '
'; }
+ x += '
';
+ }
+ QH('p10html4', x);
+
// Change the URL
var urlviewmode = '';
if ((xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) {
@@ -5220,6 +5254,7 @@
++count;
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
}
+
QH('p10html2', '
' + "Day" + '
' + "7 Day Power State" + '
' + x + '
');
}
@@ -8411,8 +8446,8 @@
function p20showAddMeshUserDialog(userid, selected) {
if (xxdialogMode) return false;
var x = '';
- if (userid == null) {
- x += "Allow users to manage this device group and devices in this group.";
+ if ((userid == null) || (userid == 5)) {
+ if (userid == null) { x += "Allow users to manage this device group and devices in this group."; } else { x += "Allow users to manage this device."; }
if (features & 0x00080000) { x += " Users need to login to this server once before they can be added to a device group." }
x += '
';
x += addHtmlValue("User Names", '');
@@ -8452,7 +8487,7 @@
}
}
x += '
';
- if (userid != 4) {
+ if ((userid != 4) && (userid != 5)) {
x += ' ';
x += ' ';
x += ' ';
@@ -8486,6 +8521,9 @@
setDialogMode(2, (selected == null)?"Add Device Permissions":"Edit Device Permissions", 3, p20showAddMeshUserDialogEx, x, userid);
QE('dp2meshid', selected == null);
QE('dp2nodeid', selected == null);
+ } else if (userid === 5) {
+ setDialogMode(2, "Add Users to Device", 3, p20showAddMeshUserDialogEx, x, userid);
+ Q('dp20username').focus();
} else {
if (userid.startsWith('ugrp/')) {
setDialogMode(2, "Edit Device Group Permissions", 7, p20showAddMeshUserDialogEx, x, userid);
@@ -8661,6 +8699,10 @@
} else if (t === 4) {
var nodeid = decodeURIComponent(Q('dp2nodeid').value), node = getNodeFromId(nodeid);
if (node != null) { meshserver.send({ action: 'adddeviceuser', nodeid: nodeid, nodename: node.name, userids: [ currentUser._id ], rights: meshadmin }); }
+ } else if (t === 5) {
+ var users = Q('dp20username').value.split(','), users2 = [];
+ for (var i in users) { users2.push(users[i].trim()); }
+ meshserver.send({ action: 'adddeviceuser', nodeid: currentNode._id, nodename: currentNode.name, usernames: users2, rights: meshadmin });
} else {
if (t == null) {
var users = Q('dp20username').value.split(','), users2 = [];
@@ -10302,12 +10344,14 @@
function p30removeNodeFromUser(event, nodeid) {
if (xxdialogMode) return;
- var node = getNodeFromId(decodeURIComponent(nodeid))
- setDialogMode(2, "Remove User", 3, p30removeNodeFromUserEx, format("Confirm removal of device {0}?", node.name), node);
+ var node = getNodeFromId(decodeURIComponent(nodeid));
+ setDialogMode(2, "Remove Device", 3, function(b, node) { meshserver.send({ action: 'adddeviceuser', nodeid: node._id, nodename: node.name, userids: [ currentUser._id ], rights: 0 }); }, format("Confirm removal of device {0}?", node.name), node);
}
- function p30removeNodeFromUserEx(b, node) {
- meshserver.send({ action: 'adddeviceuser', nodeid: node._id, nodename: node.name, userids: [ currentUser._id ], rights: 0 });
+ function p30removeUserFromNode(event, userid) {
+ if (xxdialogMode) return;
+ var user = users[decodeURIComponent(userid)];
+ setDialogMode(2, "Remove User", 3, function(b, user) { meshserver.send({ action: 'adddeviceuser', nodeid: currentNode._id, nodename: currentNode.name, userids: [ user._id ], rights: 0 }); }, format("Confirm removal of user {0}?", user.name), user);
}
function p30RemoveUserGroup(button, ugrpid) {