( resource: R, action: ActionOf<R>, )
| 256 | * .mutation(async ({ ctx, input }) => { ... }) |
| 257 | */ |
| 258 | export const withPermission = <R extends Resource>( |
| 259 | resource: R, |
| 260 | action: ActionOf<R>, |
| 261 | ) => |
| 262 | protectedProcedure.use(async ({ ctx, next }) => { |
| 263 | await checkPermission(ctx, { [resource]: [action] } as any); |
| 264 | return next(); |
| 265 | }); |
no test coverage detected