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

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