This commit is contained in:
2022-10-26 01:39:48 +00:00
parent daeaead405
commit 82fa388776
2 changed files with 21 additions and 14 deletions

View File

@@ -70,21 +70,22 @@ namespace rockfishCore.Controllers
return Ok("Request awaiting approval"); return Ok("Request awaiting approval");
} }
//OK, no idea why we care about this, you can't re-request a trial if you're doing one so I"m commenting out this block as it's messing with testing expired key re-request
//2022-10-25
//I can't see any reason for it but if it should come up can just uncomment again later
// //if there is an active trial for this db then can't do this they must request we re-release it or completely zap the database instead
// long MustBeOlderThan = 0;
// if (r.Perpetual)
// MustBeOlderThan = DateUtil.DateToEpoch(DateTime.UtcNow.AddDays((RavenKeyFactory.TRIAL_PERIOD_DAYS * -1)));
// else
// MustBeOlderThan = DateUtil.DateToEpoch(DateTime.UtcNow.AddDays((RavenKeyFactory.TRIAL_PERIOD_DAYS * -1)));
// if (await ct.TrialRequest.Where(z => z.DbId == r.DbId && z.DtProcessed != null && z.DtProcessed > MustBeOlderThan).AnyAsync())
//if there is an active trial for this db then can't do this they must request we re-release it or completely zap the database instead // {
long MustBeOlderThan = 0; // return BadRequest("E1000 - Can't trial; there is already an active trial license issued for this database Id");
if (r.Perpetual) // }
MustBeOlderThan = DateUtil.DateToEpoch(DateTime.Now.AddDays((RavenKeyFactory.TRIAL_PERIOD_DAYS * -1)));
else
MustBeOlderThan = DateUtil.DateToEpoch(DateTime.Now.AddDays((RavenKeyFactory.TRIAL_PERIOD_DAYS * -1)));
if (await ct.TrialRequest.Where(z => z.DbId == r.DbId && z.DtProcessed != null && z.DtProcessed > MustBeOlderThan).AnyAsync())
{
return BadRequest("E1000 - Can't trial; there is already an active trial license issued for this database Id");
}
//Everything seems to be in order, save the request and return ok //Everything seems to be in order, save the request and return ok
var NewRequest = new TrialRequest(); var NewRequest = new TrialRequest();

View File

@@ -225,7 +225,13 @@ namespace rockfishCore.Util
if (Perpetual) if (Perpetual)
{ {
//trial period time limit //trial period time limit
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS); //NOTE: this preserves the current time, should it be set to midnight or something?
//#warning FYI ROCKFISH is SET TO GENERATE A VERY SHORT TEST KEY
//Normal code, uncomment this when done testing expiration dates of perpetual
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS);
//Testing code for 3 minute long evaluation license in case need to test with a key that expires
// k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddMinutes(3); //TEST VALUE FOR DIAGNOSING LICENSE EXPIRATION ISSUES
//5k inside staff users will cover huge seeding level easily //5k inside staff users will cover huge seeding level easily
k.Features.Add(new LicenseFeature() { Feature = ACTIVE_INTERNAL_USERS_FEATURE_NAME, Count = 5000 }); k.Features.Add(new LicenseFeature() { Feature = ACTIVE_INTERNAL_USERS_FEATURE_NAME, Count = 5000 });
} }