mirror of
https://github.com/bitwarden/server.git
synced 2025-05-31 00:00:34 -05:00
org usegroups check on collection save with groups
This commit is contained in:
parent
71e9e82ea1
commit
07878cbaeb
@ -33,15 +33,15 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveAsync(Collection collection, IEnumerable<Guid> groupIds = null)
|
public async Task SaveAsync(Collection collection, IEnumerable<Guid> groupIds = null)
|
||||||
{
|
|
||||||
if(collection.Id == default(Guid))
|
|
||||||
{
|
{
|
||||||
var org = await _organizationRepository.GetByIdAsync(collection.OrganizationId);
|
var org = await _organizationRepository.GetByIdAsync(collection.OrganizationId);
|
||||||
if(org == null)
|
if(org == null)
|
||||||
{
|
{
|
||||||
throw new BadRequestException("Org not found");
|
throw new BadRequestException("Organization not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(collection.Id == default(Guid))
|
||||||
|
{
|
||||||
if(org.MaxCollections.HasValue)
|
if(org.MaxCollections.HasValue)
|
||||||
{
|
{
|
||||||
var collectionCount = await _collectionRepository.GetCountByOrganizationIdAsync(org.Id);
|
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);
|
await _collectionRepository.CreateAsync(collection);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(groupIds == null)
|
if(groupIds == null || !org.UseGroups)
|
||||||
{
|
{
|
||||||
await _collectionRepository.ReplaceAsync(collection);
|
await _collectionRepository.ReplaceAsync(collection);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user