1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

max additional users check

This commit is contained in:
Kyle Spearrin 2017-04-08 10:52:10 -04:00
parent cc7fd61c85
commit 6467cafde3
3 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ namespace Bit.Core.Models.StaticStore
public PlanType Type { get; set; }
public short BaseUsers { get; set; }
public bool CanBuyAdditionalUsers { get; set; }
public short? MaxAdditionalUsers { get; set; }
public bool CanMonthly { get; set; }
public decimal BaseMonthlyPrice { get; set; }
public decimal UserMonthlyPrice { get; set; }

View File

@ -87,6 +87,12 @@ namespace Bit.Core.Services
StripeCustomer customer = null;
StripeSubscription subscription = null;
if(signup.AdditionalUsers > plan.MaxAdditionalUsers.GetValueOrDefault(0))
{
throw new BadRequestException($"Selected plan allows a maximum of " +
$"{plan.MaxAdditionalUsers.GetValueOrDefault(0)} additional users.");
}
if(plan.Type == Enums.PlanType.Free)
{
var ownerExistingOrgCount =

View File

@ -106,6 +106,7 @@ namespace Bit.Core.Utilities
BaseAnnualPrice = 12,
UserAnnualPrice = 12,
CanBuyAdditionalUsers = true,
MaxAdditionalUsers = 5,
CanMonthly = false,
Name = "Personal",
StripeAnnualPlanId = "personal-annual",