mirror of
https://github.com/bitwarden/server.git
synced 2025-12-11 13:53:48 -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
|
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();
|
.ToList();
|
||||||
|
|
||||||
var revisionDate = await _cipherRepository.ArchiveAsync(archivingCiphers.Select(c => c.Id), archivingUserId);
|
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, false, 1, 0, 1)]
|
||||||
[BitAutoData(false, true, 1, 0, 1)]
|
[BitAutoData(false, true, 1, 0, 1)]
|
||||||
[BitAutoData(true, true, 1, 0, 1)]
|
[BitAutoData(true, true, 1, 0, 1)]
|
||||||
public async Task ArchiveAsync_Works(
|
public async Task ArchiveManyAsync_Works(
|
||||||
bool isEditable, bool hasOrganizationId,
|
bool isEditable, bool hasOrganizationId,
|
||||||
int cipherRepoCalls, int resultCountFromQuery, int pushNotificationsCalls,
|
int cipherRepoCalls, int resultCountFromQuery, int pushNotificationsCalls,
|
||||||
SutProvider<ArchiveCiphersCommand> sutProvider, CipherDetails cipher, User user)
|
SutProvider<ArchiveCiphersCommand> sutProvider, CipherDetails cipher, User user)
|
||||||
@ -49,15 +49,15 @@ public class ArchiveCiphersCommandTest
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitAutoData]
|
[BitAutoData]
|
||||||
public async Task ArchiveAsync_SetsArchivedDateOnReturnedCiphers(
|
public async Task ArchiveManyAsync_SetsArchivedDateOnReturnedCiphers(
|
||||||
SutProvider<ArchiveCiphersCommand> sutProvider,
|
SutProvider<ArchiveCiphersCommand> sutProvider,
|
||||||
CipherDetails cipher,
|
CipherDetails cipher,
|
||||||
User user)
|
User user)
|
||||||
{
|
{
|
||||||
// Arrange: make it archivable
|
// Arrange: make it archivable
|
||||||
cipher.Edit = true;
|
cipher.Edit = true;
|
||||||
cipher.OrganizationId = null;
|
// Allow organization cipher to be archived in this test
|
||||||
cipher.ArchivedDate = null;
|
cipher.OrganizationId = Guid.Parse("3f2504e0-4f89-11d3-9a0c-0305e82c3301");
|
||||||
|
|
||||||
sutProvider.GetDependency<ICipherRepository>()
|
sutProvider.GetDependency<ICipherRepository>()
|
||||||
.GetManyByUserIdAsync(user.Id)
|
.GetManyByUserIdAsync(user.Id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user