2022-11-24 19:48:51 +01:00
|
|
|
import { BBContext } from "@budibase/types"
|
|
|
|
|
|
|
|
export = async (ctx: BBContext, next: any) => {
|
2022-06-01 16:20:56 +02:00
|
|
|
if (
|
|
|
|
!ctx.internal &&
|
|
|
|
(!ctx.user || !ctx.user.builder || !ctx.user.builder.global) &&
|
|
|
|
(!ctx.user || !ctx.user.admin || !ctx.user.admin.global)
|
|
|
|
) {
|
|
|
|
ctx.throw(403, "Builder user only endpoint.")
|
|
|
|
}
|
|
|
|
return next()
|
|
|
|
}
|