mirror of
https://github.com/bitwarden/server
synced 2026-01-31 00:33:17 +00:00
Main fix: only assign new key value where old keys are not set and new keys have been provided. Refactors: - use consistent DTO model for keypairs - delete duplicate property assignment for new orgs
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
// FIXME: Update this file to be null safe and then delete the line below
|
|
#nullable disable
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Bit.Core.Billing.Enums;
|
|
using Bit.Core.Models.Business;
|
|
|
|
namespace Bit.Api.AdminConsole.Models.Request.Organizations;
|
|
|
|
public class OrganizationUpgradeRequestModel
|
|
{
|
|
[StringLength(50)]
|
|
public string BusinessName { get; set; }
|
|
public PlanType PlanType { get; set; }
|
|
[Range(0, int.MaxValue)]
|
|
public int AdditionalSeats { get; set; }
|
|
[Range(0, 99)]
|
|
public short? AdditionalStorageGb { get; set; }
|
|
[Range(0, int.MaxValue)]
|
|
public int? AdditionalSmSeats { get; set; }
|
|
[Range(0, int.MaxValue)]
|
|
public int? AdditionalServiceAccounts { get; set; }
|
|
[Required]
|
|
public bool UseSecretsManager { get; set; }
|
|
public bool PremiumAccessAddon { get; set; }
|
|
public string BillingAddressCountry { get; set; }
|
|
public string BillingAddressPostalCode { get; set; }
|
|
public OrganizationKeysRequestModel Keys { get; set; }
|
|
|
|
public OrganizationUpgrade ToOrganizationUpgrade()
|
|
{
|
|
var orgUpgrade = new OrganizationUpgrade
|
|
{
|
|
AdditionalSeats = AdditionalSeats,
|
|
AdditionalStorageGb = AdditionalStorageGb.GetValueOrDefault(),
|
|
AdditionalServiceAccounts = AdditionalServiceAccounts.GetValueOrDefault(0),
|
|
AdditionalSmSeats = AdditionalSmSeats.GetValueOrDefault(0),
|
|
UseSecretsManager = UseSecretsManager,
|
|
BusinessName = BusinessName,
|
|
Plan = PlanType,
|
|
PremiumAccessAddon = PremiumAccessAddon,
|
|
TaxInfo = new TaxInfo()
|
|
{
|
|
BillingAddressCountry = BillingAddressCountry,
|
|
BillingAddressPostalCode = BillingAddressPostalCode
|
|
},
|
|
Keys = Keys?.ToPublicKeyEncryptionKeyPairData()
|
|
};
|
|
|
|
return orgUpgrade;
|
|
}
|
|
}
|