chore: acl

This commit is contained in:
Chareice 2024-01-18 13:48:28 +08:00
parent 738f9c568e
commit d98a42e34f
No known key found for this signature in database

View File

@ -1,9 +1,13 @@
export function AclSelectorMiddleware() { export function AclSelectorMiddleware() {
return async (ctx, next) => { return async (ctx, next) => {
const connectionName = ctx.get('x-connection'); const connectionName = ctx.get('x-connection');
if (connectionName) {
await next();
} else {
const aclInstance = connectionName ? ctx.app.acls.get(connectionName) : ctx.app.acl; const aclInstance = connectionName ? ctx.app.acls.get(connectionName) : ctx.app.acl;
const middleware = aclInstance.middleware(); const middleware = aclInstance.middleware();
await middleware(ctx, next); await middleware(ctx, next);
}
}; };
} }