1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-29 23:01:46 +01:00

Only test canScale is an org needs to scale for an invite (#1608)

This commit is contained in:
Matt Gibson 2021-09-28 16:18:44 -04:00 committed by GitHub
parent 182117e1b4
commit 9de9be8f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1072,10 +1072,13 @@ namespace Bit.Core.Services
newSeatsRequired = invites.Sum(i => i.invite.Emails.Count()) - existingEmails.Count() - availableSeats;
}
var (canScale, failureReason) = await CanScaleAsync(organization, newSeatsRequired);
if (!canScale)
if (newSeatsRequired > 0)
{
throw new BadRequestException(failureReason);
var (canScale, failureReason) = await CanScaleAsync(organization, newSeatsRequired);
if (!canScale)
{
throw new BadRequestException(failureReason);
}
}
var invitedAreAllOwners = invites.All(i => i.invite.Type == OrganizationUserType.Owner);
@ -1465,11 +1468,6 @@ namespace Bit.Core.Services
failureReason = "Cannot manage organization users.";
return (false, failureReason);
}
// if (!await _currentContext.OrganizationOwner(organization.Id))
// {
// failureReason = "Only organization owners can autoscale seats.";
// return (false, failureReason);
// }
if (seatsToAdd < 1)
{