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:
parent
71e9e82ea1
commit
07878cbaeb
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user