(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
This commit is contained in:
Jarosław Sadziński 2023-10-05 13:46:07 +02:00
parent ad299f338a
commit 34f366585d

View File

@ -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);