From d42c54f32e0dea61c6deaac340ad1b62ac6496f8 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 29 Dec 2019 22:38:53 -0800 Subject: [PATCH] More user group UI improvements. --- common.js | 4 +- meshuser.js | 156 ++++++++++++++--- translate/translate.json | 350 ++++++++++++++++++++++++--------------- views/default.handlebars | 34 ++-- 4 files changed, 371 insertions(+), 173 deletions(-) diff --git a/common.js b/common.js index 6ad59eaf..da087727 100644 --- a/common.js +++ b/common.js @@ -149,8 +149,8 @@ module.exports.unEscapeFieldName = function (name) { if (name.indexOf('%') == -1 // Escape all links module.exports.escapeLinksFieldName = function (docx) { var doc = Object.assign({}, docx); if (doc.links != null) { doc.links = Object.assign({}, doc.links); for (var i in doc.links) { var ue = module.exports.escapeFieldName(i); if (ue !== i) { doc.links[ue] = doc.links[i]; delete doc.links[i]; } } } return doc; }; module.exports.unEscapeLinksFieldName = function (doc) { if (doc.links != null) { for (var j in doc.links) { var ue = module.exports.unEscapeFieldName(j); if (ue !== j) { doc.links[ue] = doc.links[j]; delete doc.links[j]; } } } return doc; }; -//module.exports.escapeAllLinksFieldName = function (docs) { for (var i in docs) { module.exports.escapeLinksFieldName(docs[i]); } }; -module.exports.unEscapeAllLinksFieldName = function (docs) { for (var i in docs) { docs[i] = module.exports.unEscapeLinksFieldName(docs[i]); } }; +//module.exports.escapeAllLinksFieldName = function (docs) { for (var i in docs) { module.exports.escapeLinksFieldName(docs[i]); } return docs; }; +module.exports.unEscapeAllLinksFieldName = function (docs) { for (var i in docs) { docs[i] = module.exports.unEscapeLinksFieldName(docs[i]); } return docs; }; // Validation methods module.exports.validateString = function (str, minlen, maxlen) { return ((str != null) && (typeof str == 'string') && ((minlen == null) || (str.length >= minlen)) && ((maxlen == null) || (str.length <= maxlen))); }; diff --git a/meshuser.js b/meshuser.js index 525484f4..b514c26e 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1199,9 +1199,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var err = null; try { // Broadcast a message to all currently connected users. - if ((user.siteadmin & 2) == 0) { err = 'Permission denied'; } - else if (common.validateString(command.msg, 1, 512) == false) { err = 'Message is too long'; } // Notification message is between 1 and 256 characters - } catch (ex) { err = 'Validation exception: ' + ex; } + if ((user.siteadmin & 2) == 0) { err = "Permission denied"; } + else if (common.validateString(command.msg, 1, 512) == false) { err = "Message is too long"; } // Notification message is between 1 and 256 characters + } catch (ex) { err = "Validation exception: " + ex; } // Handle any errors if (err != null) { @@ -1210,20 +1210,22 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } // Create the notification message - var notification = { action: "msg", type: "notify", domain: domain.id, "value": command.msg, "title": user.name, icon: 0, tag: "broadcast" }; + var notification = { action: 'msg', type: 'notify', domain: domain.id, value: command.msg, title: user.name, icon: 0, tag: 'broadcast' }; // Send the notification on all user sessions for this server for (var i in parent.wssessions2) { try { if (parent.wssessions2[i].domainid == domain.id) { - if ((user.groups == null) || (user.groups.length == 0)) { - // We are part of no user groups, send to everyone. - parent.wssessions2[i].send(JSON.stringify(notification)); - } else { - // We are part of user groups, only send to sessions of users in our groups. - var sessionUser = parent.users[parent.wssessions2[i].userid]; - if ((sessionUser != null) && findOne(sessionUser.groups, user.groups)) { + var sessionUser = parent.users[parent.wssessions2[i].userid]; + if ((command.target == null) || ((sessionUser.links) != null && (sessionUser.links[command.target] != null))) { + if ((user.groups == null) || (user.groups.length == 0)) { + // We are part of no user groups, send to everyone. parent.wssessions2[i].send(JSON.stringify(notification)); + } else { + // We are part of user groups, only send to sessions of users in our groups. + if ((sessionUser != null) && findOne(sessionUser.groups, user.groups)) { + parent.wssessions2[i].send(JSON.stringify(notification)); + } } } } @@ -1478,7 +1480,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Request a list of all user groups this user as rights to db.GetAllTypeNoTypeField('ugrp', domain.id, function (err, docs) { - try { ws.send(JSON.stringify({ action: 'usergroups', ugroups: docs, tag: command.tag })); } catch (ex) { } + try { ws.send(JSON.stringify({ action: 'usergroups', ugroups: common.unEscapeAllLinksFieldName(docs), tag: command.tag })); } catch (ex) { } }); break; } @@ -1493,7 +1495,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use else if ((parent.parent.mailserver != null) && (domain.auth != 'sspi') && (domain.auth != 'ldap') && (user.emailVerified !== true) && (user.siteadmin != 0xFFFFFFFF)) { err = 'Email verification required'; } // User must verify it's email first. // Create user group - else if (common.validateString(command.name, 1, 64) == false) { err = 'Invalid group name'; } // User group name is between 1 and 64 characters + else if ((common.validateString(command.name, 1, 64) == false) || (command.name.indexOf(' ') >= 0)) { err = 'Invalid group name'; } // User group name is between 1 and 64 characters else if ((command.desc != null) && (common.validateString(command.desc, 0, 1024) == false)) { err = 'Invalid group description'; } // User group description is between 0 and 1024 characters } catch (ex) { err = 'Validation exception: ' + ex; } @@ -1532,8 +1534,24 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use db.Get(command.ugrpid, function (err, groups) { if ((err != null) || (groups.length != 1)) return; - var group = groups[0]; + var group = common.unEscapeLinksFieldName(groups[0]); + + // Unlink any user that has a link to this group + if (group.links) { + for (var i in group.links) { + var xuser = parent.users[i]; + if ((xuser != null) && (xuser.links != null)) { + delete xuser.links[group._id]; + db.SetUser(xuser); + parent.parent.DispatchEvent([xuser._id], obj, 'resubscribe'); + } + } + } + + // Remove the user group from the database db.Remove(group._id); + + // Event the user group being removed var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: group._id, action: 'deleteusergroup', msg: change, domain: domain.id }; if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the mesh. Another event will come. parent.parent.DispatchEvent(['*', group._id, user._id], obj, event); @@ -1551,9 +1569,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use db.Get(command.ugrpid, function (err, groups) { if ((err != null) || (groups.length != 1)) return; - var group = groups[0], change = ''; + var group = common.unEscapeLinksFieldName(groups[0]), change = ''; - if ((common.validateString(command.name, 1, 64) == true) && (command.name != group.name)) { change = 'User group name changed from "' + group.name + '" to "' + command.name + '"'; group.name = command.name; } + if ((common.validateString(command.name, 1, 64) == true) && (command.name != group.name) && (command.name.indexOf(' ') >= 0)) { change = 'User group name changed from "' + group.name + '" to "' + command.name + '"'; group.name = command.name; } if ((common.validateString(command.desc, 0, 1024) == true) && (command.desc != group.desc)) { if (change != '') change += ' and description changed'; else change += 'User group "' + group.name + '" description changed'; group.desc = command.desc; } if (change != '') { db.Set(common.escapeLinksFieldName(group)); @@ -1566,20 +1584,108 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } case 'addusertousergroup': { - if ((user.siteadmin & SITERIGHT_USERGROUPS) == 0) { return; } + var err = null; + try { + if ((user.siteadmin & SITERIGHT_USERGROUPS) == 0) { err = 'Permission denied'; } + else if (common.validateString(command.ugrpid, 1, 1024) == false) { err = 'Invalid groupid'; } // Check the meshid + else if (common.validateStrArray(command.usernames, 1, 64) == false) { err = 'Invalid usernames'; } // Username is between 1 and 64 characters + else { + var ugroupidsplit = command.ugrpid.split('/'); + if ((ugroupidsplit.length != 3) || (ugroupidsplit[0] != 'ugrp') || (ugroupidsplit[1] != domain.id)) { err = 'Invalid groupid'; } + } + } catch (ex) { err = 'Validation exception: ' + ex; } - // Change the name or description of a user group - if (common.validateString(command.ugrpid, 1, 1024) == false) break; // Check the user group id - var ugroupidsplit = command.ugrpid.split('/'); - if ((ugroupidsplit.length != 3) || (ugroupidsplit[0] != 'ugrp') || (ugroupidsplit[1] != domain.id)) break; + // Handle any errors + if (err != null) { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'addusertousergroup', responseid: command.responseid, result: err })); } catch (ex) { } } + break; + } db.Get(command.ugrpid, function (err, groups) { - if ((err != null) || (groups.length != 1)) return; - var group = groups[0]; + if ((err != null) || (groups.length != 1)) { try { ws.send(JSON.stringify({ action: 'addusertousergroup', responseid: command.responseid, result: 'Invalid groupid' })); } catch (ex) { } return; } + var group = common.unEscapeLinksFieldName(groups[0]); + if (group.links == null) { group.links = {}; } - // TODO - console.log(command); + var unknownUsers = [], addedCount = 0, failCount = 0; + for (var i in command.usernames) { + // Check if the user exists + var newuserid = 'user/' + domain.id + '/' + command.usernames[i].toLowerCase(), newuser = parent.users[newuserid]; + if (newuser != null) { + // Add mesh to user + if (newuser.links == null) { newuser.links = {}; } + newuser.links[group._id] = { rights: 1 }; + db.SetUser(newuser); + parent.parent.DispatchEvent([newuser._id], obj, 'resubscribe'); + + // Add a user to the mesh + group.links[newuserid] = { userid: newuser.id, name: newuser.name, rights: 1 }; + db.Set(common.escapeLinksFieldName(group)); + + // Notify mesh change + var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: group._id, name: group.name, desc: group.desc, action: 'usergroupchange', links: group.links, msg: 'Added user ' + newuser.name + ' to user group ' + group.name, domain: domain.id }; + if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user group. Another event will come. + parent.parent.DispatchEvent(['*', group._id, user._id, newuserid], obj, event); + addedCount++; + } else { + unknownUsers.push(command.usernames[i]); + failCount++; + } + } + + if (unknownUsers.length > 0) { + // Send error back, user not found. + displayNotificationMessage('User' + ((unknownUsers.length > 1) ? 's' : '') + ' ' + EscapeHtml(unknownUsers.join(', ')) + ' not found.', 'Device Group', 'ServerNotify'); + } + + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'addusertousergroup', responseid: command.responseid, result: 'ok', added: addedCount, failed: failCount })); } catch (ex) { } } }); + break; + } + case 'removeuserfromusergroup': + { + var err = null; + try { + if ((user.siteadmin & SITERIGHT_USERGROUPS) == 0) { err = 'Permission denied'; } + else if (common.validateString(command.ugrpid, 1, 1024) == false) { err = 'Invalid groupid'; } + else if (common.validateString(command.userid, 1, 256) == false) { err = 'Invalid userid'; } + else { + var ugroupidsplit = command.ugrpid.split('/'); + if ((ugroupidsplit.length != 3) || (ugroupidsplit[0] != 'ugrp') || (ugroupidsplit[1] != domain.id)) { err = 'Invalid groupid'; } + } + } catch (ex) { err = 'Validation exception: ' + ex; } + + // Handle any errors + if (err != null) { + if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removeuserfromusergroup', responseid: command.responseid, result: err })); } catch (ex) { } } + break; + } + + db.Get(command.ugrpid, function (err, groups) { + if ((err != null) || (groups.length != 1)) { try { ws.send(JSON.stringify({ action: 'addusertousergroup', responseid: command.responseid, result: 'Invalid groupid' })); } catch (ex) { } return; } + var group = common.unEscapeLinksFieldName(groups[0]); + if (group.links == null) { group.links = {}; } + + // Check if the user exists + newuser = parent.users[command.userid]; + if (newuser != null) { + var change = false; + if ((newuser.links != null) && (newuser.links[command.ugrpid] != null)) { change = true; delete newuser.links[command.ugrpid]; } + db.SetUser(newuser); + parent.parent.DispatchEvent([newuser._id], obj, 'resubscribe'); + + // Remove the user from the group + if ((group.links != null) && (group.links[command.userid] != null)) { change = true; delete group.links[command.userid]; } + db.Set(common.escapeLinksFieldName(group)); + + // Notify mesh change + if (change) { + var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: group._id, name: group.name, desc: group.desc, action: 'usergroupchange', links: group.links, msg: 'Removed user ' + newuser.name + ' from user group ' + group.name, domain: domain.id }; + if (db.changeStream) { event.noact = 1; } // If DB change stream is active, don't use this event to change the user group. Another event will come. + parent.parent.DispatchEvent(['*', group._id, user._id, newuserid], obj, event); + } + } + }); + break; } case 'changemeshnotify': diff --git a/translate/translate.json b/translate/translate.json index 1628d400..65430d1d 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -178,7 +178,8 @@ "ja": " ユーザーは、デバイスグループに追加する前にこのサーバーに1回ログインする必要があります。", "nl": " Gebruikers moeten inloggen bij de server voordat ze kunnen worden toegevoegd aan een apparaatgroep.", "xloc": [ - "default.handlebars->23->1051" + "default.handlebars->23->1051", + "default.handlebars->23->1256" ] }, { @@ -391,7 +392,7 @@ "xloc": [ "default.handlebars->23->620", "default.handlebars->23->1116", - "default.handlebars->23->1284", + "default.handlebars->23->1312", "default-mobile.handlebars->9->64", "default-mobile.handlebars->9->240" ] @@ -414,7 +415,7 @@ "ja": "1つのアクティブなセッション", "nl": "1 actieve sessie", "xloc": [ - "default.handlebars->23->1268" + "default.handlebars->23->1296" ] }, { @@ -451,7 +452,7 @@ "ja": "1グループ", "nl": "1 groep", "xloc": [ - "default.handlebars->23->1252" + "default.handlebars->23->1280" ] }, { @@ -995,7 +996,7 @@ "ja": "サーバーファイルへのアクセス", "nl": "Toegang tot de server bestanden", "xloc": [ - "default.handlebars->23->1233" + "default.handlebars->23->1261" ] }, { @@ -1388,7 +1389,8 @@ "ja": "ユーザーを追加", "nl": "Gebruikers toevoegen", "xloc": [ - "default.handlebars->23->983" + "default.handlebars->23->983", + "default.handlebars->23->1241" ] }, { @@ -1448,7 +1450,7 @@ "ja": "管理レルム", "nl": "Beheerdersgebied", "xloc": [ - "default.handlebars->23->1256" + "default.handlebars->23->1284" ] }, { @@ -1601,7 +1603,7 @@ "ja": "エージェント", "nl": "Agents", "xloc": [ - "default.handlebars->23->1321" + "default.handlebars->23->1349" ] }, { @@ -1657,7 +1659,8 @@ "cs": "Umožnit uživatelům spravovat tuto skupinu a zařízení v této skupině.", "nl": "Gebruikers toestaan deze apparaatgroep en apparaten in deze groep te beheren.", "xloc": [ - "default.handlebars->23->1050" + "default.handlebars->23->1050", + "default.handlebars->23->1255" ] }, { @@ -2066,7 +2069,7 @@ "cs": "Opravdu chcete {0} zásuvný modul: {1}", "nl": "Weet u zeker dat u de plug-in {0} wilt gebruiken: {1}", "xloc": [ - "default.handlebars->23->1356" + "default.handlebars->23->1384" ] }, { @@ -2150,7 +2153,7 @@ "cs": "Aplikace pro ověřování se", "nl": "Verificatie-app", "xloc": [ - "default.handlebars->23->1257" + "default.handlebars->23->1285" ] }, { @@ -2267,6 +2270,7 @@ "default.handlebars->container->column_l->p30->1->1->0->1->p30title->1", "default.handlebars->container->column_l->p31->p31title->1", "default.handlebars->container->column_l->p43->p43BackButton", + "default.handlebars->container->column_l->p51->1->1->0->1->p30title->1", "error404.handlebars->container->footer->1->1->0->3->0", "error404-mobile.handlebars->container->footer->1->1->0->3->1", "terms.handlebars->container->footer->1->1->0->3->0", @@ -2341,7 +2345,7 @@ "cs": "Záložní kódy", "nl": "Back-up codes", "xloc": [ - "default.handlebars->23->1259" + "default.handlebars->23->1287" ] }, { @@ -2422,7 +2426,8 @@ "cs": "Hromadná zpráva", "nl": "Uitzending", "xloc": [ - "default.handlebars->container->column_l->p4->3->1->0->3->1" + "default.handlebars->container->column_l->p4->3->1->0->3->1", + "default.handlebars->23->1239" ] }, { @@ -2474,7 +2479,7 @@ "cs": "Chyba volání", "nl": "Oproepfout", "xloc": [ - "default.handlebars->23->1357" + "default.handlebars->23->1385" ] }, { @@ -2564,7 +2569,7 @@ "ja": "{0}のメールを変更", "nl": "Verander e-mail voor {0}", "xloc": [ - "default.handlebars->23->1272" + "default.handlebars->23->1300" ] }, { @@ -2587,7 +2592,7 @@ "nl": "Verander wachtwoord", "xloc": [ "default.handlebars->23->915", - "default.handlebars->23->1267", + "default.handlebars->23->1295", "default-mobile.handlebars->9->46" ] }, @@ -2609,7 +2614,7 @@ "cs": "Změnit heslo pro {0}", "nl": "Verander wachtwoord voor {0}", "xloc": [ - "default.handlebars->23->1279" + "default.handlebars->23->1307" ] }, { @@ -2733,7 +2738,7 @@ "nl": "Controleren...", "xloc": [ "default.handlebars->23->689", - "default.handlebars->23->1353" + "default.handlebars->23->1381" ] }, { @@ -2828,7 +2833,7 @@ "cs": "CIRA Server", "nl": "CIRA Server", "xloc": [ - "default.handlebars->23->1347" + "default.handlebars->23->1375" ] }, { @@ -2838,7 +2843,7 @@ "cs": "příkazy CIRA serveru", "nl": "CIRA Server opdrachten", "xloc": [ - "default.handlebars->23->1348" + "default.handlebars->23->1376" ] }, { @@ -3023,6 +3028,7 @@ "default.handlebars->23->542", "default.handlebars->23->551", "default.handlebars->23->1031", + "default.handlebars->23->1251", "default-mobile.handlebars->9->217", "default-mobile.handlebars->9->284" ] @@ -3109,6 +3115,7 @@ "nl": "Bevestig de verwijdering van gebruiker {0}?", "xloc": [ "default.handlebars->23->1097", + "default.handlebars->23->1254", "default-mobile.handlebars->9->330" ] }, @@ -3216,7 +3223,7 @@ "cs": "Počitadlo připojení", "nl": "Aantal verbindingen", "xloc": [ - "default.handlebars->23->1320" + "default.handlebars->23->1348" ] }, { @@ -3226,7 +3233,7 @@ "cs": "Předávání (relay) spojení", "nl": "Verbindings Relay", "xloc": [ - "default.handlebars->23->1346" + "default.handlebars->23->1374" ] }, { @@ -3292,7 +3299,7 @@ "cs": "Cookie enkodér", "nl": "Cookie encoder", "xloc": [ - "default.handlebars->23->1334" + "default.handlebars->23->1362" ] }, { @@ -3468,7 +3475,7 @@ "cs": "Hlavní server", "nl": "Core Server", "xloc": [ - "default.handlebars->23->1333" + "default.handlebars->23->1361" ] }, { @@ -3488,7 +3495,7 @@ "cs": "vytížení procesoru v uplynulých 15 minutách", "nl": "CPU-belasting in de afgelopen 15 minuten", "xloc": [ - "default.handlebars->23->1316" + "default.handlebars->23->1344" ] }, { @@ -3498,7 +3505,7 @@ "cs": "vyžítení procesoru v uplynulých 5 minutách", "nl": "CPU-belasting in de afgelopen 5 minuten", "xloc": [ - "default.handlebars->23->1315" + "default.handlebars->23->1343" ] }, { @@ -3508,7 +3515,7 @@ "ja": "直前のCPU負荷", "nl": "CPU-belasting in de laatste minuut", "xloc": [ - "default.handlebars->23->1314" + "default.handlebars->23->1342" ] }, { @@ -3593,7 +3600,7 @@ "cs": "Vytváření", "nl": "Aanmaken", "xloc": [ - "default.handlebars->23->1245" + "default.handlebars->23->1273" ] }, { @@ -3761,7 +3768,7 @@ "nl": "Dag", "xloc": [ "default.handlebars->23->526", - "default.handlebars->23->1281" + "default.handlebars->23->1309" ] }, { @@ -3901,7 +3908,7 @@ "ja": "ユーザーを削除{0}", "nl": "Verwijder gebruiker {0}", "xloc": [ - "default.handlebars->23->1280" + "default.handlebars->23->1308" ] }, { @@ -3981,7 +3988,10 @@ "default.handlebars->23->927", "default.handlebars->23->951", "default.handlebars->23->1034", - "default.handlebars->23->1229", + "default.handlebars->23->1232", + "default.handlebars->23->1236", + "default.handlebars->23->1238", + "default.handlebars->23->1248", "default-mobile.handlebars->9->57", "default-mobile.handlebars->9->138", "default-mobile.handlebars->9->139", @@ -4166,8 +4176,8 @@ "nl": "Apparaatgroepen", "xloc": [ "default.handlebars->container->column_l->p2->9", - "default.handlebars->23->1254", - "default.handlebars->23->1307", + "default.handlebars->23->1282", + "default.handlebars->23->1335", "default-mobile.handlebars->container->page_content->column_l->p3->p3info->1->3" ] }, @@ -4864,9 +4874,9 @@ "xloc": [ "default.handlebars->23->277", "default.handlebars->23->1203", - "default.handlebars->23->1241", - "default.handlebars->23->1242", + "default.handlebars->23->1269", "default.handlebars->23->1270", + "default.handlebars->23->1298", "default-mobile.handlebars->9->34" ] }, @@ -4888,7 +4898,7 @@ "ja": "メールが確認されました", "nl": "E-mail is geverifieerd", "xloc": [ - "default.handlebars->23->1238" + "default.handlebars->23->1266" ] }, { @@ -4908,7 +4918,7 @@ "ja": "メールが確認されていません", "nl": "E-mail is niet geverifieerd", "xloc": [ - "default.handlebars->23->1239" + "default.handlebars->23->1267" ] }, { @@ -5550,7 +5560,7 @@ "nl": "Forceer wachtwoord opnieuw instellen bij de volgende aanmelding.", "xloc": [ "default.handlebars->23->1207", - "default.handlebars->23->1277" + "default.handlebars->23->1305" ] }, { @@ -5603,8 +5613,8 @@ "cs": "Volné", "nl": "Vrij", "xloc": [ - "default.handlebars->23->1288", - "default.handlebars->23->1290" + "default.handlebars->23->1316", + "default.handlebars->23->1318" ] }, { @@ -5615,7 +5625,7 @@ "cs": "volné", "nl": "vrij", "xloc": [ - "default.handlebars->23->1318" + "default.handlebars->23->1346" ] }, { @@ -5754,7 +5764,7 @@ "ja": "完全な管理者", "nl": "Volledige beheerder", "xloc": [ - "default.handlebars->23->1234" + "default.handlebars->23->1262" ] }, { @@ -6524,8 +6534,8 @@ "xloc": [ "default.handlebars->23->1105", "default.handlebars->23->1111", - "default.handlebars->23->1325", - "default.handlebars->23->1345" + "default.handlebars->23->1353", + "default.handlebars->23->1373" ] }, { @@ -7463,7 +7473,7 @@ "ja": "最終変更:{0}", "nl": "Laatst gewijzigd: {0}", "xloc": [ - "default.handlebars->23->1250" + "default.handlebars->23->1278" ] }, { @@ -7496,7 +7506,7 @@ "cs": "Poslední přihlášení", "nl": "Laatste inlog", "xloc": [ - "default.handlebars->23->1246" + "default.handlebars->23->1274" ] }, { @@ -7596,7 +7606,7 @@ "cs": "Méně", "nl": "Minder", "xloc": [ - "default.handlebars->23->1359" + "default.handlebars->23->1387" ] }, { @@ -7956,7 +7966,7 @@ "cs": "Uzamknutý účet", "nl": "Vergrendeld account", "xloc": [ - "default.handlebars->23->1231" + "default.handlebars->23->1259" ] }, { @@ -8112,7 +8122,7 @@ "cs": "Zprávy hlavního serveru", "nl": "Hoofdserver berichten", "xloc": [ - "default.handlebars->23->1336" + "default.handlebars->23->1364" ] }, { @@ -8356,7 +8366,7 @@ "ja": "メガバイト", "nl": "Megabytes", "xloc": [ - "default.handlebars->23->1326" + "default.handlebars->23->1354" ] }, { @@ -8369,7 +8379,7 @@ "xloc": [ "default.handlebars->container->column_l->p40->3->1->p40type->3", "default.handlebars->23->70", - "default.handlebars->23->1317" + "default.handlebars->23->1345" ] }, { @@ -8440,7 +8450,7 @@ "cs": "MeshAgent provoz", "nl": "MeshAgent verkeer", "xloc": [ - "default.handlebars->23->1338" + "default.handlebars->23->1366" ] }, { @@ -8449,7 +8459,7 @@ "cs": "MeshAgent aktualizace", "nl": "MeshAgent update", "xloc": [ - "default.handlebars->23->1339" + "default.handlebars->23->1367" ] }, { @@ -8510,7 +8520,7 @@ "cs": "MeshCentral Server Peering", "nl": "MeshCentral Server Peering", "xloc": [ - "default.handlebars->23->1337" + "default.handlebars->23->1365" ] }, { @@ -8595,7 +8605,7 @@ "cs": "Odesílatel", "nl": "Bericht Dispatcher", "xloc": [ - "default.handlebars->23->1335" + "default.handlebars->23->1363" ] }, { @@ -8668,7 +8678,7 @@ "ja": "もっと", "nl": "Meer", "xloc": [ - "default.handlebars->23->1358" + "default.handlebars->23->1386" ] }, { @@ -8985,6 +8995,10 @@ "default.handlebars->23->1161", "default.handlebars->23->1202", "default.handlebars->23->1228", + "default.handlebars->23->1231", + "default.handlebars->23->1235", + "default.handlebars->23->1237", + "default.handlebars->23->1247", "default-mobile.handlebars->container->page_content->column_l->p10->p10desktop->deskarea3->deskarea3x->DeskTools->5->1->1", "default-mobile.handlebars->9->53", "default-mobile.handlebars->9->132", @@ -9249,7 +9263,7 @@ "xloc": [ "default.handlebars->23->657", "default.handlebars->23->1151", - "default.handlebars->23->1283" + "default.handlebars->23->1311" ] }, { @@ -9412,7 +9426,7 @@ "cs": "Žádná práva k serveru", "nl": "Geen server rechten", "xloc": [ - "default.handlebars->23->1232" + "default.handlebars->23->1260" ] }, { @@ -9513,8 +9527,9 @@ "default.handlebars->23->968", "default.handlebars->23->973", "default.handlebars->23->1123", - "default.handlebars->23->1251", - "default.handlebars->23->1255", + "default.handlebars->23->1234", + "default.handlebars->23->1279", + "default.handlebars->23->1283", "default-mobile.handlebars->9->72", "default-mobile.handlebars->9->90", "default-mobile.handlebars->9->92", @@ -9599,7 +9614,7 @@ "ja": "設定されていません", "nl": "Niet ingesteld", "xloc": [ - "default.handlebars->23->1237" + "default.handlebars->23->1265" ] }, { @@ -9613,7 +9628,7 @@ "default.handlebars->23->480", "default.handlebars->23->513", "default.handlebars->23->981", - "default.handlebars->23->1262" + "default.handlebars->23->1290" ] }, { @@ -9664,7 +9679,7 @@ "cs": "Upozornit", "nl": "Melden", "xloc": [ - "default.handlebars->23->1264" + "default.handlebars->23->1292" ] }, { @@ -9708,7 +9723,7 @@ "cs": "Nastalo na {0}", "nl": "Heeft plaatsgevonden op {0}", "xloc": [ - "default.handlebars->23->1286" + "default.handlebars->23->1314" ] }, { @@ -9986,7 +10001,7 @@ "cs": "Částečná práva", "nl": "Gedeeltelijke rechten", "xloc": [ - "default.handlebars->23->1235" + "default.handlebars->23->1263" ] }, { @@ -10012,10 +10027,10 @@ "default.handlebars->23->530", "default.handlebars->23->1204", "default.handlebars->23->1205", - "default.handlebars->23->1247", - "default.handlebars->23->1249", - "default.handlebars->23->1273", - "default.handlebars->23->1274", + "default.handlebars->23->1275", + "default.handlebars->23->1277", + "default.handlebars->23->1301", + "default.handlebars->23->1302", "default-mobile.handlebars->9->210" ] }, @@ -10037,7 +10052,7 @@ "cs": "Nápověda k heslu", "nl": "wachtwoord hint", "xloc": [ - "default.handlebars->23->1275" + "default.handlebars->23->1303" ] }, { @@ -10359,7 +10374,7 @@ "nl": "Plugin Actie", "xloc": [ "default.handlebars->23->171", - "default.handlebars->23->1355" + "default.handlebars->23->1383" ] }, { @@ -10819,8 +10834,8 @@ "cs": "Předávané relace", "nl": "Relay Sessies", "xloc": [ - "default.handlebars->23->1311", - "default.handlebars->23->1324" + "default.handlebars->23->1339", + "default.handlebars->23->1352" ] }, { @@ -10969,7 +10984,7 @@ "cs": "Odstranit celé 2-faktorové ověřování.", "nl": "Verwijder alle Tweestapsverificatie.", "xloc": [ - "default.handlebars->23->1278" + "default.handlebars->23->1306" ] }, { @@ -11001,7 +11016,8 @@ "cs": "Odstranit uživatelská práva pro tuto skupinu zařízení", "nl": "Gebruikersrechten voor deze apparaatgroep verwijderen", "xloc": [ - "default.handlebars->23->1000" + "default.handlebars->23->1000", + "default.handlebars->23->1243" ] }, { @@ -11042,7 +11058,7 @@ "nl": "Vereisten: {0}.", "xloc": [ "default.handlebars->23->1211", - "default.handlebars->23->1276", + "default.handlebars->23->1304", "default-mobile.handlebars->9->45" ] }, @@ -11192,7 +11208,7 @@ "ja": "制限事項", "nl": "Beperkingen", "xloc": [ - "default.handlebars->23->1236" + "default.handlebars->23->1264" ] }, { @@ -11547,7 +11563,7 @@ "xloc": [ "default.handlebars->23->238", "default.handlebars->23->531", - "default.handlebars->23->1260", + "default.handlebars->23->1288", "default-mobile.handlebars->9->211" ] }, @@ -11559,7 +11575,7 @@ "cs": "Bezpečnostní klíč", "nl": "Veiligheidssleutel", "xloc": [ - "default.handlebars->23->1258" + "default.handlebars->23->1286" ] }, { @@ -11755,7 +11771,7 @@ "cs": "Poslat upozornění uživateli", "nl": "Stuur gebruikersmelding", "xloc": [ - "default.handlebars->23->1265" + "default.handlebars->23->1293" ] }, { @@ -11804,7 +11820,7 @@ "cs": "Certifikát serveru", "nl": "Server Certificaat", "xloc": [ - "default.handlebars->23->1340" + "default.handlebars->23->1368" ] }, { @@ -11882,7 +11898,7 @@ "cs": "Kvóta serveru", "nl": "Serverquotum", "xloc": [ - "default.handlebars->23->1244" + "default.handlebars->23->1272" ] }, { @@ -11903,7 +11919,7 @@ "cs": "Práva serveru", "nl": "Serverrechten", "xloc": [ - "default.handlebars->23->1243" + "default.handlebars->23->1271" ] }, { @@ -11925,7 +11941,7 @@ "cs": "Trasování serveru", "nl": "Server traceren", "xloc": [ - "default.handlebars->23->1349" + "default.handlebars->23->1377" ] }, { @@ -11966,7 +11982,7 @@ "cs": "ServerStats.csv", "nl": "ServerStats.csv", "xloc": [ - "default.handlebars->23->1332" + "default.handlebars->23->1360" ] }, { @@ -11976,7 +11992,7 @@ "cs": "servertrace.csv", "nl": "servertrace.csv", "xloc": [ - "default.handlebars->23->1351" + "default.handlebars->23->1379" ] }, { @@ -12770,7 +12786,7 @@ "nl": "Status", "xloc": [ "default.handlebars->container->column_l->p42->p42tbl->1->0->7", - "default.handlebars->23->1271" + "default.handlebars->23->1299" ] }, { @@ -13101,7 +13117,7 @@ "cs": "V tuto chvíli zde nejsou žádná upozornění", "nl": "Er zijn momenteel geen meldingen", "xloc": [ - "default.handlebars->23->1285" + "default.handlebars->23->1313" ] }, { @@ -13266,7 +13282,7 @@ "cs": "time, conn.agent, conn.users, conn.usersessions, conn.relaysession, conn.intelamt, mem.external, mem.heapused, mem.heaptotal, mem.rss", "nl": "tijd, conn.agent, conn.gebruikers, conn.gebruikerssessies, conn.relaysessie, conn.intelamt, mem.extern, mem.heapused, mem.heaptotaal, mem.rss", "xloc": [ - "default.handlebars->23->1331" + "default.handlebars->23->1359" ] }, { @@ -13276,7 +13292,7 @@ "cs": "time, source, message", "nl": "tijd, bron, bericht", "xloc": [ - "default.handlebars->23->1350" + "default.handlebars->23->1378" ] }, { @@ -13574,7 +13590,7 @@ "ja": "合計", "nl": "totaal", "xloc": [ - "default.handlebars->23->1319" + "default.handlebars->23->1347" ] }, { @@ -13932,7 +13948,7 @@ "cs": "Aktuální", "nl": "Bijgewerkt", "xloc": [ - "default.handlebars->23->1354" + "default.handlebars->23->1382" ] }, { @@ -14067,8 +14083,8 @@ "ja": "中古", "nl": "Gebruikt", "xloc": [ - "default.handlebars->23->1287", - "default.handlebars->23->1289" + "default.handlebars->23->1315", + "default.handlebars->23->1317" ] }, { @@ -14082,6 +14098,7 @@ "default.handlebars->23->194", "default.handlebars->23->1001", "default.handlebars->23->1176", + "default.handlebars->23->1244", "default-mobile.handlebars->9->325" ] }, @@ -14149,7 +14166,7 @@ "nl": "gebruikersID", "xloc": [ "default.handlebars->23->1092", - "default.handlebars->23->1240" + "default.handlebars->23->1268" ] }, { @@ -14195,7 +14212,8 @@ "cs": "Uživatelská jména", "nl": "Gebruikersnamen", "xloc": [ - "default.handlebars->23->1052" + "default.handlebars->23->1052", + "default.handlebars->23->1257" ] }, { @@ -14205,7 +14223,7 @@ "cs": "Relace uživatele", "nl": "Gebruikerssessie", "xloc": [ - "default.handlebars->23->1323" + "default.handlebars->23->1351" ] }, { @@ -14301,7 +14319,8 @@ "nl": "Gebruikers", "xloc": [ "default.handlebars->container->topbar->1->1->UsersSubMenuSpan->UsersSubMenu->1->0->UsersGeneral", - "default.handlebars->23->1322" + "default.handlebars->23->1229", + "default.handlebars->23->1350" ] }, { @@ -14435,7 +14454,7 @@ "cs": "Zobrazit poznámky o tomto uživateli", "nl": "Bekijk opmerkingen over deze gebruiker", "xloc": [ - "default.handlebars->23->1263" + "default.handlebars->23->1291" ] }, { @@ -14555,8 +14574,8 @@ "cs": "Webový server", "nl": "webserver", "xloc": [ - "default.handlebars->23->1341", - "default.handlebars->23->1342" + "default.handlebars->23->1369", + "default.handlebars->23->1370" ] }, { @@ -14567,7 +14586,7 @@ "cs": "Požadavky webového serveru", "nl": "Webserver Verzoeken", "xloc": [ - "default.handlebars->23->1343" + "default.handlebars->23->1371" ] }, { @@ -14578,7 +14597,7 @@ "cs": "Web Socket Relay", "nl": "Web Socket Relay", "xloc": [ - "default.handlebars->23->1344" + "default.handlebars->23->1372" ] }, { @@ -14622,7 +14641,7 @@ "ja": "次回ログイン時に変更されます。", "nl": "Wordt bij de volgende aanmelding gewijzigd.", "xloc": [ - "default.handlebars->23->1248" + "default.handlebars->23->1276" ] }, { @@ -15025,7 +15044,7 @@ "cs": "{0} aktivních spojení", "nl": "{0} actieve sessies", "xloc": [ - "default.handlebars->23->1269" + "default.handlebars->23->1297" ] }, { @@ -15088,7 +15107,7 @@ "cs": "{0} skupin", "nl": "{0} groepen", "xloc": [ - "default.handlebars->23->1253" + "default.handlebars->23->1281" ] }, { @@ -15486,7 +15505,7 @@ "cs": "2-faktorové ověřování zapnuto", "nl": "Tweestapsverificatie ingeschakeld", "xloc": [ - "default.handlebars->23->1261" + "default.handlebars->23->1289" ] }, { @@ -15495,7 +15514,7 @@ "cs": "\\\\'", "nl": "\\\\'", "xloc": [ - "default.handlebars->23->1352" + "default.handlebars->23->1380" ] }, { @@ -15694,7 +15713,7 @@ "cs": "Smazat uživatele", "nl": "Verwijder gebruiker", "xloc": [ - "default.handlebars->23->1266" + "default.handlebars->23->1294" ] }, { @@ -15702,7 +15721,7 @@ "cs": "Stav přihlášení za 7 dnů", "nl": "Inlogstatus afgelopen 7 dagen", "xloc": [ - "default.handlebars->23->1282" + "default.handlebars->23->1310" ] }, { @@ -15710,7 +15729,7 @@ "cs": "Vytížení procesoru", "nl": "CPU gebruik", "xloc": [ - "default.handlebars->23->1313" + "default.handlebars->23->1341" ] }, { @@ -15718,14 +15737,14 @@ "cs": "Stav serveru", "nl": "Server Status", "xloc": [ - "default.handlebars->23->1291" + "default.handlebars->23->1319" ] }, { "en": "Agent Error Counters", "cs": "Počitadla chyb agenta", "xloc": [ - "default.handlebars->23->1292" + "default.handlebars->23->1320" ] }, { @@ -15733,7 +15752,7 @@ "cs": "Neznámá skupina", "nl": "Onbekende groep", "xloc": [ - "default.handlebars->23->1293" + "default.handlebars->23->1321" ] }, { @@ -15741,7 +15760,7 @@ "cs": "Neplatný PKCS podpis", "nl": "Onjuiste PKCS handtekening", "xloc": [ - "default.handlebars->23->1294" + "default.handlebars->23->1322" ] }, { @@ -15749,7 +15768,7 @@ "cs": "Neplatný RSA podpis", "nl": "Ongeldige RSA handtekening", "xloc": [ - "default.handlebars->23->1295" + "default.handlebars->23->1323" ] }, { @@ -15757,7 +15776,7 @@ "cs": "Neplatný JSON", "nl": "Onjuiste JSON", "xloc": [ - "default.handlebars->23->1296" + "default.handlebars->23->1324" ] }, { @@ -15765,7 +15784,7 @@ "cs": "Neznámá akce", "nl": "Onbekende actie", "xloc": [ - "default.handlebars->23->1297" + "default.handlebars->23->1325" ] }, { @@ -15773,7 +15792,7 @@ "cs": "Nesprávný certifikát webu", "nl": "Onjuist webcertificaat", "xloc": [ - "default.handlebars->23->1298" + "default.handlebars->23->1326" ] }, { @@ -15781,7 +15800,7 @@ "cs": "Nesprávný podpis", "nl": "Ongeldige handtening", "xloc": [ - "default.handlebars->23->1299" + "default.handlebars->23->1327" ] }, { @@ -15789,7 +15808,7 @@ "cs": "Dosaženo maximálního počtu relací", "nl": "Max Sessies bereikt", "xloc": [ - "default.handlebars->23->1300" + "default.handlebars->23->1328" ] }, { @@ -15797,7 +15816,7 @@ "cs": "Neznámá skupina zařízení", "nl": "Onbekende apparaatgroep", "xloc": [ - "default.handlebars->23->1301" + "default.handlebars->23->1329" ] }, { @@ -15805,7 +15824,7 @@ "cs": "Neplatný typ skupiny zařízení", "nl": "Ongeldige apparaatgroep type", "xloc": [ - "default.handlebars->23->1302" + "default.handlebars->23->1330" ] }, { @@ -15813,7 +15832,7 @@ "cs": "Duplikovat agenta", "nl": "Duplicaat Agent", "xloc": [ - "default.handlebars->23->1303" + "default.handlebars->23->1331" ] }, { @@ -15821,7 +15840,7 @@ "cs": "Připojené Intel® AMT", "nl": "Verbonden Intel® AMT", "xloc": [ - "default.handlebars->23->1304" + "default.handlebars->23->1332" ] }, { @@ -15829,7 +15848,7 @@ "cs": "Chyby předávání (relay)", "nl": "Relay fouten", "xloc": [ - "default.handlebars->23->1305" + "default.handlebars->23->1333" ] }, { @@ -15837,14 +15856,14 @@ "cs": "Uživatelské účty", "nl": "Gebruikersaccounts", "xloc": [ - "default.handlebars->23->1306" + "default.handlebars->23->1334" ] }, { "en": "Agent Sessions", "cs": "Relace agenta", "xloc": [ - "default.handlebars->23->1308" + "default.handlebars->23->1336" ] }, { @@ -15852,7 +15871,7 @@ "cs": "Připojení", "nl": "Verbonden gebruikers", "xloc": [ - "default.handlebars->23->1309" + "default.handlebars->23->1337" ] }, { @@ -15860,7 +15879,7 @@ "cs": "Uživatelské relace", "nl": "gebruikers Sessies", "xloc": [ - "default.handlebars->23->1310" + "default.handlebars->23->1338" ] }, { @@ -15909,28 +15928,28 @@ "cs": "Externí", "nl": "Extern", "xloc": [ - "default.handlebars->23->1327" + "default.handlebars->23->1355" ] }, { "en": "Heap Used", "nl": "Heap gebruikt", "xloc": [ - "default.handlebars->23->1328" + "default.handlebars->23->1356" ] }, { "en": "Heap Total", "nl": "Heap Totaal", "xloc": [ - "default.handlebars->23->1329" + "default.handlebars->23->1357" ] }, { "en": "RSS", "nl": "RSS", "xloc": [ - "default.handlebars->23->1330" + "default.handlebars->23->1358" ] }, { @@ -15958,7 +15977,7 @@ "en": "Relay Count", "cs": "Počet předávání (relay)", "xloc": [ - "default.handlebars->23->1312" + "default.handlebars->23->1340" ] }, { @@ -15993,9 +16012,70 @@ }, { "en": "Create User Group", + "xloc": [ + "default.handlebars->23->1233" + ] + }, + { + "en": "User Group -", + "xloc": [ + "default.handlebars->container->column_l->p51->1->1->0->1->p30title->3" + ] + }, + { + "en": "No groups found.", "xloc": [ "default.handlebars->23->1230" ] + }, + { + "en": "Send a notice to all users in this group.", + "xloc": [ + "default.handlebars->23->1240" + ] + }, + { + "en": "Group Members", + "xloc": [ + "default.handlebars->23->1242" + ] + }, + { + "en": "No Members", + "xloc": [ + "default.handlebars->23->1245" + ] + }, + { + "en": "Delete User Group", + "xloc": [ + "default.handlebars->23->1246", + "default.handlebars->23->1252" + ] + }, + { + "en": "Edit User Group", + "xloc": [ + "default.handlebars->23->1249" + ] + }, + { + "en": "Delete user group {0}?", + "xloc": [ + "default.handlebars->23->1250" + ] + }, + { + "en": "Remote User", + "xloc": [ + "default.handlebars->23->1253" + ] + }, + { + "en": "Add Users to User Group", + "xloc": [ + "default.handlebars->23->1258" + ] } ] } \ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 249a9364..6a7c5135 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -8851,15 +8851,15 @@ return false; } - function showUserBroadcastDialog() { + function showUserBroadcastDialog(targetid) { if (xxdialogMode) return; var x = "Broadcast a message to all connected users." + ''; - setDialogMode(2, "Broadcast Message", 3, showUserBroadcastDialogEx, x); + setDialogMode(2, "Broadcast Message", 3, showUserBroadcastDialogEx, x, targetid?decodeURIComponent(targetid):null); Q('broadcastMessage').focus(); } - function showUserBroadcastDialogEx() { - meshserver.send({ action: 'userbroadcast', msg: Q('broadcastMessage').value }); + function showUserBroadcastDialogEx(b, targetid) { + meshserver.send({ action: 'userbroadcast', msg: Q('broadcastMessage').value, target: targetid }); } function showCreateNewAccountDialog() { @@ -9104,6 +9104,10 @@ } x += '
'; + if ((userinfo.siteadmin & 256) != 0) { + x += ''; + } + // Setup the panel QH('p51group', x); @@ -9125,7 +9129,7 @@ // Display all users for this mesh for (var i in sortedusers) { var trash = ''; - x += '
 ' + EscapeHtml(decodeURIComponent(sortedusers[i].name)) + '
' + trash + '
'; + x += '
 ' + EscapeHtml(decodeURIComponent(sortedusers[i].name)) + '
' + trash + '
'; ++count; } @@ -9178,12 +9182,20 @@ } function p51deleteUser(e, id) { - console.log('p51deleteUser', id); + haltEvent(e); + p51viewuserEx(2, decodeURIComponent(id)); + return false; } - - - + function p51viewuserEx(button, userid) { + if (button != 2) return; + var uname = userid.split('/')[2]; + if (users && users[userid]) { uname = users[userid].name; } + if (userinfo._id == userid) { uname = userinfo.name; } + setDialogMode(2, "Remote User", 3, p51viewuserEx2, format("Confirm removal of user {0}?", EscapeHtml(decodeURIComponent(uname))), userid); + } + function p51viewuserEx2(button, userid) { meshserver.send({ action: 'removeuserfromusergroup', ugrpid: currentUserGroup._id, userid: userid }); } + function p51showAddUserDialog() { if (xxdialogMode) return false; var x = "Allow users to manage this device group and devices in this group."; @@ -9244,9 +9256,9 @@ if (t == null) { var users = Q('dp51username').value.split(','), users2 = []; for (var i in users) { users2.push(users[i].trim()); } - meshserver.send({ action: 'addusertousergroup', meshid: currentUserGroup._id, usernames: users2 }); + meshserver.send({ action: 'addusertousergroup', ugrpid: currentUserGroup._id, usernames: users2 }); } else { - meshserver.send({ action: 'addusertousergroup', meshid: currentUserGroup._id, usernames: [ t.split('/')[2] ] }); + meshserver.send({ action: 'addusertousergroup', ugrpid: currentUserGroup._id, usernames: [ t.split('/')[2] ] }); } }