mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 23:06:00 +00:00
permissins (per instance)
This commit is contained in:
12
packages/api/src/utility/hasPermission.js
Normal file
12
packages/api/src/utility/hasPermission.js
Normal 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;
|
||||
Reference in New Issue
Block a user