Cleanup and better comments to clarify licensing code

This commit is contained in:
2022-10-25 20:30:57 +00:00
parent bb6c15286b
commit 102c145386
4 changed files with 31 additions and 53 deletions

View File

@@ -7,9 +7,10 @@ using AyaNova.Util;
namespace AyaNova.Biz
{
//NOTE: this is not where the license expiration is checked, that's done in corejobsweeper with the user count checks
/// <summary>
/// called by Generator to check for new licenses automatically
/// called by Generator to check RockFish for new licenses automatically
///
/// </summary>
internal static class CoreJobLicense

View File

@@ -57,8 +57,9 @@ namespace AyaNova.Biz
await SweepInternalJobsLogsAsync(ct, dtDeleteCutoff);
//In flight check of user count exceeded in case someone meddled in the DB Directly
#if (SUBSCRIPTION_BUILD)
//In flight check validate the db license related user data in case of attempted circumvention
//User count - common check to both build types
if (await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveInternalUsersCount)
{
var msg = $"{AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (internal staff User count)";
@@ -67,6 +68,9 @@ namespace AyaNova.Biz
return;
}
#if (SUBSCRIPTION_BUILD)
//Customer contact count - check only for subscription build
if (await AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveCustomerContactUsersCount)
{
var msg = $"{AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (Customer Contact User count)";
@@ -74,22 +78,6 @@ namespace AyaNova.Biz
log.LogCritical(msg);
return;
}
#else
// if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveTechsCount)
// {
// //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;
// }
if (await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveInternalUsersCount)
{
var msg = $"{AyaNova.Core.License.SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (internal staff User count)";
AyaNova.Util.ServiceProviderProvider.ServerState.SetSystemLock(msg);
log.LogCritical(msg);
return;
}
#endif
}