From f07ebc18db338da5f76ab643a994d8a8e9b0564d Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:54:36 +0100 Subject: [PATCH] Make sure to delete SSO ID doc as well (#14307) --- packages/worker/src/sdk/tenants/tenants.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/worker/src/sdk/tenants/tenants.ts b/packages/worker/src/sdk/tenants/tenants.ts index 4f580402f7..ba1f1f8400 100644 --- a/packages/worker/src/sdk/tenants/tenants.ts +++ b/packages/worker/src/sdk/tenants/tenants.ts @@ -48,10 +48,13 @@ async function removeTenantUsers(tenantId: string) { try { const allUsers = await getTenantUsers(tenantId) const allEmails = allUsers.rows.map((row: any) => row.doc.email) + const allSsoIds = allUsers.rows + .map((row: any) => row.doc.ssoId) + .filter(id => !!id) // get the id and email doc ids let keys = allUsers.rows.map((row: any) => row.id) - keys = keys.concat(allEmails) + keys = keys.concat(allEmails).concat(allSsoIds) const platformDb = platform.getPlatformDB()