Cleanup and better comments to clarify licensing code
This commit is contained in:
@@ -528,17 +528,17 @@ namespace AyaNova.Core
|
||||
|
||||
var FetchRequest = new dtoFetchRequest() { DbId = LicenseDbId };
|
||||
string LicenseUrlParameter = "rvf";
|
||||
// #if (DEBUG)
|
||||
// if (devTestTrial)
|
||||
// {
|
||||
// #if (SUBSCRIPTION_BUILD)
|
||||
// LicenseUrlParameter += "?dtt=true&pp=false";//signal to rockfish to provide a key immediately for dev testing
|
||||
// #else
|
||||
// LicenseUrlParameter += "?dtt=true&pp=true";//signal to rockfish to provide a key immediately for dev testing
|
||||
// #endif
|
||||
// #if (DEBUG)
|
||||
// if (devTestTrial)
|
||||
// {
|
||||
// #if (SUBSCRIPTION_BUILD)
|
||||
// LicenseUrlParameter += "?dtt=true&pp=false";//signal to rockfish to provide a key immediately for dev testing
|
||||
// #else
|
||||
// LicenseUrlParameter += "?dtt=true&pp=true";//signal to rockfish to provide a key immediately for dev testing
|
||||
// #endif
|
||||
|
||||
// }
|
||||
// #endif
|
||||
// }
|
||||
// #endif
|
||||
|
||||
try
|
||||
{
|
||||
@@ -692,9 +692,9 @@ namespace AyaNova.Core
|
||||
}
|
||||
|
||||
|
||||
//################## This is called on Boot up of server and when a new license key is fetched and installed ###############
|
||||
/// <summary>
|
||||
/// Initialize the license
|
||||
///
|
||||
/// </summary>
|
||||
internal static async Task InitializeAsync(AyaNova.Api.ControllerHelpers.ApiServerState apiServerState, AyContext ct, ILogger log)
|
||||
{
|
||||
@@ -783,9 +783,9 @@ namespace AyaNova.Core
|
||||
}
|
||||
|
||||
|
||||
//Has someone been trying funny business with the active techs in the db?
|
||||
#if (SUBSCRIPTION_BUILD)
|
||||
//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() > _ActiveLicense.ActiveInternalUsersCount)
|
||||
{
|
||||
var msg = $"{SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (internal staff User count)";
|
||||
@@ -793,8 +793,8 @@ namespace AyaNova.Core
|
||||
log.LogCritical(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if (SUBSCRIPTION_BUILD)
|
||||
//Customer contact count - check only for subscription build
|
||||
if (await AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync() > _ActiveLicense.ActiveCustomerContactUsersCount)
|
||||
{
|
||||
var msg = $"{SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (Customer Contact User count)";
|
||||
@@ -802,26 +802,8 @@ namespace AyaNova.Core
|
||||
log.LogCritical(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
// if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > _ActiveLicense.ActiveTechsCount)
|
||||
// {
|
||||
// apiServerState.SetSystemLock(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
|
||||
// log.LogCritical(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
|
||||
// return;
|
||||
//}
|
||||
if (await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync() > _ActiveLicense.ActiveInternalUsersCount)
|
||||
{
|
||||
var msg = $"{SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (internal staff User count)";
|
||||
apiServerState.SetSystemLock(msg);
|
||||
log.LogCritical(msg);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//Key is ok, might not have been on first boot so check and clear if locked
|
||||
//This works for now because system lock only means license lock
|
||||
//if ever changed for other purposes then need to handle that see serverstate for ideas
|
||||
@@ -945,6 +927,7 @@ namespace AyaNova.Core
|
||||
#endregion
|
||||
|
||||
#region PARSE and Validate key
|
||||
//################## This is called on Boot up of server and when a new license key is fetched and installed ###############
|
||||
/// <summary>
|
||||
/// Parses and validates the integrity of a passed in textual license key
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user