mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 01:45:53 +00:00
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;
|
||
|
}
|