Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete OrgUsers When Deleting An Org #964

Merged
merged 2 commits into from
Oct 13, 2020

Conversation

addisonbeck
Copy link
Contributor

Bug 🕷

Currently deleting an organization leaves some orphaned data in CollectionUser and OrganizationUser records.

This may have never been an issue before, but now it is causing problems with the OnlyOrg policy. If an organization has OnlyOrg enabled anyone that may have been left orphaned by a deleted organization can not join the org because an OrgUser record still exists for them from the deleted org.

Fix 🔨

Delete OrgUser records and CollectionUser records when deleting an organization

@addisonbeck addisonbeck added the bug label Oct 8, 2020
@addisonbeck addisonbeck requested a review from a team October 8, 2020 22:29
DELETE
FROM
[dbo].[OrganizationUser]
WHERE [OrganizationId] = @Id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where condition on new line like others

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -37,11 +37,24 @@ BEGIN
WHERE
[OrganizationId] = @Id

DELETE cu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we use upper case for these abbreviations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@addisonbeck addisonbeck merged commit dfe5c57 into master Oct 13, 2020
@addisonbeck addisonbeck deleted the DeleteOrgDoesntDeleteOrgUsers branch October 13, 2020 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants