1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00

[AC-1578] Fixed issue where legacy plans couldn't sign up for SM (#3400)

* Fixed issue where legacy plans couldn't sign up for SM

* Removed unit test that check to make sure enterprise 2019 couldn't be upgraded to SM
This commit is contained in:
Conner Turnbull 2023-11-03 15:32:30 -04:00 committed by GitHub
parent e317833904
commit 62e99bcaf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 21 deletions

View File

@ -1811,9 +1811,9 @@ public class OrganizationService : IOrganizationService
private static void ValidatePlan(Models.StaticStore.Plan plan, int additionalSeats, string productType)
{
if (plan is not { LegacyYear: null })
if (plan is null)
{
throw new BadRequestException($"Invalid {productType} plan selected.");
throw new BadRequestException($"{productType} Plan was null.");
}
if (plan.Disabled)
@ -1829,6 +1829,11 @@ public class OrganizationService : IOrganizationService
public void ValidatePasswordManagerPlan(Models.StaticStore.Plan plan, OrganizationUpgrade upgrade)
{
if (plan is not { LegacyYear: null })
{
throw new BadRequestException("Invalid Password Manager plan selected.");
}
ValidatePlan(plan, upgrade.AdditionalSeats, "Password Manager");
if (plan.PasswordManager.BaseSeats + upgrade.AdditionalSeats <= 0)

View File

@ -1788,25 +1788,6 @@ public class OrganizationServiceTests
Assert.Equal(includeProvider, result);
}
[Theory]
[BitAutoData(PlanType.EnterpriseAnnually2019)]
public void ValidateSecretsManagerPlan_ThrowsException_WhenInvalidPlanSelected(
PlanType planType, SutProvider<OrganizationService> sutProvider)
{
var plan = StaticStore.GetPlan(planType);
var signup = new OrganizationUpgrade
{
UseSecretsManager = true,
AdditionalSmSeats = 1,
AdditionalServiceAccounts = 10,
AdditionalSeats = 1
};
var exception = Assert.Throws<BadRequestException>(() => sutProvider.Sut.ValidateSecretsManagerPlan(plan, signup));
Assert.Contains("Invalid Secrets Manager plan selected.", exception.Message);
}
[Theory]
[BitAutoData(PlanType.TeamsAnnually)]
[BitAutoData(PlanType.TeamsMonthly)]