budibase/packages/worker/src/middleware/builderOnly.js

10 lines
211 B
JavaScript
Raw Normal View History

2022-02-10 00:16:24 +01:00
module.exports = async (ctx, next) => {
if (
!ctx.internal &&
(!ctx.user || !ctx.user.builder || !ctx.user.builder.global)
) {
ctx.throw(403, "Builder user only endpoint.")
}
return next()
}