From 34f366585dc53334f23102cdbf1d3bcbb63ce36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Thu, 5 Oct 2023 13:46:07 +0200 Subject: [PATCH] (core) Removing org check in the closeOrg endpoint. Summary: Fixing a bug: account couldn't be closed when there was a team site shared with everyone. Endpoint was checking if there are any other team sites available, but this is already tested in "Doom" in a better way, so this check was removed. Test Plan: New test Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4067 --- app/server/lib/FlexServer.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/server/lib/FlexServer.ts b/app/server/lib/FlexServer.ts index 30a72f17..73eb084c 100644 --- a/app/server/lib/FlexServer.ts +++ b/app/server/lib/FlexServer.ts @@ -1271,16 +1271,8 @@ export class FlexServer implements GristServer { // delete user as an admin, as we need to remove other resources that user // might not have access to. - // First make sure user is not a member of any team site. We don't know yet - // what to do with orphaned documents. - const result = await this._dbManager.getOrgs(userId, null); - this._dbManager.checkQueryResult(result); - const orgs = this._dbManager.unwrapQueryResult(result); - if (orgs.some(org => !org.ownerId)) { - throw new ApiError("Cannot delete account with team sites", 400); - } - - // Reuse Doom cli tool for account deletion. + // Reuse Doom cli tool for account deletion. It won't allow to delete account if it has access + // to other (not public) team sites. const doom = await createDoom(req); await doom.deleteUser(userId); return resp.status(200).json(true);