Quick fix for backwards compat, enabling multi-tenancy on a previously single tenancy environment.

This commit is contained in:
mike12345567 2021-09-06 15:14:46 +01:00
parent fe0adcde7d
commit 2dca8ab46e
1 changed files with 4 additions and 0 deletions

View File

@ -18,6 +18,10 @@ exports.getUser = async (userId, tenantId = null) => {
user = await getGlobalDB(tenantId).get(userId) user = await getGlobalDB(tenantId).get(userId)
client.store(userId, user, EXPIRY_SECONDS) client.store(userId, user, EXPIRY_SECONDS)
} }
if (user && !user.tenantId && tenantId) {
// make sure the tenant ID is always correct/set
user.tenantId = tenantId
}
return user return user
} }