permissins (per instance)

This commit is contained in:
Jan Prochazka
2020-12-10 11:54:28 +01:00
parent 698756b9d2
commit f993e82b0b
15 changed files with 114 additions and 29 deletions

View File

@@ -0,0 +1,12 @@
const { compilePermissions, testPermission } = require('dbgate-tools');
let compiled = undefined;
function hasPermission(tested) {
if (compiled === undefined) {
compiled = compilePermissions(process.env.PERMISSIONS);
}
return testPermission(tested, compiled);
}
module.exports = hasPermission;