Skip to content

Commit

Permalink
add missing rights to meshctrl and meshServerRightsArrayToNumber (#6004)
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 authored Apr 9, 2024
1 parent 4ba08a9 commit ccf57be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ module.exports.meshServerRightsArrayToNumber = function (val) {
if (r == 'locked') { newAccRights |= 32; }
if (r == 'nonewgroups') { newAccRights |= 64; }
if (r == 'notools') { newAccRights |= 128; }
if (r == 'usergroups') { newAccRights |= 256; }
if (r == 'recordings') { newAccRights |= 512; }
if (r == 'locksettings') { newAccRights |= 1024; }
if (r == 'allevents') { newAccRights |= 2048; }
if (r == 'nonewdevices') { newAccRights |= 4096; }
}
return newAccRights;
}
Expand Down
11 changes: 6 additions & 5 deletions meshctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ if (args['_'].length == 0) {
console.log(" --realname [name] - Set the real name for this account.");
console.log(" --phone [number] - Set the account phone number.");
console.log(" --rights [none|full|a,b,c] - Comma separated list of server permissions. Possible values:");
console.log(" manageusers,backup,restore,update,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents");
console.log(" manageusers,serverbackup,serverrestore,serverupdate,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents,nonewdevices");
break;
}
case 'edituser': {
Expand All @@ -501,7 +501,7 @@ if (args['_'].length == 0) {
console.log(" --realname [name] - Set the real name for this account.");
console.log(" --phone [number] - Set the account phone number.");
console.log(" --rights [none|full|a,b,c] - Comma separated list of server permissions. Possible values:");
console.log(" manageusers,backup,restore,update,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents");
console.log(" manageusers,serverbackup,serverrestore,serverupdate,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents,nonewdevices");
break;
}
case 'removeuser': {
Expand Down Expand Up @@ -1866,18 +1866,19 @@ function serverConnect() {
var srights = args.rights.toLowerCase().split(',');
if (srights.indexOf('full') != -1) { siteadmin = 0xFFFFFFFF; }
if (srights.indexOf('none') != -1) { siteadmin = 0x00000000; }
if (srights.indexOf('backup') != -1) { siteadmin |= 0x00000001; }
if (srights.indexOf('backup') != -1 || srights.indexOf('serverbackup') != -1) { siteadmin |= 0x00000001; }
if (srights.indexOf('manageusers') != -1) { siteadmin |= 0x00000002; }
if (srights.indexOf('restore') != -1) { siteadmin |= 0x00000004; }
if (srights.indexOf('restore') != -1 || srights.indexOf('serverrestore') != -1) { siteadmin |= 0x00000004; }
if (srights.indexOf('fileaccess') != -1) { siteadmin |= 0x00000008; }
if (srights.indexOf('update') != -1) { siteadmin |= 0x00000010; }
if (srights.indexOf('update') != -1 || srights.indexOf('serverupdate') != -1) { siteadmin |= 0x00000010; }
if (srights.indexOf('locked') != -1) { siteadmin |= 0x00000020; }
if (srights.indexOf('nonewgroups') != -1) { siteadmin |= 0x00000040; }
if (srights.indexOf('notools') != -1) { siteadmin |= 0x00000080; }
if (srights.indexOf('usergroups') != -1) { siteadmin |= 0x00000100; }
if (srights.indexOf('recordings') != -1) { siteadmin |= 0x00000200; }
if (srights.indexOf('locksettings') != -1) { siteadmin |= 0x00000400; }
if (srights.indexOf('allevents') != -1) { siteadmin |= 0x00000800; }
if (srights.indexOf('nonewdevices') != -1) { siteadmin |= 0x00001000; }
}

if (args.siteadmin) { siteadmin = 0xFFFFFFFF; }
Expand Down

0 comments on commit ccf57be

Please sign in to comment.