requirePermission(permission: Permission): <R extends string>(ctx: AuthContext<R>,next: Next) => Promise<void>
Returns a middleware that requires the caller to hold permission. It must
run after authMiddleware, as in
router.patch(path, authMiddleware, requirePermission("user:manage"), …).
The returned middleware throws an APIException (403) when the caller
lacks the permission.
permission: Permission
<R extends string>(ctx: AuthContext<R>,next: Next) => Promise<void>