Also instrument appId
This commit is contained in:
parent
899b6707e7
commit
5b880f1d9b
|
@ -12,14 +12,20 @@ import { getCachedSelf } from "../utilities/global"
|
|||
import env from "../environment"
|
||||
import { isWebhookEndpoint } from "./utils"
|
||||
import { UserCtx, ContextUser } from "@budibase/types"
|
||||
import tracer from "dd-trace"
|
||||
|
||||
export default async (ctx: UserCtx, next: any) => {
|
||||
return tracer.trace("currentapp middleware", {}, async span => {
|
||||
// try to get the appID from the request
|
||||
let requestAppId = await utils.getAppIdFromCtx(ctx)
|
||||
if (!requestAppId) {
|
||||
return next()
|
||||
}
|
||||
|
||||
if (requestAppId) {
|
||||
span?.addTags({ appId: requestAppId })
|
||||
}
|
||||
|
||||
// deny access to application preview
|
||||
if (!env.isTest()) {
|
||||
if (
|
||||
|
@ -57,7 +63,9 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
roleId = roleHeader
|
||||
|
||||
// Delete admin and builder flags so that the specified role is honoured
|
||||
ctx.user = users.removePortalUserPermissions(ctx.user) as ContextUser
|
||||
ctx.user = users.removePortalUserPermissions(
|
||||
ctx.user
|
||||
) as ContextUser
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow error and do nothing
|
||||
|
@ -111,4 +119,5 @@ export default async (ctx: UserCtx, next: any) => {
|
|||
|
||||
return next()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue