17 lines
407 B
TypeScript
17 lines
407 B
TypeScript
|
export const skip = (options: ACLSkipOptions) => {
|
||
|
return async function ACLSkipMiddleware(ctx, next) {
|
||
|
const { resourceName, actionName } = ctx.action;
|
||
|
if (resourceName === options.resourceName && actionName === options.actionName) {
|
||
|
ctx.permission = {
|
||
|
skip: true,
|
||
|
};
|
||
|
}
|
||
|
await next();
|
||
|
};
|
||
|
};
|
||
|
|
||
|
interface ACLSkipOptions {
|
||
|
resourceName: string;
|
||
|
actionName: string;
|
||
|
}
|