mirror of
https://github.com/bitwarden/server.git
synced 2025-05-24 04:51:03 -05:00
enable the downgrade of free org
This commit is contained in:
parent
9a7fddd77c
commit
8ff30863ee
@ -255,6 +255,12 @@ public class OrganizationsController : Controller
|
|||||||
Seats = organization.Seats
|
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);
|
UpdateOrganization(organization, model);
|
||||||
|
|
||||||
var plan = await _pricingClient.GetPlanOrThrow(organization.PlanType);
|
var plan = await _pricingClient.GetPlanOrThrow(organization.PlanType);
|
||||||
@ -484,6 +490,11 @@ public class OrganizationsController : Controller
|
|||||||
organization.GatewayCustomerId = model.GatewayCustomerId;
|
organization.GatewayCustomerId = model.GatewayCustomerId;
|
||||||
organization.GatewaySubscriptionId = model.GatewaySubscriptionId;
|
organization.GatewaySubscriptionId = model.GatewaySubscriptionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model.PlanType == PlanType.Free && organization.GatewaySubscriptionId is not null)
|
||||||
|
{
|
||||||
|
organization.GatewaySubscriptionId = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandlePotentialProviderSeatScalingAsync(
|
private async Task HandlePotentialProviderSeatScalingAsync(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user