1
0
mirror of https://github.com/bitwarden/server synced 2026-01-20 01:13:18 +00:00

centralize select logic to UserCipherDetails func

- Also create cipher bulk move and delete sprocs
This commit is contained in:
Kyle Spearrin
2017-06-08 23:49:55 -04:00
parent 151eae2f05
commit d3499dce84
7 changed files with 100 additions and 103 deletions

View File

@@ -0,0 +1,24 @@
CREATE PROCEDURE [dbo].[Cipher_Delete]
@Ids AS [dbo].[GuidIdArray] READONLY,
@UserId AS UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
;WITH [CTE] AS (
SELECT
[Id],
[Edit]
FROM
[dbo].[UserCipherDetails](@UserId)
)
DELETE
FROM
[CTE]
WHERE
[Edit] = 1
AND [Id] IN (@Ids)
EXEC [dbo].[User_BumpAccountRevisionDate] @UserId
-- TODO: What if some that were deleted were organization ciphers? Then bump by org ids.
END