mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +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:
parent
77698c3ee2
commit
e6bb6e1114
@ -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;
|
||||
|
@ -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>())
|
||||
|
Loading…
Reference in New Issue
Block a user