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

@@ -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