This commit is contained in:
2023-02-15 23:26:05 +00:00
parent 82cacacfde
commit 98cb68850e
6 changed files with 61 additions and 8 deletions

View File

@@ -43,11 +43,18 @@ namespace Sockeye.Biz
//
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
//raven default for non expiring keys is this
if (newObject.LicenseExpire == null)
{
newObject.LicenseExpire = DateUtil.EmptyDateValueForLicenseGeneration;
}
await ValidateAsync(newObject, null);
if (HasErrors)
return null;
else
{
if (!importedWithKeyDoNotGenerate)//do not generate is used for initial import only from rockfish, could be removed after the initial import
{
await GenerateKey(newObject);
@@ -105,6 +112,12 @@ namespace Sockeye.Biz
}
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
//client can send a non expiring license key but internally it MUST have a date so the
//raven default for non expiring keys is this
if (putObject.LicenseExpire == null)
{
putObject.LicenseExpire = DateUtil.EmptyDateValueForLicenseGeneration;
}
await ValidateAsync(putObject, dbObject);
if (HasErrors) return null;
await GenerateKey(putObject);
@@ -244,7 +257,7 @@ MaximumDataGB: 20
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//DELETE
//
internal async Task<bool> DeleteAsync(long id)
@@ -720,7 +733,7 @@ MaximumDataGB: 20
}
#endregion key gen
////////////////////////////////////////////////////////////////////////////////////////////////
//SEARCH
//
@@ -761,6 +774,8 @@ MaximumDataGB: 20
{
bool isNew = currentObj == null;
//fetched keys are never editable, must be duped if re-issue
//I'LL PROBABLY NEED TO CHANGE THIS LATER FOR SOME REASON BUT FOR NOW IT'S DEFENSIVE
if (!isNew && currentObj.FetchedOn != null)
@@ -827,6 +842,15 @@ MaximumDataGB: 20
}
//RAVEN keys *always* expire
//perpets expire in the year 5555
if (proposedObj.LicenseExpire == null)
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "LicenseExpire");
return;
}
}
break;
case ProductGroup.RavenSubscription:
@@ -838,7 +862,7 @@ MaximumDataGB: 20
}
//sub keys *always* expire
//RAVEN keys *always* expire
if (proposedObj.LicenseExpire == null)
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "LicenseExpire");