case 4578
This commit is contained in:
@@ -862,60 +862,33 @@ namespace AyaNova.Core
|
||||
}
|
||||
|
||||
|
||||
//DOWNGRADE LICENSE?
|
||||
//Only check quantities if it's not a revoke token which should always pass through
|
||||
if (ParsedNewKey.RegisteredTo != REVOKED_TOKEN)
|
||||
{
|
||||
|
||||
//case 4578 automatically disable excess internal users
|
||||
await AyaNova.Biz.UserBiz.DeActivateExcessiveInternallUsers(ParsedNewKey.ActiveInternalUsersCount, log);
|
||||
|
||||
|
||||
#if (SUBSCRIPTION_BUILD)
|
||||
//case 4578 handles internal user count adjustment to match license in downgrade automatically
|
||||
//but it can't handle customer login downgrade as that might fuck up the business badly if suddenly a bunch of random customers can't login so *they* would need to handle that themselves manually
|
||||
//so keeping that bit of code here
|
||||
|
||||
//SUBSCRIPTION USER COUNTS - new license causes exceeding counts?
|
||||
|
||||
long NewInsideUserLicensedCount = ParsedNewKey.ActiveInternalUsersCount;
|
||||
long ExistingActiveInsideUserCount = await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync();
|
||||
|
||||
//SUBSCRIPTION CUSTOMER LOGIN ACCOUNT QUANTITY DOWNGRADED?
|
||||
long NewCustomerLicensedCount = ParsedNewKey.ActiveCustomerContactUsersCount;
|
||||
long ExistingCustomerUserCount = await AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync();
|
||||
string err = "E1020 - Can't install license: ";
|
||||
bool throwit = false;
|
||||
if (ExistingActiveInsideUserCount > NewInsideUserLicensedCount)
|
||||
{
|
||||
throwit = true;
|
||||
err += $"{ExistingActiveInsideUserCount} active internal users of {NewInsideUserLicensedCount} permitted";
|
||||
}
|
||||
|
||||
if (ExistingCustomerUserCount > NewCustomerLicensedCount)
|
||||
{
|
||||
throwit = true;
|
||||
err += $"{ExistingCustomerUserCount} active Customer login users of {NewCustomerLicensedCount} permitted";
|
||||
}
|
||||
|
||||
if (throwit)
|
||||
throw new ApplicationException(err);
|
||||
|
||||
#else
|
||||
//PERPETUAL, vet the TECHCOUNT - new license causes exceeding count?
|
||||
// long NewTechCount = ParsedNewKey.ActiveTechsCount;
|
||||
// if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > NewTechCount)
|
||||
// {
|
||||
// //attempt to set enough of the eldest last login techs to inactive
|
||||
// await AyaNova.Biz.UserBiz.DeActivateExcessiveTechs(NewTechCount, log);
|
||||
|
||||
// if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > NewTechCount)
|
||||
// throw new ApplicationException("E1020 - Can't install key, too many active techs and / or subcontractors in database. Deactivate enough to install key.");
|
||||
// }
|
||||
|
||||
long NewInsideUserLicensedCount = ParsedNewKey.ActiveInternalUsersCount;
|
||||
long ExistingActiveInsideUserCount = await AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync();
|
||||
|
||||
string err = "E1020 - Can't install license: ";
|
||||
bool throwit = false;
|
||||
if (ExistingActiveInsideUserCount > NewInsideUserLicensedCount)
|
||||
{
|
||||
throwit = true;
|
||||
err += $"{ExistingActiveInsideUserCount} active internal users of {NewInsideUserLicensedCount} permitted";
|
||||
}
|
||||
|
||||
if (throwit)
|
||||
throw new ApplicationException(err);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user