1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-12 22:10:50 -05:00

Updated UserLicense to use ValidLicenseVersion

This commit is contained in:
Conner Turnbull 2025-06-09 11:48:59 -04:00
parent a4a9af9863
commit 169f22ef3b
No known key found for this signature in database

View File

@ -60,9 +60,14 @@ public class UserLicense : BaseLicense
[LicenseVersion(1)] [LicenseVersion(1)]
public short? MaxStorageGb { get; set; } public short? MaxStorageGb { get; set; }
private bool ValidLicenseVersion
{
get => Version == 1;
}
public override byte[] GetDataBytes(bool forHash = false) public override byte[] GetDataBytes(bool forHash = false)
{ {
if (Version != 1) if (!ValidLicenseVersion)
{ {
throw new NotSupportedException($"Version {Version} is not supported."); throw new NotSupportedException($"Version {Version} is not supported.");
} }
@ -123,7 +128,7 @@ public class UserLicense : BaseLicense
errorMessages.AppendLine("The license has expired."); errorMessages.AppendLine("The license has expired.");
} }
if (Version != 1) if (!ValidLicenseVersion)
{ {
throw new NotSupportedException($"Version {Version} is not supported."); throw new NotSupportedException($"Version {Version} is not supported.");
} }
@ -179,7 +184,7 @@ public class UserLicense : BaseLicense
return false; return false;
} }
if (Version != 1) if (!ValidLicenseVersion)
{ {
throw new NotSupportedException($"Version {Version} is not supported."); throw new NotSupportedException($"Version {Version} is not supported.");
} }