This commit is contained in:
2022-08-23 14:46:24 +00:00
parent 03d26ddc41
commit a9b7cafc1d
3 changed files with 44 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ namespace AyaNova.Biz
}
//This is where SUBSCRIPTION active internal (non customer) license consumers are accounted for
internal static async Task<long> ActiveInsideUserCountAsync()
internal static async Task<long> ActiveInternalUserCountAsync()
{
using (AyContext ct = ServiceProviderProvider.DBContext)
{
@@ -757,7 +757,7 @@ namespace AyaNova.Biz
//Yes, it might be affected depending on things
long CurrentActiveCount = await UserBiz.ActiveTechUserCountAsync();
HERE
long LicensedUserCount = AyaNova.Core.License.ActiveKey.ActiveNumber;
long LicensedUserCount = AyaNova.Core.License.ActiveKey.ActiveTechsCount;
if (isNew)
{

View File

@@ -57,7 +57,7 @@ namespace AyaNova.Biz
await SweepInternalJobsLogsAsync(ct, dtDeleteCutoff);
//Stealthy check of user count exceeded
if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveNumber)
if (await UserBiz.ActiveTechUserCountAsync() > AyaNova.Core.License.ActiveKey.ActiveTechsCount)
{
HERE
//WARNING: DO not change the text of this message without also

View File

@@ -138,7 +138,7 @@ namespace AyaNova.Core
return null;
}
public long ActiveNumber
public long ActiveTechsCount
{
get
{
@@ -146,6 +146,22 @@ namespace AyaNova.Core
}
}
public long ActiveInternalUsersCount
{
get
{
return GetLicenseFeature(ACTIVE_INTERNAL_USERS_FEATURE_NAME).Count;
}
}
public long ActiveCustomerContactUsersCount
{
get
{
return GetLicenseFeature(ACTIVE_CUSTOMER_USERS_FEATURE_NAME).Count;
}
}
/// <summary>
/// Check for the existance of license feature
/// </summary>
@@ -758,8 +774,27 @@ namespace AyaNova.Core
return;
}
HERE
//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";
apiServerState.SetSystemLock(msg);
log.LogCritical(msg);
return;
}
if (await AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync() > _ActiveLicense.ActiveCustomerContactUsersCount)
{
var msg = $"E1020 - Active Customer Contact User count exceeded licensed capacity";
apiServerState.SetSystemLock(msg);
log.LogCritical(msg);
return;
}
#else
if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > _ActiveLicense.ActiveNumber)
{
var msg = $"E1020 - Active count exceeded capacity";
@@ -767,6 +802,9 @@ HERE
log.LogCritical(msg);
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
//This works for now because system lock only means license lock