mirror of
https://github.com/bitwarden/server
synced 2026-01-03 17:14:00 +00:00
update cipher archive/unarchive and cipher deatils query
This commit is contained in:
@@ -25,7 +25,10 @@ public class Cipher : ITableObject<Guid>, ICloneable
|
||||
public DateTime? DeletedDate { get; set; }
|
||||
public Enums.CipherRepromptType? Reprompt { get; set; }
|
||||
public string Key { get; set; }
|
||||
// Deprecated. Left for backwards compatibility with old archive handling.
|
||||
// Remove after all clients migrate to the Archives JSON column.
|
||||
public DateTime? ArchivedDate { get; set; }
|
||||
public string Archives { get; set; }
|
||||
|
||||
public void SetNewId()
|
||||
{
|
||||
|
||||
@@ -34,7 +34,9 @@ public class CipherDetailsQuery : IQuery<CipherDetails>
|
||||
FolderId = (_ignoreFolders || !_userId.HasValue || c.Folders == null || !c.Folders.ToLowerInvariant().Contains(_userId.Value.ToString())) ?
|
||||
null :
|
||||
CoreHelpers.LoadClassFromJsonData<Dictionary<Guid, Guid>>(c.Folders)[_userId.Value],
|
||||
ArchivedDate = c.ArchivedDate,
|
||||
ArchivedDate = !_userId.HasValue || c.Archives == null || !c.Archives.ToLowerInvariant().Contains(_userId.Value.ToString()) ?
|
||||
null :
|
||||
CoreHelpers.LoadClassFromJsonData<Dictionary<Guid, DateTime>>(c.Archives)[_userId.Value],
|
||||
};
|
||||
return query;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ BEGIN
|
||||
UPDATE
|
||||
[dbo].[Cipher]
|
||||
SET
|
||||
[ArchivedDate] = @UtcNow,
|
||||
[ArchivedDate] = JSON_MODIFY(
|
||||
COALESCE([Archives], N'{}'),
|
||||
'$."' + CONVERT(NVARCHAR(36), @UserId) + '"',
|
||||
@UtcNow
|
||||
),
|
||||
[RevisionDate] = @UtcNow
|
||||
WHERE
|
||||
[Id] IN (SELECT [Id] FROM #Temp)
|
||||
|
||||
@@ -26,7 +26,11 @@ BEGIN
|
||||
UPDATE
|
||||
[dbo].[Cipher]
|
||||
SET
|
||||
[ArchivedDate] = NULL,
|
||||
[Archives] = JSON_MODIFY(
|
||||
COALESCE([Archives], N'{}'),
|
||||
'$."' + CONVERT(NVARCHAR(36), @UserId) + '"',
|
||||
NULL
|
||||
),
|
||||
[RevisionDate] = @UtcNow
|
||||
WHERE
|
||||
[Id] IN (SELECT [Id] FROM #Temp)
|
||||
|
||||
Reference in New Issue
Block a user