From 07878cbaebff0eed3201e641f92bdab6dbab4415 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 9 May 2017 14:20:47 -0400 Subject: [PATCH] org usegroups check on collection save with groups --- .../Implementations/CollectionService.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Core/Services/Implementations/CollectionService.cs b/src/Core/Services/Implementations/CollectionService.cs index a79529a528..7bb1ef5047 100644 --- a/src/Core/Services/Implementations/CollectionService.cs +++ b/src/Core/Services/Implementations/CollectionService.cs @@ -34,14 +34,14 @@ namespace Bit.Core.Services public async Task SaveAsync(Collection collection, IEnumerable groupIds = null) { + var org = await _organizationRepository.GetByIdAsync(collection.OrganizationId); + if(org == null) + { + throw new BadRequestException("Organization not found"); + } + if(collection.Id == default(Guid)) { - var org = await _organizationRepository.GetByIdAsync(collection.OrganizationId); - if(org == null) - { - throw new BadRequestException("Org not found"); - } - if(org.MaxCollections.HasValue) { var collectionCount = await _collectionRepository.GetCountByOrganizationIdAsync(org.Id); @@ -52,7 +52,7 @@ namespace Bit.Core.Services } } - if(groupIds == null) + if(groupIds == null || !org.UseGroups) { await _collectionRepository.CreateAsync(collection); } @@ -63,7 +63,7 @@ namespace Bit.Core.Services } else { - if(groupIds == null) + if(groupIds == null || !org.UseGroups) { await _collectionRepository.ReplaceAsync(collection); }