1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-24 12:35:25 +01:00

[PM-5788] Ensure Collection Service respects Flexible Collections falg (#3686)

* [PM-5788] Ensure the organization has FC enabled before enforcing a user/group with Manage permissions

* [PM-5788] Fix unit test
This commit is contained in:
Shane Melton 2024-01-22 08:05:42 -08:00 committed by GitHub
parent 77698c3ee2
commit e6bb6e1114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public class CollectionService : ICollectionService
var usersList = users?.ToList();
// If using Flexible Collections - a collection should always have someone with Can Manage permissions
if (_featureService.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1))
if (org.FlexibleCollections && _featureService.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1))
{
var groupHasManageAccess = groupsList?.Any(g => g.Manage) ?? false;
var userHasManageAccess = usersList?.Any(u => u.Manage) ?? false;

View File

@ -112,6 +112,7 @@ public class CollectionServiceTest
[CollectionAccessSelectionCustomize] IEnumerable<CollectionAccessSelection> users, SutProvider<CollectionService> sutProvider)
{
collection.Id = default;
organization.FlexibleCollections = true;
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(organization.Id).Returns(organization);
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1, Arg.Any<bool>())