diff --git a/server/AyaNova/util/License.cs b/server/AyaNova/util/License.cs index 1e634aa0..6534454c 100644 --- a/server/AyaNova/util/License.cs +++ b/server/AyaNova/util/License.cs @@ -33,6 +33,11 @@ namespace AyaNova.Core //Unlicensed token private const string UNLICENSED_TOKEN = "UNLICENSED"; + //REVOKED token + private const string REVOKED_TOKEN = "REVOKED"; + + + //Scheduleable users private const string SERVICE_TECHS_FEATURE_NAME = "ServiceTechs"; @@ -80,7 +85,8 @@ namespace AyaNova.Core ActiveTrial = 1, ExpiredTrial = 2, ActivePurchased = 3, - ExpiredPurchased = 4 + ExpiredPurchased = 4, + Revoked = 5 } public AyaNovaLicenseKey() @@ -147,8 +153,12 @@ namespace AyaNova.Core { get { + return LicenseStatus.Revoked; + if (string.IsNullOrWhiteSpace(RegisteredTo) || RegisteredTo == UNLICENSED_TOKEN) return LicenseStatus.NONE; + if (RegisteredTo == REVOKED_TOKEN) + return LicenseStatus.Revoked; if (TrialLicense && !LicenseExpired) return LicenseStatus.ActiveTrial; if (TrialLicense && LicenseExpired) @@ -157,6 +167,7 @@ namespace AyaNova.Core return LicenseStatus.ActivePurchased; if (!TrialLicense && LicenseExpired) return LicenseStatus.ExpiredPurchased; + throw new System.Exception("License::Status - unable to determine license status"); } } @@ -242,7 +253,7 @@ namespace AyaNova.Core // ""Key"": { // ""LicenseFormat"": ""2018"", // ""Id"": ""34-1516288681"", <----Customer id followed by key serial id - // ""RegisteredTo"": ""Super TestCo"", + // ""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 @@ -573,6 +584,14 @@ namespace AyaNova.Core return; } + if (_ActiveLicense.Status == AyaNovaLicenseKey.LicenseStatus.Revoked) + { + var msg = $"E1020 - License key revoked"; + apiServerState.SetSystemLock(msg); + log.LogCritical(msg); + return; + } + //Has someone been trying funny business with the active techs in the db? if (await AyaNova.Biz.UserBiz.ActiveCountAsync() > _ActiveLicense.ActiveNumber) {