diff --git a/src/Admin/AdminConsole/Controllers/OrganizationsController.cs b/src/Admin/AdminConsole/Controllers/OrganizationsController.cs index dd1115de13..c22ee0e9d5 100644 --- a/src/Admin/AdminConsole/Controllers/OrganizationsController.cs +++ b/src/Admin/AdminConsole/Controllers/OrganizationsController.cs @@ -255,15 +255,16 @@ public class OrganizationsController : Controller Seats = organization.Seats }; - if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.Seats > 2) + var plan = await _pricingClient.GetPlanOrThrow(model.PlanType.Value); + if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.Seats > plan.PasswordManager.MaxSeats) { - TempData["Error"] = "Organizations with more than 2 seats cannot be downgraded to the Free plan"; + TempData["Error"] = $"Organizations with more than {plan.PasswordManager.MaxSeats} seats cannot be downgraded to the Free plan"; return RedirectToAction("Edit", new { id }); } - if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.MaxCollections > 2) + if (organization.PlanType != PlanType.Free && model.PlanType == PlanType.Free && model.MaxCollections > plan.PasswordManager.MaxCollections) { - TempData["Error"] = $"Organizations with more than 2 collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections."; + TempData["Error"] = $"Organizations with more than {plan.PasswordManager.MaxCollections} collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections."; return RedirectToAction("Edit", new { id }); } @@ -276,8 +277,6 @@ public class OrganizationsController : Controller UpdateOrganization(organization, model); - var plan = await _pricingClient.GetPlanOrThrow(organization.PlanType); - if (organization.UseSecretsManager && !plan.SupportsSecretsManager) { TempData["Error"] = "Plan does not support Secrets Manager";