More subscription license work allow logins addition
This commit is contained in:
@@ -602,28 +602,11 @@ 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 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 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 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;
|
||||
//BOOT safety check to prevent schema update if user has installed version of AyaNova they are not licensed for
|
||||
try
|
||||
{
|
||||
//NOTE: a completely missing db will trigger an exception on this line, we expect that and will be fine as the schema check will run below and create the tables required
|
||||
var tempSchema = dbContext.SchemaVersion.AsNoTracking().SingleOrDefault();
|
||||
var tempLicense = dbContext.License.AsNoTracking().SingleOrDefault();
|
||||
|
||||
if (tempSchema != null && tempLicense != null && !string.IsNullOrWhiteSpace(tempSchema.Id))
|
||||
{
|
||||
//we have a schema and a license, check it now thus triggering build date vs maintenance expiry check
|
||||
|
||||
AyaNova.Core.License.InitializeAsync(apiServerState, dbContext, _newLog).Wait();
|
||||
licenseChecked = true;
|
||||
}
|
||||
//this will either return without throwing which is ok or will throw and may or may not indicate need to be prevented from further boot
|
||||
AyaNova.Core.License.BootSafetyCheck(dbContext, _newLog);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -631,7 +614,7 @@ namespace AyaNova
|
||||
//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(AyaNova.Core.License.LICENSE_MISMATCH_TO_BUILD_ERROR))
|
||||
if (ex.Message.Contains("1020") && ex.Message.Contains(AyaNova.Core.License.LICENSE_MISMATCH_TO_BUILD_ERROR))//DO NOT CHANGE THIS MAGIC STRING KEY
|
||||
{
|
||||
throw new Exception("AyaNova did not start to protect the integrity of your data, see the console and / or error log for details");
|
||||
}
|
||||
@@ -652,9 +635,8 @@ namespace AyaNova
|
||||
AySchema.EXPECTED_ROUTINES,
|
||||
_newLog).Wait();
|
||||
|
||||
//Initialize license if not already done (due to there being no db at all yet)
|
||||
if (!licenseChecked)
|
||||
AyaNova.Core.License.InitializeAsync(apiServerState, dbContext, _newLog).Wait();
|
||||
//Initialize license
|
||||
AyaNova.Core.License.InitializeAsync(apiServerState, dbContext, _newLog).Wait();
|
||||
|
||||
//Set static global biz settings
|
||||
_newLog.LogDebug("Global settings");
|
||||
|
||||
Reference in New Issue
Block a user