diff --git a/meshuser.js b/meshuser.js index 3df8a457..bba0b9bd 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1951,14 +1951,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (change == '') { change = 'User group features changed.'; } } - if ((command.removeRights != null) && (typeof command.removeRights == 'number')) { - if ((command.removeRights == 0) && (group.removeRights != null)) { delete group.removeRights; } else { if (command.removeRights !== group.removeRights) { group.removeRights = command.removeRights; } } - if (change == '') { change = 'User group features changed.'; } - } - if (change != '') { db.Set(group); - var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: group._id, name: group.name, desc: group.desc, consent: ((group.consent == null) ? 0 : group.consent), action: 'usergroupchange', links: group.links, flags: group.flags, removeRights: group.removeRights, msg: change, domain: domain.id }; + var event = { etype: 'ugrp', userid: user._id, username: user.name, ugrpid: group._id, name: group.name, desc: group.desc, consent: ((group.consent == null) ? 0 : group.consent), action: 'usergroupchange', links: group.links, flags: group.flags, 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); } diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 591699ee..8c77713b 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -1744,7 +1744,6 @@ ugroup.desc = message.event.desc; ugroup.links = message.event.links; ugroup.flags = message.event.flags; - ugroup.removeRights = message.event.removeRights; } //mainUpdate(8192 + 16384); diff --git a/views/default.handlebars b/views/default.handlebars index 352db789..9438fff0 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2936,7 +2936,6 @@ if (message.event.desc) { ugroup.desc = message.event.desc; } else { delete ugroup.desc; } if (message.event.links) { ugroup.links = message.event.links; } else { delete ugroup.links; } if (message.event.flags) { ugroup.flags = message.event.flags; } else { delete ugroup.flags; } - if (message.event.removeRights) { ugroup.removeRights = message.event.removeRights; } else { delete ugroup.removeRights; } if (typeof message.event.consent == 'number') { ugroup.consent = message.event.consent; } } mainUpdate(4096 + 8192 + 16384); @@ -13831,24 +13830,13 @@ } // Display features - var userGroupFeatures = []; - if ((serverinfo.userGroupsSessionRecording == 1) && (group.flags) && (group.flags & 2)) { userGroupFeatures.push("Record Sessions"); } - if (group.removeRights) { - if ((group.removeRights & 0x00000008) != 0) { userGroupFeatures.push("No Remote Control"); } else { - if ((group.removeRights & 0x00010000) != 0) { userGroupFeatures.push("No Desktop"); } - else if ((group.removeRights & 0x00000100) != 0) { userGroupFeatures.push("Desktop View Only"); } - if ((group.removeRights & 0x00000200) != 0) { userGroupFeatures.push("No Terminal"); } - if ((group.removeRights & 0x00000400) != 0) { userGroupFeatures.push("No Files"); } - } - if ((group.removeRights & 0x00000010) != 0) { userGroupFeatures.push("No Console"); } - if ((group.removeRights & 0x00008000) != 0) { userGroupFeatures.push("No Uninstall"); } - if ((group.removeRights & 0x00020000) != 0) { userGroupFeatures.push("No Remote Command"); } - if ((group.removeRights & 0x00000040) != 0) { userGroupFeatures.push("No Wake"); } - if ((group.removeRights & 0x00040000) != 0) { userGroupFeatures.push("No Reset/Off"); } + if (serverinfo.userGroupsSessionRecording == 1) { + var userGroupFeatures = []; + if ((group.flags) && (group.flags & 2)) { userGroupFeatures.push("Record Sessions"); } + userGroupFeatures = userGroupFeatures.join(', '); + if (userGroupFeatures == '') { userGroupFeatures = '' + "None" + ''; } + x += addDeviceAttribute("Features", addLink(userGroupFeatures, 'p51edituserGroupFeatures()')); } - userGroupFeatures = userGroupFeatures.join(', '); - if (userGroupFeatures == '') { userGroupFeatures = '' + "None" + ''; } - x += addDeviceAttribute("Features", addLink(userGroupFeatures, 'p51edituserGroupFeatures()')); // Display user consent flags for this user group { @@ -13975,53 +13963,19 @@ function p51edituserGroupFeatures() { if (xxdialogMode) return; - var flags = (currentUserGroup.flags)?currentUserGroup.flags:0, x = ''; // Flags: 1 = Account Image, 2 = Session Recording - var removeRights = (currentUserGroup.removeRights)?currentUserGroup.removeRights:0, x = ''; // Remove Device Group Rights + var flags = (currentUserGroup.flags)?currentUserGroup.flags:0, x = ''; // Flags: 2 = Session Recording if (serverinfo.userGroupsSessionRecording == 1) { - x += '

'; + x += '

'; } - x += '

'; - x += '

'; - x += '

'; - x += '

'; - x += '

'; - x += '

'; - x += '

'; - x += '

'; - x += '

'; - x += '

'; setDialogMode(2, "Edit User Group Features", 3, p51edituserGroupFeaturesEx, x); - p51edituserGroupFeaturesValidate(); - } - - function p51edituserGroupFeaturesValidate() { - QE('d51flag2', !Q('d51flag7').checked); - QE('d51flag3', !Q('d51flag7').checked && !Q('d51flag2').checked); - QE('d51flag4', !Q('d51flag7').checked); - QE('d51flag5', !Q('d51flag7').checked); } // Send to the server the new user's real name function p51edituserGroupFeaturesEx() { // Setup user flags - var flags = (currentUserGroup.flags)?currentUserGroup.flags:0; // Flags: 1 = Account Image, 2 = Session Recording - var f = flags & 1; - if ((serverinfo.userGroupsSessionRecording == 1) && Q('d51flag1').checked) { f += 2; } - - // Setup user permission removal - var r = 0; - if (Q('d51flag7').checked) { r += 0x00000008; } else { - if (Q('d51flag2').checked) { r += 0x00010000; } - else if (Q('d51flag3').checked) { r += 0x00000100; } - if (Q('d51flag4').checked) { r += 0x00000200; } - if (Q('d51flag5').checked) { r += 0x00000400; } - } - if (Q('d51flag6').checked) { r += 0x00000010; } - if (Q('d51flag8').checked) { r += 0x00008000; } - if (Q('d51flag9').checked) { r += 0x00020000; } - if (Q('d51flag10').checked) { r += 0x00000040; } - if (Q('d51flag11').checked) { r += 0x00040000; } - meshserver.send({ action: 'editusergroup', ugrpid: currentUserGroup._id, flags: f, removeRights: r }); + var flags = 0; // Flags: 2 = Session Recording + if ((serverinfo.userGroupsSessionRecording == 1) && Q('d51flag1').checked) { flags += 2; } + meshserver.send({ action: 'editusergroup', ugrpid: currentUserGroup._id, flags: flags }); } function p51removeDeviceFromUserGroup(e, nodeid) {