mirror of
https://github.com/bitwarden/server.git
synced 2025-05-22 12:04:27 -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 isDowngradingToFree = organization.PlanType != PlanType.Free && model.PlanType.Value == PlanType.Free;
|
||||
switch (isDowngradingToFree)
|
||||
if (isDowngradingToFree)
|
||||
{
|
||||
case true when model.Seats.HasValue && model.Seats.Value > freePlan.PasswordManager.MaxSeats:
|
||||
if (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";
|
||||
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.";
|
||||
return RedirectToAction("Edit", new { id });
|
||||
case true:
|
||||
model.MaxStorageGb = null;
|
||||
model.ExpirationDate = null;
|
||||
model.Enabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
model.MaxStorageGb = null;
|
||||
model.ExpirationDate = null;
|
||||
model.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user