mirror of
https://github.com/bitwarden/server.git
synced 2025-04-08 06:28:14 -05:00
Throw error if not enough seats available for a sync (#1241)
* BadRequest if a sync cannot be completed due to seat count * Comment the reason for the suppressed exception
This commit is contained in:
parent
c09ae5f906
commit
584d3e771c
@ -1515,8 +1515,11 @@ namespace Bit.Core.Services
|
|||||||
enoughSeatsAvailable = seatsAvailable >= usersToAdd.Count;
|
enoughSeatsAvailable = seatsAvailable >= usersToAdd.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enoughSeatsAvailable)
|
if (!enoughSeatsAvailable)
|
||||||
{
|
{
|
||||||
|
throw new BadRequestException($"Organization does not have enough seats available. Need {usersToAdd.Count} but {seatsAvailable} available.");
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var user in newUsers)
|
foreach (var user in newUsers)
|
||||||
{
|
{
|
||||||
if (!usersToAdd.Contains(user.ExternalId) || string.IsNullOrWhiteSpace(user.Email))
|
if (!usersToAdd.Contains(user.ExternalId) || string.IsNullOrWhiteSpace(user.Email))
|
||||||
@ -1539,11 +1542,11 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
catch (BadRequestException)
|
catch (BadRequestException)
|
||||||
{
|
{
|
||||||
|
// Thrown when the user is already invited to the organization
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Groups
|
// Groups
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user