licensing system change, all internal active, no more scheduleable resources / tech licensing

This commit is contained in:
2022-09-12 21:57:31 +00:00
parent bf40d7ecab
commit e77672aafa
4 changed files with 22 additions and 49 deletions

View File

@@ -76,9 +76,9 @@ namespace rockfishCore.Controllers
//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.Now.AddDays((RavenKeyFactory.PERPETUAL_TRIAL_PERIOD_DAYS * -1)));
MustBeOlderThan = DateUtil.DateToEpoch(DateTime.Now.AddDays((RavenKeyFactory.TRIAL_PERIOD_DAYS * -1)));
else
MustBeOlderThan = DateUtil.DateToEpoch(DateTime.Now.AddHours((RavenKeyFactory.SUBSCRIPTION_TRIAL_PERIOD_HOURS * -1)));
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())

View File

@@ -6,31 +6,7 @@ using Org.BouncyCastle.Security;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.OpenSsl;
/*
Sample key:
[KEY
{
"Key": {
"LicenseFormat": "8",
"Id": "1660594773",
"RegisteredTo": "AAA TEST DEVELOPMENT",
"DBID": "1q3Q8MedzUQ/VQVWjQiLs3o/7nSbNFUpF5KzkM/Ny0M=",
"Perpetual": true,
"LicenseExpiration": "5555-01-01T00:00:00",
"MaintenanceExpiration": "2023-08-15T00:00:00",
"Features": [
{
"Name": "ServiceTechs",
"Count": 100
}
]
}
}
KEY]
[SIGNATURE
VaVGBaXjnh1A7etqYp9bu5XkGaLxD2AplT+DERaIL8gHqSEj+1s3seEZpuRBJAvof5j++Si3ZCuesYL2M6IQUwmimYMwbQPH07MixOYxgc4kKMO53AwTmtBxwEzUYdhMn5i3g/2xOpJoXTsyqOJ0v1ZidFswQs8vVtxBO8uanlMKzFpXZE8K0cI8ZII9nRdBoUERO+JoEE16l/UAgi6O7KT8l1r225RodFhAThrdAT5ntIJ0JaTHPaMgnYb25VGS9LYQUWU7nkA+IsfddjxZW70a8IHXvQ1B5oV6srFVdkS4wY0dgbT+k7VJBDhMmltRDdOUH
*/
namespace rockfishCore.Util
@@ -38,8 +14,9 @@ namespace rockfishCore.Util
//Key generator controller
public static class RavenKeyFactory
{
public const int PERPETUAL_TRIAL_PERIOD_DAYS = 5;
public const int SUBSCRIPTION_TRIAL_PERIOD_HOURS = 48;
//Sept 2022 decided all trial periods are 7 days, they can keep renewing a new trial by erasing data or request a longer period case by case
public const int TRIAL_PERIOD_DAYS = 7;
//Unlicensed token
@@ -50,8 +27,7 @@ namespace rockfishCore.Util
//LICENSE USER COUNT FEATURES
//PERPETUAL Scheduleable users
private const string ACTIVE_SERVICE_TECHS_FEATURE_NAME = "ServiceTechs";
//SUBSCRIPTION
private const string ACTIVE_INTERNAL_USERS_FEATURE_NAME = "ActiveInternalUsers";
@@ -113,11 +89,7 @@ namespace rockfishCore.Util
continue;
}
if (f.Feature == ACTIVE_SERVICE_TECHS_FEATURE_NAME)
{
sb.AppendLine($"Scheduleable resources: {f.Count}");
continue;
}
//default for items added later not tokenized
if (f.Count > 0)
sb.AppendLine($"{f.Feature}: {f.Count}");
@@ -252,15 +224,15 @@ namespace rockfishCore.Util
if (Perpetual)
{
//trial period time limit
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(PERPETUAL_TRIAL_PERIOD_DAYS);
//enough techs to easily cover huge amounts of seeding (it's actually only 15 at the moment but you never know this is some buffer)
k.Features.Add(new LicenseFeature() { Feature = ACTIVE_SERVICE_TECHS_FEATURE_NAME, Count = 250 });
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS);
//5k inside staff users will cover huge seeding level easily
k.Features.Add(new LicenseFeature() { Feature = ACTIVE_INTERNAL_USERS_FEATURE_NAME, Count = 5000 });
}
else
{
//SUBSCRIPTION
//trial period time limit
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddHours(SUBSCRIPTION_TRIAL_PERIOD_HOURS);
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS);
//20k customer contacts will cover huge seeding level easily
//5k inside staff users will cover huge seeding level easily
@@ -283,13 +255,14 @@ namespace rockfishCore.Util
k.Perpetual = Perpetual;
if (Perpetual)
{
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(PERPETUAL_TRIAL_PERIOD_DAYS);
k.Features.Add(new LicenseFeature() { Feature = ACTIVE_SERVICE_TECHS_FEATURE_NAME, Count = 250 });
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS);
//5k inside staff users will cover huge seeding level easily
k.Features.Add(new LicenseFeature() { Feature = ACTIVE_INTERNAL_USERS_FEATURE_NAME, Count = 5000 });
}
else
{
//SUBSCRIPTION
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddHours(SUBSCRIPTION_TRIAL_PERIOD_HOURS);
k.MaintenanceExpiration = k.LicenseExpiration = DateTime.UtcNow.AddDays(TRIAL_PERIOD_DAYS);
//20k customer contacts will cover huge seeding level easily
//5k inside staff users will cover huge seeding level easily

View File

@@ -75,8 +75,8 @@ app.ravLicense = (function () {
if ($("#perpetual").prop("checked")) {
features.push({
Feature: "ServiceTechs",
Count: Number($("#techcount").val())
Feature: "ActiveInternalUsers",
Count: Number($("#perpetusercount").val())
});
} else {
if (!$("#licenseExpires").prop("checked")) {
@@ -137,7 +137,7 @@ app.ravLicense = (function () {
onPerpetualChanged = function (event) {
event.preventDefault();
$("#perpettechcountblock").toggleClass("d-none");
$("#perpetusercountblock").toggleClass("d-none");
$("#subusercountblock").toggleClass("d-none");
$("#subcustcountblock").toggleClass("d-none");

View File

@@ -96,14 +96,14 @@
</div>
</div>
<div id="perpettechcountblock" class="col-sm-6 d-none">
<div id="perpetusercountblock" class="col-sm-6 d-none">
<div class="form-group">
<label for="techcount">Scheduleable users</label>
<label for="perpetusercount">Internal users</label>
<input
class="form-control"
type="number"
id="techcount"
name="techcount"
id="perpetusercount"
name="perpetusercount"
value="1"
/>
</div>