mirror of
https://github.com/bitwarden/server.git
synced 2025-12-10 00:42:07 -06:00
update archive ciphers command to allow org ciphers to be archived
This commit is contained in:
parent
4144ae9ecc
commit
e50fbfbc3e
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user