mirror of https://github.com/Budibase/budibase.git
13 changed files with 59 additions and 2766 deletions
@ -1,27 +0,0 @@ |
|||
const { |
|||
isMultiTenant, |
|||
updateTenantId, |
|||
isTenantIdSet, |
|||
DEFAULT_TENANT_ID, |
|||
updateAppId, |
|||
} = require("../tenancy") |
|||
const ContextFactory = require("../context/FunctionContext") |
|||
const { getTenantIDFromAppID } = require("../db/utils") |
|||
|
|||
module.exports = () => { |
|||
return ContextFactory.getMiddleware(ctx => { |
|||
// if not in multi-tenancy mode make sure its default and exit
|
|||
if (!isMultiTenant()) { |
|||
updateTenantId(DEFAULT_TENANT_ID) |
|||
return |
|||
} |
|||
// if tenant ID already set no need to continue
|
|||
if (isTenantIdSet()) { |
|||
return |
|||
} |
|||
const appId = ctx.appId ? ctx.appId : ctx.user ? ctx.user.appId : null |
|||
const tenantId = getTenantIDFromAppID(appId) || DEFAULT_TENANT_ID |
|||
updateTenantId(tenantId) |
|||
updateAppId(appId) |
|||
}) |
|||
} |
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue