1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-27 22:34:54 -05:00

Reordered properties so that they appear in order according to their version number first, then data type, then name

This commit is contained in:
Conner Turnbull 2025-05-20 15:16:04 -04:00
parent f4031fc7f0
commit 7132ae5973
No known key found for this signature in database
2 changed files with 62 additions and 59 deletions

View File

@ -8,33 +8,33 @@ namespace Bit.Core.Models.Business;
public abstract class BaseLicense : ILicense
{
[LicenseVersion(1)]
public string LicenseKey { get; set; }
[LicenseVersion(1)]
public Guid Id { get; set; }
[LicenseVersion(1)]
public string Name { get; set; }
[LicenseVersion(1)]
public int Version { get; set; }
[LicenseIgnore(includeInHash: false)]
public DateTime Issued { get; set; }
[LicenseIgnore(includeInHash: false)]
public DateTime? Refresh { get; set; }
[LicenseVersion(1)]
public DateTime? Expires { get; set; }
[LicenseVersion(1)]
[LicenseIgnore(includeInHash: false)]
public DateTime? Refresh { get; set; }
[LicenseVersion(1)]
public int Version { get; set; }
[LicenseVersion(1)]
public bool Trial { get; set; }
[LicenseIgnore]
public LicenseType? LicenseType { get; set; }
[LicenseVersion(1)]
public string LicenseKey { get; set; }
[LicenseVersion(1)]
public string Name { get; set; }
[LicenseVersion(1)]
[LicenseIgnore(includeInHash: false)]
public string Hash { get; set; }
@ -42,6 +42,9 @@ public abstract class BaseLicense : ILicense
[LicenseIgnore]
public string Signature { get; set; }
[LicenseIgnore]
public LicenseType? LicenseType { get; set; }
[LicenseIgnore]
public string Token { get; set; }

View File

@ -137,71 +137,79 @@ public class OrganizationLicense : BaseLicense
Signature = Convert.ToBase64String(licenseService.SignLicense(this));
}
/// <summary>
/// Represents the current version of the license format. Should be updated whenever new fields are added.
/// </summary>
/// <remarks>Intentionally set one version behind to allow self hosted users some time to update before
/// getting out of date license errors
/// </remarks>
public const int CurrentLicenseFileVersion = 15;
[LicenseVersion(1)]
public Guid InstallationId { get; set; }
[LicenseVersion(1)]
public int? Seats { get; set; }
[LicenseVersion(1)]
public short? MaxCollections { get; set; }
[LicenseVersion(1)]
public short? MaxStorageGb { get; set; }
[LicenseVersion(1)]
public bool Enabled { get; set; }
[LicenseVersion(1)]
public bool SelfHost { get; set; }
[LicenseVersion(1)]
public bool UseDirectory { get; set; }
[LicenseVersion(1)]
public bool UseGroups { get; set; }
[LicenseVersion(1)]
public bool UseTotp { get; set; }
[LicenseVersion(1)]
public string BillingEmail { get; set; }
[LicenseVersion(1)]
public string BusinessName { get; set; }
[LicenseVersion(1)]
public bool Enabled { get; set; }
[LicenseVersion(1)]
public string Plan { get; set; }
[LicenseVersion(1)]
public PlanType PlanType { get; set; }
[LicenseVersion(1)]
public int? Seats { get; set; }
[LicenseVersion(1)]
public short? MaxCollections { get; set; }
[LicenseVersion(6)]
public bool UsePolicies { get; set; }
[LicenseVersion(7)]
public bool UseSso { get; set; }
[LicenseVersion(9)]
public bool UseKeyConnector { get; set; }
[LicenseVersion(10)]
public bool UseScim { get; set; }
[LicenseVersion(1)]
public bool UseGroups { get; set; }
[LicenseVersion(2)]
public bool UsersGetPremium { get; set; }
[LicenseVersion(3)]
public bool UseEvents { get; set; }
[LicenseVersion(1)]
public bool UseDirectory { get; set; }
[LicenseVersion(1)]
public bool UseTotp { get; set; }
[LicenseVersion(4)]
public bool Use2fa { get; set; }
[LicenseVersion(5)]
public bool UseApi { get; set; }
[LicenseVersion(6)]
public bool UsePolicies { get; set; }
[LicenseVersion(7)]
public bool UseSso { get; set; }
[LicenseVersion(8)]
public bool UseResetPassword { get; set; }
[LicenseVersion(1)]
public short? MaxStorageGb { get; set; }
[LicenseVersion(9)]
public bool UseKeyConnector { get; set; }
[LicenseVersion(1)]
public bool SelfHost { get; set; }
[LicenseVersion(2)]
public bool UsersGetPremium { get; set; }
[LicenseVersion(10)]
public bool UseScim { get; set; }
[LicenseVersion(11)]
public bool UseCustomPermissions { get; set; }
@ -221,9 +229,6 @@ public class OrganizationLicense : BaseLicense
[LicenseVersion(13)]
public int? SmServiceAccounts { get; set; }
[LicenseIgnore]
public bool UseRiskInsights { get; set; }
// Deprecated. Left for backwards compatibility with old license versions.
[LicenseVersion(14)]
public bool LimitCollectionCreationDeletion { get; set; } = true;
@ -238,13 +243,8 @@ public class OrganizationLicense : BaseLicense
[LicenseIgnore]
public bool UseAdminSponsoredFamilies { get; set; }
/// <summary>
/// Represents the current version of the license format. Should be updated whenever new fields are added.
/// </summary>
/// <remarks>Intentionally set one version behind to allow self hosted users some time to update before
/// getting out of date license errors
/// </remarks>
public const int CurrentLicenseFileVersion = 15;
[LicenseIgnore]
public bool UseRiskInsights { get; set; }
private bool ValidLicenseVersion
{