maintenance expiration vs build date checking code

This commit is contained in:
2022-08-05 23:31:37 +00:00
parent 379ba76b31
commit d95510cf48
8 changed files with 96 additions and 14 deletions

View File

@@ -799,7 +799,7 @@ namespace AyaNova.Core
throw new ApplicationException("E1020 - Can't install a trial key into a non empty AyaNova database. Erase the database first.");
}
//TODO: TECHCOUNT - new license causes exceeding count?
//TECHCOUNT - new license causes exceeding count?
long NewTechCount = ParsedNewKey.GetLicenseFeature(SERVICE_TECHS_FEATURE_NAME).Count;
if (await AyaNova.Biz.UserBiz.ActiveCountAsync() > NewTechCount)
{
@@ -925,6 +925,15 @@ EQIDAQAB
#endregion get values
//Check if attempting to use a build of AyaNova that is newer than maintenance subscription expiry
if (MExBB(Util.FileUtil.GetLinkerTimestampUtc(System.Reflection.Assembly.GetExecutingAssembly()), key))
{
Console.WriteLine("E1020 - Not licensed for this version of AyaNova. Fix: downgrade back to previous version in use or contact technical support for options.");
//NOTE: VERSION-TOO-NEW bit below is checked for in startup.cs DO NOT remove this without fixing the side effects
throw new ApplicationException("E1020 VERSION-TOO-NEW - Not licensed for this version of AyaNova. Fix: downgrade back to previous version in use or contact technical support for options.");
}
//All is well return key
return key;
@@ -942,6 +951,12 @@ EQIDAQAB
#region Validate Build date against maintenance date in license
//MaintenanceExpirationBeforeBuild?
internal static bool MExBB(DateTime dtB, AyaNovaLicenseKey k) => k.MaintenanceExpiration < dtB;
#endregion
}//eoc