chore: acl selectore

This commit is contained in:
Chareice 2024-01-18 13:52:24 +08:00
parent d98a42e34f
commit edad85b92d
No known key found for this signature in database

View File

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