diff --git a/MeshCentralServer.njsproj b/MeshCentralServer.njsproj index d6dccd0b..090562db 100644 --- a/MeshCentralServer.njsproj +++ b/MeshCentralServer.njsproj @@ -180,7 +180,6 @@ - @@ -270,6 +269,7 @@ + diff --git a/meshuser.js b/meshuser.js index ce863cef..c791b9c7 100644 --- a/meshuser.js +++ b/meshuser.js @@ -38,14 +38,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use const MESHRIGHT_UNINSTALL = 32768; // Site rights - const SITERIGHT_SERVERBACKUP = 1; - const SITERIGHT_MANAGEUSERS = 2; - const SITERIGHT_SERVERRESTORE = 4; - const SITERIGHT_FILEACCESS = 8; - const SITERIGHT_SERVERUPDATE = 16; - const SITERIGHT_LOCKED = 32; // 0x00000020 - const SITERIGHT_NONEWGROUPS = 64; // 0x00000040 - const SITERIGHT_NOMESHCMD = 128; // 0x00000080 + const SITERIGHT_SERVERBACKUP = 1; // 0x00000001 + const SITERIGHT_MANAGEUSERS = 2; // 0x00000002 + const SITERIGHT_SERVERRESTORE = 4; // 0x00000004 + const SITERIGHT_FILEACCESS = 8; // 0x00000008 + const SITERIGHT_SERVERUPDATE = 16; // 0x00000010 + const SITERIGHT_LOCKED = 32; // 0x00000020 + const SITERIGHT_NONEWGROUPS = 64; // 0x00000040 + const SITERIGHT_NOMESHCMD = 128; // 0x00000080 + const SITERIGHT_USERGROUPS = 256; // 0x00000100 var obj = {}; obj.user = user; @@ -1471,6 +1472,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } break; } + case 'createusergroup': + { + // TODO + //console.log(command); + break; + } + case 'deleteusergroup': + { + // TODO + //console.log(command); + break; + } case 'changemeshnotify': { var err = null; diff --git a/public/images/group-256.png b/public/images/group-256.png new file mode 100644 index 00000000..283e39d5 Binary files /dev/null and b/public/images/group-256.png differ diff --git a/public/styles/style.css b/public/styles/style.css index a02230bd..a0712e0b 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -253,7 +253,7 @@ body { } /* #UserDummyMenuSpan, */ -#MainSubMenuSpan, #MeshSubMenuSpan, #UserSubMenuSpan, #ServerSubMenuSpan, #MainMenuSpan, #MainSubMenu, #MeshSubMenu, #UserSubMenu, #ServerSubMenu, #UserDummyMenu, #PluginSubMenu { +#MainSubMenuSpan, #MeshSubMenuSpan, #UserSubMenuSpan, #UsersSubMenuSpan, #ServerSubMenuSpan, #MainMenuSpan, #MainSubMenu, #MeshSubMenu, #UserSubMenu, #ServerSubMenu, #UserDummyMenu, #PluginSubMenu { width: 100%; height: 24px; color: white; diff --git a/views/default.handlebars b/views/default.handlebars index 3767e4d0..d1e58137 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -162,6 +162,15 @@ +
'; x += '
'; x += '
'; @@ -8883,18 +8910,20 @@ setDialogMode(2, "Server Permissions", 3, showUserAdminDialogEx, x, user); if (user.siteadmin && user.siteadmin != 0) { Q('ua_fulladmin').checked = (user.siteadmin == 0xFFFFFFFF); - Q('ua_serverbackup').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1) != 0)); // Server Backup - Q('ua_manageusers').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 2) != 0)); // Manage Users - Q('ua_serverrestore').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 4) != 0)); // Server Restore - Q('ua_fileaccess').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 8) != 0)); // Server Files - Q('ua_serverupdate').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 16) != 0)); // Server Update - Q('ua_lockedaccount').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 32) != 0)); // Account locked - Q('ua_nonewgroups').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 64) != 0)); // No New Groups - Q('ua_nomeshcmd').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 128) != 0)); // No Tools (MeshCMD / Router) + Q('ua_serverbackup').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1) != 0)); // Server Backup + Q('ua_manageusers').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 2) != 0)); // Manage Users + Q('ua_serverrestore').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 4) != 0)); // Server Restore + Q('ua_fileaccess').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 8) != 0)); // Server Files + Q('ua_serverupdate').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 16) != 0)); // Server Update + Q('ua_lockedaccount').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 32) != 0)); // Account locked + Q('ua_nonewgroups').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 64) != 0)); // No New Groups + Q('ua_nomeshcmd').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 128) != 0)); // No Tools (MeshCMD / Router) + Q('ua_manageusergroups').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 256) != 0)); // Manage User Groups } QE('ua_fulladmin', userinfo.siteadmin == 0xFFFFFFFF); QE('ua_serverbackup', userinfo.siteadmin == 0xFFFFFFFF); QE('ua_manageusers', userinfo.siteadmin == 0xFFFFFFFF); + QE('ua_manageusergroups', userinfo.siteadmin == 0xFFFFFFFF); QE('ua_serverrestore', userinfo.siteadmin == 0xFFFFFFFF); QE('ua_fileaccess', userinfo.siteadmin == 0xFFFFFFFF); QE('ua_fileaccessquota', userinfo.siteadmin == 0xFFFFFFFF); @@ -8918,6 +8947,7 @@ QE('ua_lockedaccount', !Q('ua_fulladmin').checked); QE('ua_nonewgroups', !Q('ua_fulladmin').checked); QE('ua_nomeshcmd', !Q('ua_fulladmin').checked); + QE('ua_manageusergroups', !Q('ua_fulladmin').checked && Q('ua_manageusers').checked); QE('ua_fileaccessquota', Q('ua_fileaccess').checked && !Q('ua_fulladmin').checked); } } @@ -8933,6 +8963,7 @@ if (Q('ua_lockedaccount').checked == true) siteadmin += 32; if (Q('ua_nonewgroups').checked == true) siteadmin += 64; if (Q('ua_nomeshcmd').checked == true) siteadmin += 128; + if (Q('ua_manageusergroups').checked == true) siteadmin += 256; } var x = { action: 'edituser', id: user._id, siteadmin: siteadmin }; if (isNaN(quota) == false) { x.quota = (quota * 1024); } @@ -8941,8 +8972,35 @@ function onUserSearchInputChanged() { updateUsers(); } + // - // MY USERS GENERAL + // MY USER GROUPS + // + + function updateUserGroups() { + + } + + function showCreateUserGroupDialog() { + if (xxdialogMode) return; + var x = ''; + x += addHtmlValue("Name", ''); + x += addHtmlValue("Description", ''); + setDialogMode(2, "Create User Group", 3, showCreateUserGroupDialogEx, x); + showCreateUserGroupDialogValidate(); + Q('p4name').focus(); + } + + function showCreateUserGroupDialogValidate() { + QE('idx_dlgOkButton', (Q('p4name').value.length > 0) && (Q('p4name').value.indexOf(' ') == -1)); + } + + function showCreateUserGroupDialogEx() { + meshserver.send({ action: 'createusergroup', name: Q('p4name').value, desc: Q('p4desc').value }); + } + + // + // MY USER GENERAL // var currentUser = null; @@ -9173,7 +9231,7 @@ } // - // MY USERS EVENTS + // MY USER EVENTS // var currentUserEvents = null; @@ -9801,7 +9859,7 @@ } // Edit this line when adding a new screen - for (var i = 0; i < 44; i++) { QV('p' + i, i == x); } + for (var i = 0; i < 51; i++) { QV('p' + i, i == x); } xxcurrentView = x; // Remove top bar selection @@ -9837,7 +9895,7 @@ // My Events QC('MainMenuMyEvents').add(mainMenuActiveClass); QC('LeftMenuMyEvents').add(leftMenuActiveClass); - } else if (x == 4 || (x >= 30 && x < 40)) { + } else if (x == 4 || (x >= 30 && x < 40) || x == 50) { // My Users QC('MainMenuMyUsers').add(mainMenuActiveClass); QC('LeftMenuMyUsers').add(leftMenuActiveClass); @@ -9864,7 +9922,8 @@ QV('MeshSubMenuSpan', (x >= 20) && (x < 30)); QV('UserSubMenuSpan', (x >= 30) && (x < 40)); QV('ServerSubMenuSpan', x == 6 || x == 115 || x == 40 || x == 41 || x == 42 || x == 43); - var panels = { 10: 'MainDev', 11: 'MainDevDesktop', 12: 'MainDevTerminal', 13: 'MainDevFiles', 14: 'MainDevAmt', 15: 'MainDevConsole', 16: 'MainDevEvents', 17: 'MainDevInfo', 19: 'MainDevPlugins', 20: 'MeshGeneral', 21: 'MeshSummary', 30: 'UserGeneral', 31: 'UserEvents', 6: 'ServerGeneral', 40: 'ServerStats', 41: 'ServerTrace', 42: 'ServerPlugins', 115: 'ServerConsole' }; + QV('UsersSubMenuSpan', x == 4 || x == 50); + var panels = { 4: 'UsersGeneral', 10: 'MainDev', 11: 'MainDevDesktop', 12: 'MainDevTerminal', 13: 'MainDevFiles', 14: 'MainDevAmt', 15: 'MainDevConsole', 16: 'MainDevEvents', 17: 'MainDevInfo', 19: 'MainDevPlugins', 20: 'MeshGeneral', 21: 'MeshSummary', 30: 'UserGeneral', 31: 'UserEvents', 6: 'ServerGeneral', 40: 'ServerStats', 41: 'ServerTrace', 42: 'ServerPlugins', 50: 'UsersGroups', 115: 'ServerConsole' }; for (var i in panels) { QC(panels[i]).remove('style3x'); QC(panels[i]).remove('style3sel');