From ba8a73ec7ad3be000fd2b2dddfce71a30d4d3c87 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 23 Jan 2022 21:57:27 -0800 Subject: [PATCH] Fixed user group management. --- meshuser.js | 7 +++++-- views/default.handlebars | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meshuser.js b/meshuser.js index 768aeaa8..aaab7af6 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1474,8 +1474,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } // Get the domain - var delGroupDomain = parent.parent.config.domains[ugroupidsplit[1]]; - if (delGroupDomain == null) { err = "Invalid domain id"; } + var delGroupDomain; + if (ugroupidsplit != null) { + delGroupDomain = parent.parent.config.domains[ugroupidsplit[1]]; + if (delGroupDomain == null) { err = "Invalid domain id"; } + } // Handle any errors if (err != null) { diff --git a/views/default.handlebars b/views/default.handlebars index de985441..faa5aec3 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1121,7 +1121,7 @@
-
+
@@ -2053,6 +2053,7 @@ // We are user administrator if (users == null) { meshserver.send({ action: 'users' }); } if (wssessions == null) { meshserver.send({ action: 'wssessioncount' }); } + mainUpdate(8192 + 16384); } else { // We are not user administrator users = null; @@ -14239,6 +14240,9 @@ // function updateUserGroups() { + // Display user group operations only if allowed for us + QV('p50userGroupOps', (userinfo.siteadmin & 256) != 0); // SITERIGHT_USERGROUPS = 256 + // Sort the list of group names var sortedGroups = [], x = ''; if (usergroups) { for (var i in usergroups) { sortedGroups.push(usergroups[i]); } } @@ -14263,7 +14267,7 @@ // Re-check userid's elements = document.getElementsByClassName('UserGroupCheckbox'); - for (var i=0;i= 0)); } + for (var i = 0; i < elements.length; i++) { elements[i].checked = ((checkedUserGroupids.indexOf(elements[i].value) >= 0)); } p50updateInfo(); // Update current user panel if needed