add missing rights to meshctrl and meshServerRightsArrayToNumber (#6004)

Signed-off-by: si458 <simonsmith5521@gmail.com>

Simon Smith committed Apr 9, 2024 at 13:31 UTC ccf57bee1a5aa12c5d8f19d537b80b56ddf94a0a
2 files changed +11 -5
common.js
+5
@@ -334,6 +334,11 @@ module.exports.meshServerRightsArrayToNumber = function (val) {
334 if (r == 'locked') { newAccRights |= 32; }
335 if (r == 'nonewgroups') { newAccRights |= 64; }
336 if (r == 'notools') { newAccRights |= 128; }
337 + if (r == 'usergroups') { newAccRights |= 256; }
338 + if (r == 'recordings') { newAccRights |= 512; }
339 + if (r == 'locksettings') { newAccRights |= 1024; }
340 + if (r == 'allevents') { newAccRights |= 2048; }
341 + if (r == 'nonewdevices') { newAccRights |= 4096; }
342 }
343 return newAccRights;
344 }
meshctrl.js
+6 -5
@@ -484,7 +484,7 @@ if (args['_'].length == 0) {
484 console.log(" --realname [name] - Set the real name for this account.");
485 console.log(" --phone [number] - Set the account phone number.");
486 console.log(" --rights [none|full|a,b,c] - Comma separated list of server permissions. Possible values:");
487 - console.log(" manageusers,backup,restore,update,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents");
487 + console.log(" manageusers,serverbackup,serverrestore,serverupdate,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents,nonewdevices");
488 break;
489 }
490 case 'edituser': {
@@ -501,7 +501,7 @@ if (args['_'].length == 0) {
501 console.log(" --realname [name] - Set the real name for this account.");
502 console.log(" --phone [number] - Set the account phone number.");
503 console.log(" --rights [none|full|a,b,c] - Comma separated list of server permissions. Possible values:");
504 - console.log(" manageusers,backup,restore,update,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents");
504 + console.log(" manageusers,serverbackup,serverrestore,serverupdate,fileaccess,locked,nonewgroups,notools,usergroups,recordings,locksettings,allevents,nonewdevices");
505 break;
506 }
507 case 'removeuser': {
@@ -1866,11 +1866,11 @@ function serverConnect() {
1866 var srights = args.rights.toLowerCase().split(',');
1867 if (srights.indexOf('full') != -1) { siteadmin = 0xFFFFFFFF; }
1868 if (srights.indexOf('none') != -1) { siteadmin = 0x00000000; }
1869 - if (srights.indexOf('backup') != -1) { siteadmin |= 0x00000001; }
1869 + if (srights.indexOf('backup') != -1 || srights.indexOf('serverbackup') != -1) { siteadmin |= 0x00000001; }
1870 if (srights.indexOf('manageusers') != -1) { siteadmin |= 0x00000002; }
1871 - if (srights.indexOf('restore') != -1) { siteadmin |= 0x00000004; }
1871 + if (srights.indexOf('restore') != -1 || srights.indexOf('serverrestore') != -1) { siteadmin |= 0x00000004; }
1872 if (srights.indexOf('fileaccess') != -1) { siteadmin |= 0x00000008; }
1873 - if (srights.indexOf('update') != -1) { siteadmin |= 0x00000010; }
1873 + if (srights.indexOf('update') != -1 || srights.indexOf('serverupdate') != -1) { siteadmin |= 0x00000010; }
1874 if (srights.indexOf('locked') != -1) { siteadmin |= 0x00000020; }
1875 if (srights.indexOf('nonewgroups') != -1) { siteadmin |= 0x00000040; }
1876 if (srights.indexOf('notools') != -1) { siteadmin |= 0x00000080; }
@@ -1878,6 +1878,7 @@ function serverConnect() {
1878 if (srights.indexOf('recordings') != -1) { siteadmin |= 0x00000200; }
1879 if (srights.indexOf('locksettings') != -1) { siteadmin |= 0x00000400; }
1880 if (srights.indexOf('allevents') != -1) { siteadmin |= 0x00000800; }
1881 + if (srights.indexOf('nonewdevices') != -1) { siteadmin |= 0x00001000; }
1882 }
1883
1884 if (args.siteadmin) { siteadmin = 0xFFFFFFFF; }