1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[SM-1075] Fix bulk remove organization users with Secrets Manager (#4197)

* Fix OrganizationUser_DeleteByIds procedure

* Add db migration
This commit is contained in:
Thomas Avery
2024-06-21 17:29:36 -05:00
committed by GitHub
parent c4f176a1c2
commit 8a1b64a21b
2 changed files with 122 additions and 2 deletions

View File

@ -58,11 +58,29 @@ BEGIN
SET @BatchSize = @@ROWCOUNT
COMMIT TRANSACTION GoupUser_DeleteMany_GroupUsers
COMMIT TRANSACTION GroupUser_DeleteMany_GroupUsers
END
SET @BatchSize = 100;
-- Delete User Access Policies
WHILE @BatchSize > 0
BEGIN
BEGIN TRANSACTION AccessPolicy_DeleteMany_Users
DELETE TOP(@BatchSize) AP
FROM
[dbo].[AccessPolicy] AP
INNER JOIN
@Ids I ON I.Id = AP.OrganizationUserId
SET @BatchSize = @@ROWCOUNT
COMMIT TRANSACTION AccessPolicy_DeleteMany_Users
END
EXEC [dbo].[OrganizationSponsorship_OrganizationUsersDeleted] @Ids
SET @BatchSize = 100;
-- Delete OrganizationUsers