mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added newAccountsRights to SSO strategies
This commit is contained in:
parent
25d2decb4f
commit
2bd1d55403
4 changed files with 27 additions and 18 deletions
22
common.js
22
common.js
|
@ -269,4 +269,26 @@ module.exports.copyFile = function(source, target, cb) {
|
|||
wr.on('close', function (ex) { done(); });
|
||||
rd.pipe(wr);
|
||||
function done(err) { if (!cbCalled) { cb(err); cbCalled = true; } }
|
||||
}
|
||||
|
||||
module.exports.meshServerRightsArrayToNumber = function (val) {
|
||||
if (val == null) return null;
|
||||
if (typeof val == 'number') return val;
|
||||
if (Array.isArray(val)) {
|
||||
var newAccRights = 0;
|
||||
for (var j in val) {
|
||||
var r = val[j].toLowerCase();
|
||||
if (r == 'fulladmin') { newAccRights = 4294967295; } // 0xFFFFFFFF
|
||||
if (r == 'serverbackup') { newAccRights |= 1; }
|
||||
if (r == 'manageusers') { newAccRights |= 2; }
|
||||
if (r == 'serverrestore') { newAccRights |= 4; }
|
||||
if (r == 'fileaccess') { newAccRights |= 8; }
|
||||
if (r == 'serverupdate') { newAccRights |= 16; }
|
||||
if (r == 'locked') { newAccRights |= 32; }
|
||||
if (r == 'nonewgroups') { newAccRights |= 64; }
|
||||
if (r == 'notools') { newAccRights |= 128; }
|
||||
}
|
||||
return newAccRights;
|
||||
}
|
||||
return null;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue