1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-23 20:41:04 -05:00

enable the downgrade of free org

This commit is contained in:
Cy Okeke 2025-04-28 12:15:21 +01:00
parent 9a7fddd77c
commit 8ff30863ee
No known key found for this signature in database
GPG Key ID: 88B341B55C84B45C

View File

@ -255,6 +255,12 @@ public class OrganizationsController : Controller
Seats = organization.Seats
};
if (model.PlanType == PlanType.Free && model.Seats > 2)
{
TempData["Error"] = "Organizations with more than 2 seats cannot be downgraded to the Free plan";
return RedirectToAction("Edit", new { id });
}
UpdateOrganization(organization, model);
var plan = await _pricingClient.GetPlanOrThrow(organization.PlanType);
@ -484,6 +490,11 @@ public class OrganizationsController : Controller
organization.GatewayCustomerId = model.GatewayCustomerId;
organization.GatewaySubscriptionId = model.GatewaySubscriptionId;
}
if (model.PlanType == PlanType.Free && organization.GatewaySubscriptionId is not null)
{
organization.GatewaySubscriptionId = null;
}
}
private async Task HandlePotentialProviderSeatScalingAsync(