Browse Source
Merge pull request #2771 from Budibase/feature/subdomain-tenantid
adding subdomain checking to tenancy middleware
gh-pages
Martin McKeaveney
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
0 deletions
-
packages/auth/src/tenancy/context.js
|
|
|
@ -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") |
|
|
|
} |
|
|
|
|