1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00

Updates to suport non cloud single and multi tenancy

This commit is contained in:
Rory Powell 2021-10-06 14:09:43 +01:00
parent 15a01f0c1d
commit 09b0dbe868
2 changed files with 22 additions and 14 deletions

View file

@ -96,6 +96,10 @@ spec:
value: worker-service:{{ .Values.services.worker.port }}
- name: COOKIE_DOMAIN
value: {{ .Values.globals.cookieDomain | quote }}
- name: ACCOUNT_PORTAL_URL
value: {{ .Values.globals.accountPortalUrl | quote }}
- name: ACCOUNT_PORTAL_API_KEY
value: {{ .Values.globals.accountPortalApiKey | quote }}
image: budibase/apps
imagePullPolicy: Always
name: bbapps

View file

@ -20,25 +20,29 @@
return
}
// e.g. ['tenant', 'budibase', 'app'] vs ['budibase', 'app']
let urlTenantId
const hostParts = host.split(".")
if (hostParts.length > 2) {
urlTenantId = hostParts[0]
}
// no tenant in the url - send to account portal to fix this
if (!urlTenantId) {
window.location.href = $admin.accountPortalUrl
return
}
if (user && user.tenantId) {
let urlTenantId
const hostParts = host.split(".")
// only run validation when we know we are in a tenant url
// not when we visit the root budibase.app domain
// e.g. ['tenant', 'budibase', 'app'] vs ['budibase', 'app']
if (hostParts.length > 2) {
urlTenantId = hostParts[0]
} else {
// no tenant in the url - send to account portal to fix this
window.location.href = $admin.accountPortalUrl
return
}
if (user.tenantId !== urlTenantId) {
// user should not be here - play it safe and log them out
await auth.logout()
await auth.setOrganisation(null)
return
}
} else {
// no user - set the org according to the url
await auth.setOrganisation(urlTenantId)
}
}