Browse Source

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

pull/1610/head
Matt Gibson 4 years ago committed by GitHub
parent
commit
9de9be8f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/Core/Services/Implementations/OrganizationService.cs

14
src/Core/Services/Implementations/OrganizationService.cs

@ -1072,10 +1072,13 @@ namespace Bit.Core.Services @@ -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 @@ -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)
{

Loading…
Cancel
Save