This commit is contained in:
@@ -541,7 +541,13 @@ namespace Sockeye.Biz
|
||||
*/
|
||||
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(KeyText, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
||||
var jKey = JObject.Parse(keyNoWS);
|
||||
|
||||
//In v7 the license expires is an optional property set called "LockDate"
|
||||
l.LicenseExpire = null;
|
||||
if (jKey["AyaNovaLicenseKey"]["LockDate"] != null)
|
||||
l.LicenseExpire = jKey["AyaNovaLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
|
||||
|
||||
|
||||
l.MaintenanceExpire = jKey["AyaNovaLicenseKey"]["Expires"].Value<DateTime>().ToUniversalTime();
|
||||
l.PGroup = ProductGroup.AyaNova7;
|
||||
l.FetchCode = jLicense["code"].Value<string>();
|
||||
@@ -559,7 +565,11 @@ namespace Sockeye.Biz
|
||||
*/
|
||||
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(KeyText, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
||||
var jKey = JObject.Parse(keyNoWS);
|
||||
//In v7 the license expires is an optional property set called "LockDate"
|
||||
l.LicenseExpire = null;
|
||||
if (jKey["AyaNovaLicenseKey"]["LockDate"] != null)
|
||||
l.LicenseExpire = jKey["AyaNovaLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
|
||||
|
||||
l.MaintenanceExpire = jKey["AyaNovaLiteLicenseKey"]["Expires"].Value<DateTime>().ToUniversalTime();
|
||||
l.PGroup = ProductGroup.AyaNova7;
|
||||
l.FetchCode = jLicense["code"].Value<string>();
|
||||
@@ -606,7 +616,7 @@ namespace Sockeye.Biz
|
||||
l.FetchEmail = jLicense["email"].Value<string>();
|
||||
l.Key = jLicense["key"].Value<string>();
|
||||
|
||||
l.Active=true;//active here means it's been fully prepared and is viable for use, all prior licenses fit this description so all are active
|
||||
l.Active = true;//active here means it's been fully prepared and is viable for use, all prior licenses fit this description so all are active
|
||||
|
||||
LicenseBiz biz = LicenseBiz.GetBiz(ct);
|
||||
await biz.CreateAsync(l);
|
||||
|
||||
@@ -69,7 +69,371 @@ namespace Sockeye.Biz
|
||||
var ret = await ct.License.AsNoTracking().SingleOrDefaultAsync(z => z.Id == id);
|
||||
if (logTheGetEvent && ret != null)
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, SockEvent.Retrieved), ct);
|
||||
return ret;
|
||||
|
||||
return ParseKeySetDTOFields(ret);
|
||||
}
|
||||
|
||||
//Read the license key text, parse it and set the dto fields accordingly
|
||||
internal License ParseKeySetDTOFields(License l)
|
||||
{
|
||||
|
||||
if (l == null || string.IsNullOrWhiteSpace(l.Key))
|
||||
return l;
|
||||
|
||||
|
||||
if (l.Key.Contains("AyaNovaLicenseKey"))
|
||||
{
|
||||
//v7 key
|
||||
/*
|
||||
[KEY
|
||||
{
|
||||
"AyaNovaLicenseKey": {
|
||||
"SchemaVersion": "7",
|
||||
"Id": "1517418112",
|
||||
"Created": "2018-01-31T09:01:52.1878494-08:00",
|
||||
"Sub": "true",
|
||||
"RegisteredTo": "Direct Telecom Services",
|
||||
"EmailAddress": "chrisw@dts.solutions",
|
||||
"FetchCode": "AgYuDnjDyQ",
|
||||
"Source": "5246494432",
|
||||
"InstallableUntil": "2019-01-31T09:01:52.089767-08:00",
|
||||
"TotalScheduleableUsers": "15",
|
||||
"Expires": "2019-01-31T00:00:00",
|
||||
"RequestedTrial": "False",
|
||||
"Plugins": {
|
||||
"Plugin": [
|
||||
{
|
||||
"Item": "MBI - Minimal browser interface",
|
||||
"SubscriptionExpires": "2018-06-13T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "WBI - Web browser interface",
|
||||
"SubscriptionExpires": "2018-06-13T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "OutlookSchedule",
|
||||
"SubscriptionExpires": "2018-06-13T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "AyaNovaOLI",
|
||||
"SubscriptionExpires": "2018-06-13T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "RI - Responsive Interface",
|
||||
"SubscriptionExpires": "2018-06-13T00:00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
KEY]
|
||||
[SIGNATURE
|
||||
uBjnooIDd6MOiqT/z4tDQfeafkQiWDBtxDHXOxhZ7av1oWS72yPoe8BrAnDZiYbxE4+cHR3C0sPCgEVva5miV1foyi7P6YKkxkKQMxTUR5IssgWVHM59KnO1lR2ndCHWaqH3gHgSsb/sdvYfuHg8luTl1RgjNDZRdQqbPl4NLMcGGW86LoXjpLjsRRxImckBEJFnntd+aXCRmQjXEZWmfxDVW84qa6h+ZCOwL3KYJHuPQDcCmhcpp3MIR3OHoeYhmNG7TWuELsJ4hrsROcqSbEC/CdZD8hoZwtrysu/ZvNZOKchwFsiBaN47+DxK0K/fL/X8CDcG+w3iqgH/x5ipIw==
|
||||
SIGNATURE]
|
||||
"Plugin": [
|
||||
{
|
||||
"Item": "MBI - Minimal browser interface",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "WBI - Web browser interface",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "QBI - QuickBooks interface",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "QBOI - QuickBooks Online interface",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "PTI - US Sage 50/Peachtree interface",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "QuickNotification",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "ExportToXls",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "OutlookSchedule",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "AyaNovaOLI",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "ImportExportCSVDuplicate",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
},
|
||||
{
|
||||
"Item": "RI - Responsive Interface",
|
||||
"SubscriptionExpires": "2024-01-08T00:00:00"
|
||||
}
|
||||
*/
|
||||
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
||||
var jKey = JObject.Parse(keyNoWS);
|
||||
l.Users = jKey["AyaNovaLicenseKey"]["TotalScheduleableUsers"].Value<int>();
|
||||
//plugins
|
||||
//var jaPlugins = jKey["AyaNovaLicenseKey"]["TotalScheduleableUsers"].Value<int>();
|
||||
var jaPlugins = (JArray)jKey.SelectToken("AyaNovaLicenseKey.Plugins.Plugin");
|
||||
for (int x = 0; x < jaPlugins.Count; x++)
|
||||
{
|
||||
var jPlugin = (JObject)jaPlugins[x];
|
||||
var plugItem = jPlugin["Item"].Value<string>();
|
||||
var plugExpires = jPlugin["SubscriptionExpires"].Value<DateTime>().ToUniversalTime();
|
||||
|
||||
switch (plugItem)
|
||||
{
|
||||
case "MBI - Minimal browser interface":
|
||||
{
|
||||
l.MBI = true;
|
||||
l.MBIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "WBI - Web browser interface":
|
||||
{
|
||||
l.WBI = true;
|
||||
l.WBIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "QBI - QuickBooks interface":
|
||||
{
|
||||
l.QBI = true;
|
||||
l.QBIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "QBOI - QuickBooks Online interface":
|
||||
{
|
||||
l.QBOI = true;
|
||||
l.QBOIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "PTI - US Sage 50/Peachtree interface":
|
||||
{
|
||||
l.PTI = true;
|
||||
l.PTIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "QuickNotification":
|
||||
{
|
||||
l.QuickNotification = true;
|
||||
l.QuickNotificationExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "ExportToXls":
|
||||
{
|
||||
l.ExportToXLS = true;
|
||||
l.ExportToXLSExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "OutlookSchedule":
|
||||
{
|
||||
l.OutlookSchedule = true;
|
||||
l.OutlookScheduleExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "AyaNovaOLI":
|
||||
{
|
||||
l.OLI = true;
|
||||
l.OLIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "ImportExportCSVDuplicate":
|
||||
{
|
||||
l.ImportExportCSVDuplicate = true;
|
||||
l.ImportExportCSVDuplicateExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "RI - Responsive Interface":
|
||||
{
|
||||
l.RI = true;
|
||||
l.RIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
// dr["Plugin"] = (string)p[x].SelectToken("Item");
|
||||
// dr["SubscriptionExpires"] = (DateTime)p[x].SelectToken("SubscriptionExpires");
|
||||
// dtPlugins.Rows.Add(dr);
|
||||
}
|
||||
|
||||
}
|
||||
else if (l.Key.Contains("AyaNovaLiteLicenseKey"))
|
||||
{
|
||||
//v7 LITE key
|
||||
/*
|
||||
"[KEY\n{\n \"AyaNovaLiteLicenseKey\": {\n \"SchemaVersion\": \"7\",\n \"Id\": \"1648506791\",\n \"Created\": \"2022-03-28T15:33:11.6010225-07:00\",\n
|
||||
\"Sub\": \"true\",\n \"RegisteredTo\": \"Duncan Electric\",\n \"EmailAddress\": \"sandrajod@att.net\",\n
|
||||
\"FetchCode\": \"hGAmScqYcU\",\n \"Source\": \"5246494431\",\n \"InstallableUntil\": \"2023-03-28T15:33:11.6009851-07:00\",\n
|
||||
\"TotalScheduleableUsers\": \"1\",\n \"Expires\": \"2023-03-29T00:00:00\",\n \"RequestedTrial\": \"False\",\n \"Plugins\": {\n
|
||||
\"Plugin\": []\n }\n }\n}\nKEY]\n
|
||||
[SIGNATURE\nKuOF/SpBL1d8AFebvm2lipmKeGdbR6WzbhN68fun+ffVGRjXNX1jWI3rbf9P/shs2/M8gHqW/B7T0vVovGqosmNsGtvaYo30TKlZj9Eicr2+zDf7ojwZiBCeEnFzXr9+7aZrsZSvN20Pqof0xf/J4BVp1T66ecuZywMzH0NGsXXZtXhWYhGvLAZAR1X5/j5gqysSdysmV9j8Euz91zs/BRyfdU0uwwrdQzrJzI4V1MFl+/mIkhMUNcJ5bzjisWS2xeyNYCYnGpMF5oaGPaIcEtmTAdf5fPNNvw3sNhPaZgwlzN8FjfK6T0VgS19PcHCMOA1bTAiLLFNk6wkcjGp2Cw==\nSIGNATURE]\n"
|
||||
*/
|
||||
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
||||
var jKey = JObject.Parse(keyNoWS);
|
||||
l.Users = 1;
|
||||
var jaPlugins = (JArray)jKey.SelectToken("AyaNovaLicenseKey.Plugins.Plugin");
|
||||
for (int x = 0; x < jaPlugins.Count; x++)
|
||||
{
|
||||
var jPlugin = (JObject)jaPlugins[x];
|
||||
var plugItem = jPlugin["Item"].Value<string>();
|
||||
var plugExpires = jPlugin["SubscriptionExpires"].Value<DateTime>().ToUniversalTime();
|
||||
|
||||
switch (plugItem)
|
||||
{
|
||||
case "MBI - Minimal browser interface":
|
||||
{
|
||||
l.MBI = true;
|
||||
l.MBIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "WBI - Web browser interface":
|
||||
{
|
||||
l.WBI = true;
|
||||
l.WBIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "QBI - QuickBooks interface":
|
||||
{
|
||||
l.QBI = true;
|
||||
l.QBIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "QBOI - QuickBooks Online interface":
|
||||
{
|
||||
l.QBOI = true;
|
||||
l.QBOIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "PTI - US Sage 50/Peachtree interface":
|
||||
{
|
||||
l.PTI = true;
|
||||
l.PTIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "QuickNotification":
|
||||
{
|
||||
l.QuickNotification = true;
|
||||
l.QuickNotificationExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "ExportToXls":
|
||||
{
|
||||
l.ExportToXLS = true;
|
||||
l.ExportToXLSExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "OutlookSchedule":
|
||||
{
|
||||
l.OutlookSchedule = true;
|
||||
l.OutlookScheduleExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "AyaNovaOLI":
|
||||
{
|
||||
l.OLI = true;
|
||||
l.OLIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "ImportExportCSVDuplicate":
|
||||
{
|
||||
l.ImportExportCSVDuplicate = true;
|
||||
l.ImportExportCSVDuplicateExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
case "RI - Responsive Interface":
|
||||
{
|
||||
l.RI = true;
|
||||
l.RIExpires = plugExpires;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//V8 RAVEN key
|
||||
/*
|
||||
{{
|
||||
"Key": {
|
||||
"LicenseFormat": "8",
|
||||
"Id": "1672261044",
|
||||
"RegisteredTo": "PDI Technologies",
|
||||
"DBID": "R6U37uNUN2hSQideG6Gg+MqoQY8vuUeyHFI6Kv7VDsE=",
|
||||
"Perpetual": true,
|
||||
"LicenseExpiration": "5555-01-01T00:00:00",
|
||||
"MaintenanceExpiration": "2023-12-28T00:00:00",
|
||||
"Features": [
|
||||
{
|
||||
"Name": "ActiveInternalUsers",
|
||||
"Count": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
}}
|
||||
|
||||
"Features": [
|
||||
{
|
||||
"Name": "TrialMode"
|
||||
},
|
||||
{
|
||||
"Name": "ActiveInternalUsers",
|
||||
"Count": 5000
|
||||
},
|
||||
{
|
||||
"Name": "ActiveCustomerUsers",
|
||||
"Count": 20000
|
||||
},
|
||||
{
|
||||
"Name": "MaximumDataGB",
|
||||
"Count": 20
|
||||
}
|
||||
]
|
||||
*/
|
||||
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
||||
var jKey = JObject.Parse(keyNoWS);
|
||||
|
||||
|
||||
|
||||
var jaFeatures = (JArray)jKey.SelectToken("Key.Features");
|
||||
for (int x = 0; x < jaFeatures.Count; x++)
|
||||
{
|
||||
var jFeature = (JObject)jaFeatures[x];
|
||||
var feature = jFeature["Name"].Value<string>();
|
||||
int count=0;
|
||||
if(feature!="TrialMode")
|
||||
count = jFeature["Count"].Value<int>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
l.Users = jKey["AyaNovaLicenseKey"]["TotalScheduleableUsers"].Value<int>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
l.DbId = jKey["Key"]["DBID"].Value<string>();
|
||||
l.LicenseExpire = jKey["Key"]["LicenseExpiration"].Value<DateTime>().ToUniversalTime();
|
||||
//if (jKey["Key"]["Perpetual"].Value<bool>())
|
||||
if ((bool?)jKey["Key"]["Perpetual"] ?? true)
|
||||
l.PGroup = ProductGroup.RavenPerpetual;
|
||||
else
|
||||
l.PGroup = ProductGroup.RavenSubscription;
|
||||
l.MaintenanceExpire = jKey["Key"]["MaintenanceExpiration"].Value<DateTime>().ToUniversalTime();
|
||||
}
|
||||
return l;
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -28,9 +28,21 @@ namespace Sockeye.Models
|
||||
public string FetchEmail { get; set; }//v7 uses
|
||||
public DateTime? FetchedOn { get; set; }
|
||||
public string DbId { get; set; }//v8 uses
|
||||
|
||||
public DateTime? LicenseExpire { get; set; }
|
||||
public DateTime MaintenanceExpire { get; set; }
|
||||
|
||||
//v8 dto props
|
||||
[NotMapped]
|
||||
public int CustomerUsers { get; set; }//v8
|
||||
[NotMapped]
|
||||
public int MaxDataGB { get; set; }//v8
|
||||
[NotMapped]
|
||||
public bool TrialMode { get; set; }//v8
|
||||
//shared dto props
|
||||
[NotMapped]
|
||||
public int Users { get; set; }//v7 scheduled users, v8 internal users
|
||||
|
||||
//V7 props for dto
|
||||
//not stored in db, hydrated if v7 license and
|
||||
//used to do the generation from selections at client
|
||||
@@ -78,7 +90,7 @@ namespace Sockeye.Models
|
||||
public bool ImportExportCSVDuplicate { get; set; }
|
||||
[NotMapped]
|
||||
public DateTime? ImportExportCSVDuplicateExpires { get; set; }
|
||||
|
||||
|
||||
|
||||
public string Wiki { get; set; }
|
||||
public List<string> Tags { get; set; }
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Sockeye.Util
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 504;
|
||||
internal const long EXPECTED_INDEX_COUNT = 74;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 241;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 240;
|
||||
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 32;
|
||||
internal const long EXPECTED_VIEWS = 0;
|
||||
internal const long EXPECTED_ROUTINES = 2;
|
||||
@@ -874,7 +874,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
LogUpdateMessage(log);
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMPTZ NOT NULL, active BOOL NOT NULL DEFAULT false, "
|
||||
+ "customerid BIGINT REFERENCES acustomer(id), pgroup INTEGER NOT NULL DEFAULT 0, regto TEXT NOT NULL, key TEXT NOT NULL, fetchcode TEXT, fetchemail TEXT, "
|
||||
+ "customerid BIGINT REFERENCES acustomer(id), pgroup INTEGER NOT NULL DEFAULT 0, regto TEXT NOT NULL, key TEXT, fetchcode TEXT, fetchemail TEXT, "
|
||||
+ "fetchedon TIMESTAMPTZ, dbid TEXT, licenseexpire TIMESTAMPTZ, maintenanceexpire TIMESTAMPTZ NOT NULL, "
|
||||
+ "wiki TEXT, tags VARCHAR(255) ARRAY )");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user