update archive ciphers command to allow org ciphers to be archived

This commit is contained in:
jaasen-livefront 2025-12-08 10:19:11 -08:00
parent 4144ae9ecc
commit e50fbfbc3e
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public class ArchiveCiphersCommand : IArchiveCiphersCommand
}
var archivingCiphers = ciphers
.Where(c => cipherIdsSet.Contains(c.Id) && c is { Edit: true, OrganizationId: null, ArchivedDate: null })
.Where(c => cipherIdsSet.Contains(c.Id) && c is { Edit: true, ArchivedDate: null })
.ToList();
var revisionDate = await _cipherRepository.ArchiveAsync(archivingCiphers.Select(c => c.Id), archivingUserId);

View File

@ -20,7 +20,7 @@ public class ArchiveCiphersCommandTest
[BitAutoData(false, false, 1, 0, 1)]
[BitAutoData(false, true, 1, 0, 1)]
[BitAutoData(true, true, 1, 0, 1)]
public async Task ArchiveAsync_Works(
public async Task ArchiveManyAsync_Works(
bool isEditable, bool hasOrganizationId,
int cipherRepoCalls, int resultCountFromQuery, int pushNotificationsCalls,
SutProvider<ArchiveCiphersCommand> sutProvider, CipherDetails cipher, User user)
@ -49,15 +49,15 @@ public class ArchiveCiphersCommandTest
[Theory]
[BitAutoData]
public async Task ArchiveAsync_SetsArchivedDateOnReturnedCiphers(
public async Task ArchiveManyAsync_SetsArchivedDateOnReturnedCiphers(
SutProvider<ArchiveCiphersCommand> sutProvider,
CipherDetails cipher,
User user)
{
// Arrange: make it archivable
cipher.Edit = true;
cipher.OrganizationId = null;
cipher.ArchivedDate = null;
// Allow organization cipher to be archived in this test
cipher.OrganizationId = Guid.Parse("3f2504e0-4f89-11d3-9a0c-0305e82c3301");
sutProvider.GetDependency<ICipherRepository>()
.GetManyByUserIdAsync(user.Id)