1
0
mirror of https://github.com/bitwarden/server synced 2025-12-27 21:53:24 +00:00

add Archives column to ciphers table

This commit is contained in:
jaasen-livefront
2025-12-02 14:40:02 -08:00
parent de5a81bdc4
commit 80d1c3af09
3 changed files with 203 additions and 9 deletions

View File

@@ -28,6 +28,12 @@ SELECT
C.[DeletedDate],
C.[Reprompt],
C.[Key],
C.[ArchivedDate]
CASE
WHEN
@UserId IS NULL
OR C.[Archives] IS NULL
THEN NULL
ELSE TRY_CONVERT(DATETIME2(7), JSON_VALUE(C.[Archives], CONCAT('$."', @UserId, '"')))
END [ArchivedDate]
FROM
[dbo].[Cipher] C
[dbo].[Cipher] C;

View File

@@ -12,16 +12,29 @@ WITH [CTE] AS (
AND [Status] = 2 -- Confirmed
)
SELECT
C.*,
C.Id,
C.UserId,
C.OrganizationId,
C.Type,
C.Data,
C.Attachments,
C.CreationDate,
C.RevisionDate,
C.Favorite,
C.FolderId,
C.DeletedDate,
C.ArchivedDate,
C.Reprompt,
C.[Key],
CASE
WHEN COALESCE(CU.[ReadOnly], CG.[ReadOnly], 0) = 0
THEN 1
ELSE 0
END [Edit],
CASE
WHEN COALESCE(CU.[HidePasswords], CG.[HidePasswords], 0) = 0
THEN 1
ELSE 0
WHEN COALESCE(CU.[HidePasswords], CG.[HidePasswords], 0) = 0
THEN 1
ELSE 0
END [ViewPassword],
CASE
WHEN COALESCE(CU.[Manage], CG.[Manage], 0) = 1
@@ -56,12 +69,25 @@ WHERE
UNION ALL
SELECT
*,
C.Id,
C.UserId,
C.OrganizationId,
C.Type,
C.Data,
C.Attachments,
C.CreationDate,
C.RevisionDate,
C.Favorite,
C.FolderId,
C.DeletedDate,
C.ArchivedDate,
C.Reprompt,
C.[Key],
1 [Edit],
1 [ViewPassword],
1 [Manage],
0 [OrganizationUseTotp]
FROM
[dbo].[CipherDetails](@UserId)
[dbo].[CipherDetails](@UserId) AS C
WHERE
[UserId] = @UserId
C.[UserId] = @UserId;