mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 15:56:00 +00:00
16 lines
392 B
TypeScript
16 lines
392 B
TypeScript
import { compilePermissions, testPermission } from 'dbgate-tools';
|
|
import { useConfig } from './metadataLoaders';
|
|
|
|
let compiled = null;
|
|
|
|
const config = useConfig();
|
|
config.subscribe(value => {
|
|
if (!value) return;
|
|
const { permissions } = value;
|
|
compiled = compilePermissions(permissions);
|
|
});
|
|
|
|
export default function hasPermission(tested) {
|
|
return testPermission(tested, compiled);
|
|
}
|