1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-23 12:25:16 +01:00

fix sproc

This commit is contained in:
Brandon 2024-11-20 14:15:39 -05:00
parent 8280929d64
commit 08ae01c4a9
No known key found for this signature in database
GPG Key ID: A0E0EF0B207BA40D

View File

@ -29,7 +29,7 @@ BEGIN
FROM
[dbo].[Cipher]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
SET @BatchSize = @@ROWCOUNT
@ -43,28 +43,28 @@ BEGIN
FROM
[dbo].[WebAuthnCredential]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete folders
DELETE
FROM
[dbo].[Folder]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete AuthRequest, must be before Device
DELETE
FROM
[dbo].[AuthRequest]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete devices
DELETE
FROM
[dbo].[Device]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete collection users
DELETE
@ -74,7 +74,7 @@ BEGIN
INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = CU.[OrganizationUserId]
WHERE
OU.[UserId] IN (@ParsedIds)
OU.[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete group users
DELETE
@ -84,7 +84,7 @@ BEGIN
INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = GU.[OrganizationUserId]
WHERE
OU.[UserId] IN (@ParsedIds)
OU.[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete AccessPolicy
DELETE
@ -94,65 +94,65 @@ BEGIN
INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = AP.[OrganizationUserId]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete organization users
DELETE
FROM
[dbo].[OrganizationUser]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete provider users
DELETE
FROM
[dbo].[ProviderUser]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete SSO Users
DELETE
FROM
[dbo].[SsoUser]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete Emergency Accesses
DELETE
FROM
[dbo].[EmergencyAccess]
WHERE
[GrantorId] in (@ParsedIds)
[GrantorId] IN (SELECT * FROM @ParsedIds)
OR
[GranteeId] in (@ParsedIds)
[GranteeId] IN (SELECT * FROM @ParsedIds)
-- Delete Sends
DELETE
FROM
[dbo].[Send]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete Notification Status
DELETE
FROM
[dbo].[NotificationStatus]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Delete Notification
DELETE
FROM
[dbo].[Notification]
WHERE
[UserId] IN (@ParsedIds)
[UserId] IN (SELECT * FROM @ParsedIds)
-- Finally, delete the user
DELETE
FROM
[dbo].[User]
WHERE
[Id] in (@ParsedIds)
[Id] IN (SELECT * FROM @ParsedIds)
COMMIT TRANSACTION User_DeleteById
END