From 08ae01c4a994d7e77c3689ef38748acc40715345 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 20 Nov 2024 14:15:39 -0500 Subject: [PATCH] fix sproc --- .../Stored Procedures/User_DeleteByIds.sql | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Sql/dbo/Stored Procedures/User_DeleteByIds.sql b/src/Sql/dbo/Stored Procedures/User_DeleteByIds.sql index eaa309786..97ab955f8 100644 --- a/src/Sql/dbo/Stored Procedures/User_DeleteByIds.sql +++ b/src/Sql/dbo/Stored Procedures/User_DeleteByIds.sql @@ -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