mirror of
https://github.com/bitwarden/server.git
synced 2025-05-22 20:11:04 -05:00
apply the condition suggestion
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
parent
d9dd428759
commit
cf5ea934ad
@ -259,19 +259,23 @@ public class OrganizationsController : Controller
|
|||||||
{
|
{
|
||||||
var freePlan = await _pricingClient.GetPlanOrThrow(model.PlanType.Value);
|
var freePlan = await _pricingClient.GetPlanOrThrow(model.PlanType.Value);
|
||||||
var isDowngradingToFree = organization.PlanType != PlanType.Free && model.PlanType.Value == PlanType.Free;
|
var isDowngradingToFree = organization.PlanType != PlanType.Free && model.PlanType.Value == PlanType.Free;
|
||||||
switch (isDowngradingToFree)
|
if (isDowngradingToFree)
|
||||||
|
{
|
||||||
|
if (model.Seats.HasValue && model.Seats.Value > freePlan.PasswordManager.MaxSeats)
|
||||||
{
|
{
|
||||||
case true when model.Seats.HasValue && model.Seats.Value > freePlan.PasswordManager.MaxSeats:
|
|
||||||
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxSeats} seats cannot be downgraded to the Free plan";
|
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxSeats} seats cannot be downgraded to the Free plan";
|
||||||
return RedirectToAction("Edit", new { id });
|
return RedirectToAction("Edit", new { id });
|
||||||
case true when model.MaxCollections > freePlan.PasswordManager.MaxCollections:
|
}
|
||||||
|
|
||||||
|
if (model.MaxCollections > freePlan.PasswordManager.MaxCollections)
|
||||||
|
{
|
||||||
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxCollections} collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections.";
|
TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxCollections} collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections.";
|
||||||
return RedirectToAction("Edit", new { id });
|
return RedirectToAction("Edit", new { id });
|
||||||
case true:
|
}
|
||||||
|
|
||||||
model.MaxStorageGb = null;
|
model.MaxStorageGb = null;
|
||||||
model.ExpirationDate = null;
|
model.ExpirationDate = null;
|
||||||
model.Enabled = true;
|
model.Enabled = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user