This commit is contained in:
2023-02-16 19:58:31 +00:00
parent b427437bc4
commit 678a234751
2 changed files with 21 additions and 16 deletions

View File

@@ -151,7 +151,7 @@ namespace Sockeye.Biz
// Extra info to display about key at top of key message // Extra info to display about key at top of key message
private static string LicenseInfo(License l) public static string LicenseInfo(License l)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append("LICENSE DETAILS\r\n"); sb.Append("LICENSE DETAILS\r\n");

View File

@@ -43,9 +43,9 @@ namespace Sockeye.Biz
// //
internal async Task<License> CreateAsync(License newObject, bool importedWithKeyDoNotGenerate = false) internal async Task<License> CreateAsync(License newObject, bool importedWithKeyDoNotGenerate = false)
{ {
//client can send a non expiring license key but internally it MUST have a date so the //client can send a non expiring license key but internally it MUST have a date if it's RAVEN so the
//raven default for non expiring keys is this //raven default for non expiring keys is this
if (newObject.LicenseExpire == null && !newObject.TrialMode) if (newObject.LicenseExpire == null && !newObject.TrialMode && newObject.PGroup != ProductGroup.AyaNova7)
{ {
newObject.LicenseExpire = DateUtil.EmptyDateValueForLicenseGeneration; newObject.LicenseExpire = DateUtil.EmptyDateValueForLicenseGeneration;
} }
@@ -112,16 +112,16 @@ namespace Sockeye.Biz
} }
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags); putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
//client can send a non expiring license key but internally it MUST have a date so the //client can send a non expiring license key but internally it MUST have a date (RAVEN ONLY) so the
//raven default for non expiring keys is this //raven default for non expiring keys is this
if (putObject.LicenseExpire == null && !putObject.TrialMode) if (putObject.LicenseExpire == null && !putObject.TrialMode && putObject.PGroup != ProductGroup.AyaNova7)
{ {
putObject.LicenseExpire = DateUtil.EmptyDateValueForLicenseGeneration; putObject.LicenseExpire = DateUtil.EmptyDateValueForLicenseGeneration;
} }
await ValidateAsync(putObject, dbObject); await ValidateAsync(putObject, dbObject);
if (HasErrors) return null; if (HasErrors) return null;
if(putObject.Active) if (putObject.Active)
await GenerateKey(putObject); await GenerateKey(putObject);
if (HasErrors) return null; if (HasErrors) return null;
@@ -166,23 +166,23 @@ namespace Sockeye.Biz
//## ------------------ DEFAULT NOTIFICATIONS TO CUSTOMER ON LICENSE AVAILABLE ---------------- //## ------------------ DEFAULT NOTIFICATIONS TO CUSTOMER ON LICENSE AVAILABLE ----------------
string body = string.Empty; string body = string.Empty;
var licenseInfo = KeyFactory.LicenseInfo(l);
switch (l.PGroup) switch (l.PGroup)
{ {
case ProductGroup.AyaNova7: case ProductGroup.AyaNova7:
if (l.TrialMode) if (l.TrialMode)
{ {
body = ServerGlobalBizSettings.Cache.V7TemporaryTrial; body = ServerGlobalBizSettings.Cache.V7TemporaryTrial.Replace("{LicenseDescription}", licenseInfo);
} }
else else
{ {
if (l.Renewal) if (l.Renewal)
{ {
body = ServerGlobalBizSettings.Cache.V7AddOnKey; body = ServerGlobalBizSettings.Cache.V7AddOnKey.Replace("{LicenseDescription}", licenseInfo);
} }
else else
{ {
body = ServerGlobalBizSettings.Cache.V7NewKey; body = ServerGlobalBizSettings.Cache.V7NewKey.Replace("{LicenseDescription}", licenseInfo);
} }
} }
break; break;
@@ -202,8 +202,8 @@ namespace Sockeye.Biz
ActiveInternalUsers: 3 ActiveInternalUsers: 3
*/ */
var licenseInfo = $"Registered to: {l.RegTo}\nDatabase Id: {l.DbId}\nType: Perpetual\nSupport and updates until: {l.MaintenanceExpire.ToLongDateString()}\nUsers:{l.Users}"; var RavLicenseInfo = $"Registered to: {l.RegTo}\nDatabase Id: {l.DbId}\nType: Perpetual\nSupport and updates until: {l.MaintenanceExpire.ToLongDateString()}\nUsers:{l.Users}";
body = ServerGlobalBizSettings.Cache.RavenNewKeyAvailable.Replace("{newLicense}", licenseInfo); body = ServerGlobalBizSettings.Cache.RavenNewKeyAvailable.Replace("{newLicense}", RavLicenseInfo);
} }
break; break;
case ProductGroup.RavenSubscription: case ProductGroup.RavenSubscription:
@@ -224,8 +224,8 @@ ActiveCustomerUsers: 250
MaximumDataGB: 20 MaximumDataGB: 20
*/ */
var licenseInfo = $"Registered to: {l.RegTo}\nDatabase Id: {l.DbId}\nType: Subscription\nAvailable for use until: {((DateTime)l.LicenseExpire).ToLongDateString()}\nUsers:{l.Users}\nCustomer login Users:{l.CustomerUsers}\nMaximum data GB:{l.MaxDataGB}"; var RavLicenseInfo = $"Registered to: {l.RegTo}\nDatabase Id: {l.DbId}\nType: Subscription\nAvailable for use until: {((DateTime)l.LicenseExpire).ToLongDateString()}\nUsers:{l.Users}\nCustomer login Users:{l.CustomerUsers}\nMaximum data GB:{l.MaxDataGB}";
body = ServerGlobalBizSettings.Cache.RavenNewKeyAvailable.Replace("{newLicense}", licenseInfo); body = ServerGlobalBizSettings.Cache.RavenNewKeyAvailable.Replace("{newLicense}", RavLicenseInfo);
} }
break; break;
default: default:
@@ -829,6 +829,11 @@ MaximumDataGB: 20
} }
if (proposedObj.LicenseExpire == null && proposedObj.TrialMode)
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "LicenseExpire", "TRIAL MODE REQUIRES EXPIRY");
return;
}
//Active state rules for each product group //Active state rules for each product group
@@ -863,7 +868,7 @@ MaximumDataGB: 20
return; return;
} }
//RAVEN keys *always* expire //RAVEN keys *always* expire