1
0
mirror of https://github.com/bitwarden/server synced 2026-02-10 05:30:02 +00:00

revert org import logic to preserve archive status for importing org user

This commit is contained in:
John Harrington
2026-01-27 16:36:16 -07:00
parent 05dc452d17
commit 2cac99d6ef
2 changed files with 12 additions and 8 deletions

View File

@@ -361,11 +361,12 @@ public class ImportCiphersAsyncCommandTests
}
/*
* Archive functionality is a per-user function and should only ever be presented to the user who set the archive
* bit to ON for the item. No admin, other user or task should mark items as archived for other users
* Archive functionality is a per-user function. When importing archived ciphers into an organization vault,
* the Archives field should be set for the importing user only. This allows the importing user to see
* items as archived, while other organization members will not see them as archived.
*/
[Theory, BitAutoData]
public async Task ImportIntoOrganizationalVaultAsync_WithArchivedCiphers_DoesNotSetArchives(
public async Task ImportIntoOrganizationalVaultAsync_WithArchivedCiphers_SetsArchivesForImportingUserOnly(
Organization organization,
Guid importingUserId,
OrganizationUser importingOrganizationUser,
@@ -415,7 +416,9 @@ public class ImportCiphersAsyncCommandTests
.CreateAsync(
Arg.Is<List<CipherDetails>>(c =>
c[0].ArchivedDate == archivedDate &&
c[0].Archives == null),
c[0].Archives != null &&
c[0].Archives.Contains(importingUserId.ToString().ToUpperInvariant()) &&
c[0].Archives.Contains(archivedDate.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"))),
Arg.Any<IEnumerable<Collection>>(),
Arg.Any<IEnumerable<CollectionCipher>>(),
Arg.Any<IEnumerable<CollectionUser>>());