initial upload
This commit is contained in:
parent
ac114da487
commit
7c1cfdff51
63 changed files with 6883 additions and 0 deletions
38
test.mjs
Normal file
38
test.mjs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
import {
|
||||
SetMedia,
|
||||
MediaAddLabel,
|
||||
MediaRemoveLabel
|
||||
} from "./functions/media.mjs";
|
||||
|
||||
import {
|
||||
SetPrinter,
|
||||
DeletePrinter,
|
||||
GetPrinter,
|
||||
GetPrinters
|
||||
} from "./functions/printer.mjs";
|
||||
|
||||
|
||||
|
||||
|
||||
function checkPermissions(userPermissions, requestedPermission) {
|
||||
let result = false;
|
||||
|
||||
for (let counter = requestedPermission.split(".").length; counter > 0; counter--) {
|
||||
if (userPermissions.includes(requestedPermission)) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
requestedPermission = requestedPermission.substr(0, requestedPermission.lastIndexOf("."))
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Beispielverwendung:
|
||||
const userPermissions = [
|
||||
"mongo"
|
||||
];
|
||||
|
||||
const permissionsResult = checkPermissions(userPermissions, "settings.printer");
|
||||
Loading…
Add table
Add a link
Reference in a new issue