subscription license code additions
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateFullPaths>true</GenerateFullPaths>
|
||||
<Version>8.0.3</Version>
|
||||
<FileVersion>8.0.3.0</FileVersion>
|
||||
<Version>8.0.4</Version>
|
||||
<FileVersion>8.0.4.0</FileVersion>
|
||||
<ApplicationIcon>ayanova.ico</ApplicationIcon>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
<noWarn>1591</noWarn>
|
||||
|
||||
@@ -603,11 +603,13 @@ namespace AyaNova
|
||||
|
||||
|
||||
//Initialize license unless it doesn't exist yet then wait and do it after schema update and fingerprint
|
||||
//this is necessary to accomodate checking build date against subscription and preventing schema update if they upgrade but are not entitled to
|
||||
//this is necessary to accomodate checking build date against subscription or perpetual / subscription vs build type and preventing schema update if they upgrade but are not entitled to
|
||||
//so they don't fuck their database
|
||||
//if there is a build date issue or a license issue it will fail with an exception, log to log file, log to console and not go beyond the license check preserving the db
|
||||
//if there is a build date issue or a license type mismatch issue it will fail with an exception, log to log file, log to console and not go beyond the license check preserving the db
|
||||
//Note: case 4160 is to build an external license fetcher utility to allow a user to upgrade without uninstalling the newer version by purchasing a new sub and installing the key out of AyaNova
|
||||
//If they don't want to purchase then they must downgrade
|
||||
//If they don't want to purchase then they must downgrade HOWEVER they can do the case 4170 thing with the flag AYANOVA_REMOVE_LICENSE_FROM_DB
|
||||
|
||||
//NOTE: AYANOVA_REMOVE_LICENSE_FROM_DB boot flag can be used to work around this issue
|
||||
bool licenseChecked = false;
|
||||
try
|
||||
{
|
||||
@@ -625,11 +627,11 @@ namespace AyaNova
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Only re-throw if it's a 1020 error with the text VERSION-TOO-NEW included, any other error allow it to keep doing it's thing below before the second license init
|
||||
//Only re-throw if it's a 1020 error with the text defined in LICENSE_MISMATCH_TO_BUILD_ERROR included, any other error allow it to keep doing it's thing below before the second license init
|
||||
//our exception is buried inside multiple inner exceptions but it's the innermost so drill down into it
|
||||
while (ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
if (ex.Message.Contains("1020") && ex.Message.Contains("VERSION-TOO-NEW "))
|
||||
if (ex.Message.Contains("1020") && ex.Message.Contains(AyaNova.Core.License.LICENSE_MISMATCH_TO_BUILD_ERROR))
|
||||
{
|
||||
throw new Exception("AyaNova did not start to protect the integrity of your data, see the console and / or error log for details");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace AyaNova.Util
|
||||
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
|
||||
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 4;
|
||||
private const int DESIRED_SCHEMA_LEVEL = 5;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 1376;
|
||||
internal const long EXPECTED_INDEX_COUNT = 161;
|
||||
@@ -1345,7 +1345,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
//INTEGRATIONLOG
|
||||
await ExecQueryAsync("CREATE TABLE aintegrationlog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, integrationid BIGINT NOT NULL REFERENCES aintegration ON DELETE CASCADE, created TIMESTAMPTZ NOT NULL, statustext TEXT NOT NULL)");
|
||||
|
||||
//english translations
|
||||
//english translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'IntegrationList', 'Integrated applications' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Integration', 'Integrated application' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'IntegrationName', 'Name' FROM atranslation t where t.baselanguage = 'en'");
|
||||
@@ -1358,7 +1358,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Integration', 'Application intégrée' FROM atranslation t where t.baselanguage = 'fr'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'IntegrationName', 'Nom' FROM atranslation t where t.baselanguage = 'fr'");
|
||||
//german translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'IntegrationList', 'Integrierte Anwendungen' FROM atranslation t where t.baselanguage = 'de'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'IntegrationList', 'Integrierte Anwendungen' FROM atranslation t where t.baselanguage = 'de'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Integration', 'Integrierte Anwendung' FROM atranslation t where t.baselanguage = 'de'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'IntegrationName', 'Name' FROM atranslation t where t.baselanguage = 'de'");
|
||||
|
||||
@@ -1480,6 +1480,36 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
await SetSchemaLevelAsync(++currentSchema);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
// 8.0.4 Subscription license trans keys
|
||||
//
|
||||
if (currentSchema < 5)
|
||||
{
|
||||
LogUpdateMessage(log);
|
||||
//LicenseType, LicenseTypeSubscription, LicenseTypePerpetual
|
||||
//english translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseType', 'License type' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypeSubscription', 'Subscription' FROM atranslation t where t.baselanguage = 'en'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypePerpetual', 'Perpetual' FROM atranslation t where t.baselanguage = 'en'");
|
||||
|
||||
//spanish translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseType', 'Tipo de licencia' FROM atranslation t where t.baselanguage = 'es'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypeSubscription', 'Suscripción' FROM atranslation t where t.baselanguage = 'es'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypePerpetual', 'Perpetuo' FROM atranslation t where t.baselanguage = 'es'");
|
||||
|
||||
//french translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseType', 'Type de licence' FROM atranslation t where t.baselanguage = 'fr'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypeSubscription', 'Abonnement' FROM atranslation t where t.baselanguage = 'fr'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypePerpetual', 'Perpétuel' FROM atranslation t where t.baselanguage = 'fr'");
|
||||
|
||||
//german translations
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseType', 'Lizenz-Typ' FROM atranslation t where t.baselanguage = 'de'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypeSubscription', 'Abonnement' FROM atranslation t where t.baselanguage = 'de'");
|
||||
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'LicenseTypePerpetual', 'Ewig' FROM atranslation t where t.baselanguage = 'de'");
|
||||
await SetSchemaLevelAsync(++currentSchema);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#########################################
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace AyaNova.Util
|
||||
/// </summary>
|
||||
internal static class AyaNovaVersion
|
||||
{
|
||||
public const string VersionString = "8.0.3";
|
||||
public const string VersionString = "8.0.4";
|
||||
public const string FullNameAndVersion = "AyaNova server " + VersionString;
|
||||
public const string CurrentApiVersion="v8";
|
||||
}//eoc
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace AyaNova.Core
|
||||
private const string LICENSE_SERVER_URL_ROCKFISH = "https://rockfish.ayanova.com/";
|
||||
#endif
|
||||
|
||||
//CRITICAL PROBLEM IF THIS IS TRUE
|
||||
#if(DEVELOPMENT_TEST_ROCKFISH && !DEBUG)
|
||||
//CRITICAL PROBLEM IF THIS IS TRUE
|
||||
#if (DEVELOPMENT_TEST_ROCKFISH && !DEBUG)
|
||||
#error ### HOLDUP: DEVELOPMENT_TEST_ROCKFISH is defined in a RELEASE BUILD!!!!
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace AyaNova.Core
|
||||
private const string LICENSE_SERVER_URL_EUROPA = "https://europa.ayanova.com/";
|
||||
private const string LICENSE_SERVER_URL_CALLISTO = "https://callisto.ayanova.com/";
|
||||
|
||||
|
||||
internal const string LICENSE_MISMATCH_TO_BUILD_ERROR = "E1020 - Not licensed for this version of AyaNova. Fix: revert to previous version used or contact technical support for options";
|
||||
|
||||
//Unlicensed token
|
||||
private const string UNLICENSED_TOKEN = "UNLICENSED";
|
||||
@@ -417,6 +417,7 @@ namespace AyaNova.Core
|
||||
serverDbId = ServerDbId,
|
||||
licensedTo = ActiveKey.RegisteredTo,
|
||||
dbId = ActiveKey.DbId,
|
||||
perpetual = ActiveKey.Perpetual,
|
||||
keySerial = ActiveKey.Id,
|
||||
licenseExpiration = ActiveKey.LicenseExpiration,
|
||||
licenseWillExpire = ActiveKey.WillExpire,
|
||||
@@ -902,7 +903,10 @@ EQIDAQAB
|
||||
key.Id = (string)token.SelectToken("Key.Id");
|
||||
key.RegisteredTo = (string)token.SelectToken("Key.RegisteredTo");
|
||||
key.DbId = (string)token.SelectToken("Key.DBID");
|
||||
key.Perpetual = (bool)token.SelectToken("Key.Perpetual");
|
||||
if (token.SelectToken("Key.Perpetual") != null)
|
||||
key.Perpetual = (bool)token.SelectToken("Key.Perpetual");
|
||||
else
|
||||
key.Perpetual = true;
|
||||
if (key.DbId != ServerDbId)
|
||||
throw new ApplicationException($"E1020 - License.Parse -> License key does not match this server");
|
||||
|
||||
@@ -932,11 +936,29 @@ EQIDAQAB
|
||||
//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.");
|
||||
Console.WriteLine(LICENSE_MISMATCH_TO_BUILD_ERROR);
|
||||
|
||||
//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.");
|
||||
//NOTE: LICENSE_MISMATCH_TO_BUILD_ERROR matched for in startup.cs DO NOT change this without fixing the side effects
|
||||
throw new ApplicationException(LICENSE_MISMATCH_TO_BUILD_ERROR);
|
||||
}
|
||||
|
||||
//Subscription licenses only for subscription builds and Perpetual licenses only for Perpetual builds
|
||||
#if (SUBSCRIPTION_BUILD)
|
||||
if(key.Perpetual){
|
||||
Console.WriteLine(LICENSE_MISMATCH_TO_BUILD_ERROR);
|
||||
//NOTE: LICENSE_MISMATCH_TO_BUILD_ERROR bit below is checked for in startup.cs DO NOT remove this without fixing the side effects
|
||||
throw new ApplicationException(LICENSE_MISMATCH_TO_BUILD_ERROR);
|
||||
}
|
||||
#else
|
||||
if (!key.Perpetual)
|
||||
{
|
||||
Console.WriteLine(LICENSE_MISMATCH_TO_BUILD_ERROR);
|
||||
//NOTE: LICENSE_MISMATCH_TO_BUILD_ERROR bit below is checked for in startup.cs DO NOT remove this without fixing the side effects
|
||||
throw new ApplicationException(LICENSE_MISMATCH_TO_BUILD_ERROR);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//All is well return key
|
||||
return key;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user