licensing system change, all internal active, no more scheduleable resources / tech licensing
This commit is contained in:
@@ -62,11 +62,6 @@ namespace AyaNova.Core
|
||||
//REVOKED token
|
||||
private const string REVOKED_TOKEN = "REVOKED";
|
||||
|
||||
|
||||
|
||||
//Scheduleable users
|
||||
private const string SERVICE_TECHS_FEATURE_NAME = "ServiceTechs";
|
||||
|
||||
//ActiveInternalUsers subscription license
|
||||
private const string ACTIVE_INTERNAL_USERS_FEATURE_NAME = "ActiveInternalUsers";
|
||||
|
||||
@@ -141,13 +136,13 @@ namespace AyaNova.Core
|
||||
return null;
|
||||
}
|
||||
|
||||
public long ActiveTechsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetLicenseFeature(SERVICE_TECHS_FEATURE_NAME)?.Count ?? 0;
|
||||
}
|
||||
}
|
||||
// public long ActiveTechsCount
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return GetLicenseFeature(SERVICE_TECHS_FEATURE_NAME)?.Count ?? 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
public long ActiveInternalUsersCount
|
||||
{
|
||||
@@ -285,42 +280,6 @@ namespace AyaNova.Core
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region sample v8 key
|
||||
// private static string SAMPLE_KEY = @"[KEY
|
||||
// {
|
||||
// ""Key"": {
|
||||
// ""LicenseFormat"": ""8"",
|
||||
// ""Id"": ""34-1516288681"", <----Customer id followed by key serial id
|
||||
// ""RegisteredTo"": ""Super TestCo"", or "REVOKED" if revoked
|
||||
// ""DBID"": ""df558559-7f8a-4c7b-955c-959ebcdf71f3"",
|
||||
// ""LicenseExpiration"": ""2019-01-18T07:18:01.2329138-08:00"", <--- UTC, DateTime if perpetual license 1/1/5555 indicates not expiring
|
||||
// ""MaintenanceExpiration"": ""2019-01-18T07:18:01.2329138-08:00"", <-- UTC, DateTime support and updates subscription runs out, applies to all features
|
||||
// ""Features"": {
|
||||
// ""Feature"": [
|
||||
// {
|
||||
// ""Name"": ""Scheduleable users"",
|
||||
// ""Count"":""10"",
|
||||
// },
|
||||
// {
|
||||
// ""Name"": ""Accounting""
|
||||
// },
|
||||
// {
|
||||
// ""Name"": ""TrialMode""<---means is a trial key
|
||||
// },
|
||||
// {
|
||||
// ""Name"": ""Subscription"" <----Means it's an SAAS/Rental key
|
||||
// }
|
||||
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// KEY]
|
||||
// [SIGNATURE
|
||||
// HEcY3JCVwK9HFXEFnldUEPXP4Q7xoZfMZfOfx1cYmfVF3MVWePyZ9dqVZcY7pk3RmR1BbhQdhpljsYLl+ZLTRhNa54M0EFa/bQnBnbwYZ70EQl8fz8WOczYTEBo7Sm5EyC6gSHtYZu7yRwBvhQzpeMGth5uWnlfPb0dMm0DQM7PaqhdWWW9GCSOdZmFcxkFQ8ERLDZhVMbd8PJKyLvZ+sGMrmYTAIoL0tqa7nrxYkM71uJRTAmQ0gEl4bJdxiV825U1J+buNQuTZdacZKEPSjQQkYou10jRbReUmP2vDpvu+nA1xdJe4b5LlyQL+jiIXH17lf93xlCUb0UkDpu8iNQ==
|
||||
// SIGNATURE]\";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exposed properties
|
||||
|
||||
@@ -459,7 +418,7 @@ namespace AyaNova.Core
|
||||
#else
|
||||
build = "Perpetual",
|
||||
#endif
|
||||
activeTechUserCount = AyaNova.Biz.UserBiz.ActiveTechUserCountAsync().Result,
|
||||
// activeTechUserCount = AyaNova.Biz.UserBiz.ActiveTechUserCountAsync().Result,
|
||||
activeCustomerContactUserCount = AyaNova.Biz.UserBiz.ActiveCustomerContactUserCountAsync().Result,
|
||||
activeInternalUserCount = AyaNova.Biz.UserBiz.ActiveInternalUserCountAsync().Result
|
||||
}
|
||||
@@ -850,10 +809,17 @@ namespace AyaNova.Core
|
||||
|
||||
|
||||
#else
|
||||
if (await AyaNova.Biz.UserBiz.ActiveTechUserCountAsync() > _ActiveLicense.ActiveTechsCount)
|
||||
// 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)
|
||||
{
|
||||
apiServerState.SetSystemLock(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
|
||||
log.LogCritical(SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR);
|
||||
var msg = $"{SERVER_STATE_LOCKOUT_DUE_TO_LICENSE_EXCEEDED_CAPACITY_ERROR} (internal staff User count)";
|
||||
apiServerState.SetSystemLock(msg);
|
||||
log.LogCritical(msg);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -933,15 +899,29 @@ namespace AyaNova.Core
|
||||
|
||||
#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);
|
||||
// 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.");
|
||||
// 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