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
{
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
}

View File

@@ -699,9 +699,12 @@ namespace AyaNova
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
_newLog.LogInformation($"Active techs - {UserBiz.ActiveTechUserCountAsync().Result}");
LOGHERE
//Log the active user counts so it's in the log record
//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
_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
_newLog.LogInformation($"License - [{AyaNova.Core.License.LicenseInfoLogFormat}]");

View File

@@ -59,13 +59,9 @@ namespace AyaNova.Biz
//Stealthy check of user count exceeded
if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveTechsCount)
{
HERE
//WARNING: DO not change the text of this message without also
//updating the authcontroller ReturnUserCredsOnSuccessfulAuthentication licenselockout check code
//it must match
var msg = $"E1020 - Active count exceeded capacity";
AyaNova.Util.ServiceProviderProvider.ServerState.SetSystemLock(msg);
log.LogCritical(msg);
//Warning: magic string, do not change this, triggers special login procedures to fix license issue
AyaNova.Util.ServiceProviderProvider.ServerState.SetSystemLock(AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
log.LogCritical(AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
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";
//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
private const string UNLICENSED_TOKEN = "UNLICENSED";
@@ -774,11 +777,13 @@ namespace AyaNova.Core
return;
}
//Has someone been trying funny business with the active techs in the db?
#if (SUBSCRIPTION_BUILD)
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);
log.LogCritical(msg);
return;
@@ -787,7 +792,7 @@ namespace AyaNova.Core
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);
log.LogCritical(msg);
return;
@@ -797,13 +802,12 @@ namespace AyaNova.Core
#else
if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > _ActiveLicense.ActiveTechsCount)
{
var msg = $"E1020 - Active count exceeded capacity";
apiServerState.SetSystemLock(msg);
log.LogCritical(msg);
apiServerState.SetSystemLock(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
log.LogCritical(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
return;
}
#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