1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 14:54:50 -05:00

org usegroups check on collection save with groups

This commit is contained in:
Kyle Spearrin 2017-05-09 14:20:47 -04:00
parent 71e9e82ea1
commit 07878cbaeb

View File

@ -34,14 +34,14 @@ namespace Bit.Core.Services
public async Task SaveAsync(Collection collection, IEnumerable<Guid> 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);
}