1
0
Fork 0
mirror of synced 2024-07-06 06:50:49 +12:00

adding subdomain checking to tenancy middleware

This commit is contained in:
Martin McKeaveney 2021-09-28 16:40:03 +01:00
parent c03b9afbee
commit 46d22a1ae6

View file

@ -53,6 +53,11 @@ exports.setTenantId = (
// processed later in the chain
tenantId = user.tenantId || header || tenantId
// Set the tenantId from the subdomain
if (!tenantId) {
tenantId = ctx.subdomains && ctx.subdomains[0]
}
if (!tenantId && !allowNoTenant) {
ctx.throw(403, "Tenant id not set")
}