1
0
mirror of https://github.com/bitwarden/server synced 2026-01-17 07:53:36 +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,27 @@
CREATE PROCEDURE [dbo].[Cipher_Move]
@Ids AS [dbo].[GuidIdArray] READONLY,
@FolderId AS UNIQUEIDENTIFIER,
@UserId AS UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
;WITH [CTE] AS (
SELECT
[Id],
[Edit],
[FolderId]
FROM
[dbo].[UserCipherDetails](@UserId)
)
UPDATE
[CTE]
SET
[FolderId] = @FolderId
WHERE
[Edit] = 1
AND [Id] IN (@Ids)
EXEC [dbo].[User_BumpAccountRevisionDate] @UserId
-- TODO: What if some that were updated were organization ciphers? Then bump by org ids.
END