diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 9855e5fa..297d5e91 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -37,26 +37,13 @@ todo: register domain name myayanova.com for hanging subscriber servers off of -todo: Update raven license code in subscription mode to check for total active User count instead of tech count - and business rules, like search for teh tech thing and parallel it to the User thing - if ($("#perpetual").prop("checked")) { - features.push({ - Feature: "ServiceTechs", <----------------- - Count: Number($("#techcount").val()) - }); - } else { - features.push({ - Feature: "ActiveInternalUsers", <----------------- - Count: Number($("#subusercount").val()) - }); - - features.push({ - Feature: "ActiveCustomerUsers", <----------------- - Count: Number($("#subcustcount").val()) - }); - } -todo: update raven license check code to count active customer contact users as a business rule - mimic user/tech check +todo: TEST subscription and perpetual license code + Does it prevent changing a user to active? + Does it prevent changing a user type? (direct db meddling) + Does it prevent installing a new license when too few for existing active? + Does it communicate this well to the user? + + todo: update the test servers whichever are around, I've done my dev test.helloayanova.com, but should also do a261 and the eval ones diff --git a/server/AyaNova/generator/CoreJobSweeper.cs b/server/AyaNova/generator/CoreJobSweeper.cs index 6b6a0479..7760e623 100644 --- a/server/AyaNova/generator/CoreJobSweeper.cs +++ b/server/AyaNova/generator/CoreJobSweeper.cs @@ -56,14 +56,34 @@ namespace AyaNova.Biz dtDeleteCutoff = DateTime.UtcNow - INTERNAL_JOBS_LOGS_DELETE_AFTER_THIS_TIMESPAN; await SweepInternalJobsLogsAsync(ct, dtDeleteCutoff); - //Stealthy check of user count exceeded - if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveTechsCount) + + //In flight check of user count exceeded in case someone meddled in the DB Directly +#if (SUBSCRIPTION_BUILD) + 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; + } + + 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)"; + AyaNova.Util.ServiceProviderProvider.ServerState.SetSystemLock(msg); + 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; } +#endif } lastSweep = DateTime.UtcNow;