1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[AC-2662] Remove FC MVP from CurrentContext (#4460)

* chore: remove EditAssignedCollections from current context, refs AC-2662

* chore: remove DeleteAssignedCollections from CurrentContext, refs AC-2662

* chore: remove ViewAssignedCollections from CurrentContext, refs AC-2662
This commit is contained in:
Vincent Salucci
2024-07-08 14:40:35 -05:00
committed by GitHub
parent b61b1eadaf
commit 3f443ac49b
6 changed files with 0 additions and 69 deletions

View File

@ -979,9 +979,7 @@ OrganizationUserInvite invite, SutProvider<OrganizationService> sutProvider)
currentContext.ManageSso(organization.Id).Returns(true);
currentContext.AccessEventLogs(organization.Id).Returns(true);
currentContext.AccessImportExport(organization.Id).Returns(true);
currentContext.DeleteAssignedCollections(organization.Id).Returns(true);
currentContext.EditAnyCollection(organization.Id).Returns(true);
currentContext.EditAssignedCollections(organization.Id).Returns(true);
currentContext.ManageResetPassword(organization.Id).Returns(true);
currentContext.GetOrganization(organization.Id)
.Returns(new CurrentContextOrganization()

View File

@ -181,27 +181,6 @@ public class CollectionServiceTest
.LogOrganizationUserEventAsync(default, default);
}
[Theory, BitAutoData]
public async Task GetOrganizationCollectionsAsync_WithViewAssignedCollectionsTrue_ReturnsAssignedCollections(
CollectionDetails collectionDetails, Guid organizationId, Guid userId, SutProvider<CollectionService> sutProvider)
{
collectionDetails.OrganizationId = organizationId;
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(userId);
sutProvider.GetDependency<ICollectionRepository>()
.GetManyByUserIdAsync(userId, Arg.Any<bool>())
.Returns(new List<CollectionDetails> { collectionDetails });
sutProvider.GetDependency<ICurrentContext>().ViewAssignedCollections(organizationId).Returns(true);
var result = await sutProvider.Sut.GetOrganizationCollectionsAsync(organizationId);
Assert.Single(result);
Assert.Equal(collectionDetails, result.First());
await sutProvider.GetDependency<ICollectionRepository>().DidNotReceiveWithAnyArgs().GetManyByOrganizationIdAsync(default);
await sutProvider.GetDependency<ICollectionRepository>().Received(1).GetManyByUserIdAsync(userId, Arg.Any<bool>());
}
[Theory, BitAutoData]
public async Task GetOrganizationCollectionsAsync_WithViewAllCollectionsTrue_ReturnsAllOrganizationCollections(
Collection collection, Guid organizationId, Guid userId, SutProvider<CollectionService> sutProvider)
@ -210,7 +189,6 @@ public class CollectionServiceTest
sutProvider.GetDependency<ICollectionRepository>()
.GetManyByOrganizationIdAsync(organizationId)
.Returns(new List<Collection> { collection });
sutProvider.GetDependency<ICurrentContext>().ViewAssignedCollections(organizationId).Returns(true);
sutProvider.GetDependency<ICurrentContext>().ViewAllCollections(organizationId).Returns(true);
var result = await sutProvider.Sut.GetOrganizationCollectionsAsync(organizationId);
@ -226,8 +204,6 @@ public class CollectionServiceTest
public async Task GetOrganizationCollectionsAsync_WithViewAssignedCollectionsFalse_ThrowsBadRequestException(
Guid organizationId, SutProvider<CollectionService> sutProvider)
{
sutProvider.GetDependency<ICurrentContext>().ViewAssignedCollections(organizationId).Returns(false);
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.GetOrganizationCollectionsAsync(organizationId));
await sutProvider.GetDependency<ICollectionRepository>().DidNotReceiveWithAnyArgs().GetManyByOrganizationIdAsync(default);