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:
27
src/Sql/dbo/Stored Procedures/Cipher_Move.sql
Normal file
27
src/Sql/dbo/Stored Procedures/Cipher_Move.sql
Normal 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
|
||||
Reference in New Issue
Block a user