This commit is contained in:
2022-08-23 16:56:20 +00:00
parent f8f0aeba4c
commit 0016204582
4 changed files with 20 additions and 17 deletions

View File

@@ -222,7 +222,7 @@ namespace AyaNova.Api.Controllers
} }
else else
{ {
if (serverState.Reason.Contains("E1020 - Active count exceeded capacity")) if (serverState.Reason.Contains(AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR))
{ {
licenseLockout = true;//this could be an expired license or user count exceeded capacity so flag to client on login so superuser can fix it licenseLockout = true;//this could be an expired license or user count exceeded capacity so flag to client on login so superuser can fix it
} }

View File

@@ -699,9 +699,12 @@ namespace AyaNova
ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("DB Schema version", AyaNova.Util.AySchema.currentSchema.ToString()); ServerBootConfig.BOOT_DIAGNOSTIC_INFO.Add("DB Schema version", AyaNova.Util.AySchema.currentSchema.ToString());
//Log the active user count so it's in the log record //Log the active user counts so it's in the log record
_newLog.LogInformation($"Active techs - {UserBiz.ActiveTechUserCountAsync().Result}"); //I'm doing all three even though some not relevant in certain scenarios in case of user switching between subscription/perpetual as another source of information
LOGHERE _newLog.LogInformation($"Active tech Users - {UserBiz.ActiveTechUserCountAsync().Result}");
_newLog.LogInformation($"Active Customer contact Users - {UserBiz.ActiveCustomerContactUserCountAsync().Result}");
_newLog.LogInformation($"Active internal staff Users - {UserBiz.ActiveInternalUserCountAsync().Result}");
//Log the license info so it's on the record //Log the license info so it's on the record
_newLog.LogInformation($"License - [{AyaNova.Core.License.LicenseInfoLogFormat}]"); _newLog.LogInformation($"License - [{AyaNova.Core.License.LicenseInfoLogFormat}]");

View File

@@ -59,13 +59,9 @@ namespace AyaNova.Biz
//Stealthy check of user count exceeded //Stealthy check of user count exceeded
if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveTechsCount) if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveTechsCount)
{ {
HERE //Warning: magic string, do not change this, triggers special login procedures to fix license issue
//WARNING: DO not change the text of this message without also AyaNova.Util.ServiceProviderProvider.ServerState.SetSystemLock(AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
//updating the authcontroller ReturnUserCredsOnSuccessfulAuthentication licenselockout check code log.LogCritical(AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
//it must match
var msg = $"E1020 - Active count exceeded capacity";
AyaNova.Util.ServiceProviderProvider.ServerState.SetSystemLock(msg);
log.LogCritical(msg);
return; return;
} }

View File

@@ -53,6 +53,9 @@ namespace AyaNova.Core
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"; 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";
//Warning: magic string, do not change this, triggers special login procedures to fix license issue
internal const string SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR = "E1020 - Active count exceeded capacity";
//Unlicensed token //Unlicensed token
private const string UNLICENSED_TOKEN = "UNLICENSED"; private const string UNLICENSED_TOKEN = "UNLICENSED";
@@ -774,11 +777,13 @@ namespace AyaNova.Core
return; return;
} }
//Has someone been trying funny business with the active techs in the db?
#if (SUBSCRIPTION_BUILD) #if (SUBSCRIPTION_BUILD)
if (await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync() > _ActiveLicense.ActiveInternalUsersCount) if (await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync() > _ActiveLicense.ActiveInternalUsersCount)
{ {
var msg = $"E1020 - Active internal staff User count exceeded licensed capacity"; var msg = $"{SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (internal staff User count)";
apiServerState.SetSystemLock(msg); apiServerState.SetSystemLock(msg);
log.LogCritical(msg); log.LogCritical(msg);
return; return;
@@ -787,7 +792,7 @@ namespace AyaNova.Core
if (await AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync() > _ActiveLicense.ActiveCustomerContactUsersCount) if (await AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync() > _ActiveLicense.ActiveCustomerContactUsersCount)
{ {
var msg = $"E1020 - Active Customer Contact User count exceeded licensed capacity"; var msg = $"{SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (Customer Contact User count)";
apiServerState.SetSystemLock(msg); apiServerState.SetSystemLock(msg);
log.LogCritical(msg); log.LogCritical(msg);
return; return;
@@ -797,13 +802,12 @@ namespace AyaNova.Core
#else #else
if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > _ActiveLicense.ActiveTechsCount) if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > _ActiveLicense.ActiveTechsCount)
{ {
var msg = $"E1020 - Active count exceeded capacity"; apiServerState.SetSystemLock(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
apiServerState.SetSystemLock(msg); log.LogCritical(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
log.LogCritical(msg);
return; return;
} }
#endif #endif
//Has someone been trying funny business with the active techs in the db?
//Key is ok, might not have been on first boot so check and clear if locked //Key is ok, might not have been on first boot so check and clear if locked