mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Website: Update admin license generator (#13101)
Closes: https://github.com/fleetdm/confidential/issues/3230 Changes: - Added a new (optional) input to the admin license key generator: `partnerName`. - Renamed `admin/generate-license-key.js` to `admin/build-license-key.js`, updated routes and regenerated `cloud.setup.js` - Updated the create license key helper to add a `partner` field to the generated license key if `partnerName` is provided.
This commit is contained in:
parent
06319f7453
commit
ab504d766a
@ -1,10 +1,10 @@
|
||||
module.exports = {
|
||||
|
||||
|
||||
friendlyName: 'Generate license key',// FUTURE: Rename this to avoid confusion w/ generators. For example: 'Build license key'
|
||||
friendlyName: 'Build license key',
|
||||
|
||||
|
||||
description: 'Generate and return a Fleet Premium license key.',
|
||||
description: 'Build and return a Fleet Premium license key.',
|
||||
|
||||
|
||||
inputs: {
|
||||
@ -22,6 +22,11 @@ module.exports = {
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'A JS timestamp representing when this license will expire.',
|
||||
},
|
||||
|
||||
partnerName: {
|
||||
type: 'string',
|
||||
description: 'The name of the partner that will be reselling the generated license.',
|
||||
}
|
||||
},
|
||||
|
||||
@ -34,12 +39,13 @@ module.exports = {
|
||||
},
|
||||
|
||||
|
||||
fn: async function ({numberOfHosts, organization, expiresAt}) {
|
||||
fn: async function ({numberOfHosts, organization, expiresAt, partnerName}) {
|
||||
|
||||
let licenseKey = await sails.helpers.createLicenseKey.with({
|
||||
numberOfHosts: numberOfHosts,
|
||||
organization: organization,
|
||||
expiresAt: expiresAt
|
||||
expiresAt: expiresAt,
|
||||
partnerName: partnerName,
|
||||
});
|
||||
|
||||
return licenseKey;
|
9
website/api/helpers/create-license-key.js
vendored
9
website/api/helpers/create-license-key.js
vendored
@ -23,6 +23,12 @@ module.exports = {
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'A JS timestamp representing when this license will expire.'
|
||||
},
|
||||
|
||||
partnerName: {
|
||||
type: 'string',
|
||||
description: 'The name of the partner who will be reselling this genereated license.',
|
||||
extendedDescription: 'This input is only used by the admin license generator tool.',
|
||||
}
|
||||
|
||||
},
|
||||
@ -37,7 +43,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
|
||||
fn: async function ({numberOfHosts, organization, expiresAt}) {
|
||||
fn: async function ({numberOfHosts, organization, expiresAt, partnerName}) {
|
||||
|
||||
let jwt = require('jsonwebtoken');
|
||||
|
||||
@ -50,6 +56,7 @@ module.exports = {
|
||||
devices: numberOfHosts,
|
||||
note: 'Created with Fleet License key dispenser',
|
||||
tier: 'premium',
|
||||
partner: partnerName // If this value is undefined, it will not be included in the generated token.
|
||||
},
|
||||
{
|
||||
key: sails.config.custom.licenseKeyGeneratorPrivateKey,
|
||||
|
2
website/assets/js/cloud.setup.js
vendored
2
website/assets/js/cloud.setup.js
vendored
@ -13,7 +13,7 @@
|
||||
Cloud.setup({
|
||||
|
||||
/* eslint-disable */
|
||||
methods: {"downloadSitemap":{"verb":"GET","url":"/sitemap.xml","args":[]},"downloadRssFeed":{"verb":"GET","url":"/rss/:categoryName","args":["categoryName"]},"receiveUsageAnalytics":{"verb":"POST","url":"/api/v1/webhooks/receive-usage-analytics","args":["anonymousIdentifier","fleetVersion","licenseTier","numHostsEnrolled","numUsers","numTeams","numPolicies","numLabels","softwareInventoryEnabled","vulnDetectionEnabled","systemUsersEnabled","hostStatusWebhookEnabled","numWeeklyActiveUsers","numWeeklyPolicyViolationDaysActual","numWeeklyPolicyViolationDaysPossible","hostsEnrolledByOperatingSystem","hostsEnrolledByOrbitVersion","hostsEnrolledByOsqueryVersion","storedErrors","numHostsNotResponding","organization"]},"receiveFromGithub":{"verb":"GET","url":"/api/v1/webhooks/github","args":["botSignature","action","sender","repository","changes","issue","comment","pull_request","label","release"]},"receiveFromStripe":{"verb":"POST","url":"/api/v1/webhooks/receive-from-stripe","args":["id","type","data","webhookSecret"]},"receiveFromCustomerFleetInstance":{"verb":"POST","url":"/api/v1/webhooks/receive-from-customer-fleet-instance","args":["timestamp","host","webhookSecret"]},"deliverContactFormMessage":{"verb":"POST","url":"/api/v1/deliver-contact-form-message","args":["emailAddress","topic","firstName","lastName","message"]},"sendPasswordRecoveryEmail":{"verb":"POST","url":"/api/v1/entrance/send-password-recovery-email","args":["emailAddress"]},"signup":{"verb":"POST","url":"/api/v1/customers/signup","args":["emailAddress","password","organization","firstName","lastName","signupReason"]},"updateProfile":{"verb":"POST","url":"/api/v1/account/update-profile","args":["firstName","lastName","organization","emailAddress"]},"updatePassword":{"verb":"POST","url":"/api/v1/account/update-password","args":["oldPassword","newPassword"]},"updateBillingCard":{"verb":"POST","url":"/api/v1/account/update-billing-card","args":["stripeToken","billingCardLast4","billingCardBrand","billingCardExpMonth","billingCardExpYear"]},"login":{"verb":"POST","url":"/api/v1/customers/login","args":["emailAddress","password","rememberMe"]},"logout":{"verb":"GET","url":"/api/v1/account/logout","args":[]},"createQuote":{"verb":"POST","url":"/api/v1/customers/create-quote","args":["numberOfHosts"]},"saveBillingInfoAndSubscribe":{"verb":"POST","url":"/api/v1/customers/save-billing-info-and-subscribe","args":["quoteId","organization","firstName","lastName","paymentSource"]},"updatePasswordAndLogin":{"verb":"POST","url":"/api/v1/entrance/update-password-and-login","args":["password","token"]},"deliverDemoSignup":{"verb":"POST","url":"/api/v1/deliver-demo-signup","args":["emailAddress"]},"createOrUpdateOneNewsletterSubscription":{"verb":"POST","url":"/api/v1/create-or-update-one-newsletter-subscription","args":["emailAddress","subscribeTo"]},"unsubscribeFromAllNewsletters":{"verb":"GET","url":"/api/v1/unsubscribe-from-all-newsletters","args":["emailAddress"]},"generateLicenseKey":{"verb":"POST","url":"/api/v1/admin/generate-license-key","args":["numberOfHosts","organization","expiresAt"]},"createVantaAuthorizationRequest":{"verb":"POST","url":"/api/v1/create-vanta-authorization-request","args":["emailAddress","fleetInstanceUrl","fleetApiKey"]},"deliverMdmBetaSignup":{"verb":"POST","url":"/api/v1/deliver-mdm-beta-signup","args":["emailAddress","fullName","jobTitle","numberOfHosts"]},"deliverAppleCsr":{"verb":"POST","url":"/api/v1/deliver-apple-csr","args":["unsignedCsrData"]},"deliverPremiumUpgradeForm":{"verb":"POST","url":"/api/v1/deliver-premium-upgrade-form","args":["organization","monthsUsingFleetFree","emailAddress","numberOfHosts"]},"deliverLaunchPartySignup":{"verb":"POST","url":"/api/v1/deliver-launch-party-signup","args":["emailAddress","firstName","lastName","jobTitle","phoneNumber"]},"deliverMdmDemoEmail":{"verb":"POST","url":"/api/v1/deliver-mdm-demo-email","args":[]}}
|
||||
methods: {"downloadSitemap":{"verb":"GET","url":"/sitemap.xml","args":[]},"downloadRssFeed":{"verb":"GET","url":"/rss/:categoryName","args":["categoryName"]},"receiveUsageAnalytics":{"verb":"POST","url":"/api/v1/webhooks/receive-usage-analytics","args":["anonymousIdentifier","fleetVersion","licenseTier","numHostsEnrolled","numUsers","numTeams","numPolicies","numLabels","softwareInventoryEnabled","vulnDetectionEnabled","systemUsersEnabled","hostStatusWebhookEnabled","numWeeklyActiveUsers","numWeeklyPolicyViolationDaysActual","numWeeklyPolicyViolationDaysPossible","hostsEnrolledByOperatingSystem","hostsEnrolledByOrbitVersion","hostsEnrolledByOsqueryVersion","storedErrors","numHostsNotResponding","organization"]},"receiveFromGithub":{"verb":"GET","url":"/api/v1/webhooks/github","args":["botSignature","action","sender","repository","changes","issue","comment","pull_request","label","release"]},"receiveFromStripe":{"verb":"POST","url":"/api/v1/webhooks/receive-from-stripe","args":["id","type","data","webhookSecret"]},"receiveFromCustomerFleetInstance":{"verb":"POST","url":"/api/v1/webhooks/receive-from-customer-fleet-instance","args":["timestamp","host","webhookSecret"]},"deliverContactFormMessage":{"verb":"POST","url":"/api/v1/deliver-contact-form-message","args":["emailAddress","topic","firstName","lastName","message"]},"sendPasswordRecoveryEmail":{"verb":"POST","url":"/api/v1/entrance/send-password-recovery-email","args":["emailAddress"]},"signup":{"verb":"POST","url":"/api/v1/customers/signup","args":["emailAddress","password","organization","firstName","lastName","signupReason"]},"updateProfile":{"verb":"POST","url":"/api/v1/account/update-profile","args":["firstName","lastName","organization","emailAddress"]},"updatePassword":{"verb":"POST","url":"/api/v1/account/update-password","args":["oldPassword","newPassword"]},"updateBillingCard":{"verb":"POST","url":"/api/v1/account/update-billing-card","args":["stripeToken","billingCardLast4","billingCardBrand","billingCardExpMonth","billingCardExpYear"]},"login":{"verb":"POST","url":"/api/v1/customers/login","args":["emailAddress","password","rememberMe"]},"logout":{"verb":"GET","url":"/api/v1/account/logout","args":[]},"createQuote":{"verb":"POST","url":"/api/v1/customers/create-quote","args":["numberOfHosts"]},"saveBillingInfoAndSubscribe":{"verb":"POST","url":"/api/v1/customers/save-billing-info-and-subscribe","args":["quoteId","organization","firstName","lastName","paymentSource"]},"updatePasswordAndLogin":{"verb":"POST","url":"/api/v1/entrance/update-password-and-login","args":["password","token"]},"deliverDemoSignup":{"verb":"POST","url":"/api/v1/deliver-demo-signup","args":["emailAddress"]},"createOrUpdateOneNewsletterSubscription":{"verb":"POST","url":"/api/v1/create-or-update-one-newsletter-subscription","args":["emailAddress","subscribeTo"]},"unsubscribeFromAllNewsletters":{"verb":"GET","url":"/api/v1/unsubscribe-from-all-newsletters","args":["emailAddress"]},"buildLicenseKey":{"verb":"POST","url":"/api/v1/admin/build-license-key","args":["numberOfHosts","organization","expiresAt","partnerName"]},"createVantaAuthorizationRequest":{"verb":"POST","url":"/api/v1/create-vanta-authorization-request","args":["emailAddress","fleetInstanceUrl","fleetApiKey"]},"deliverMdmBetaSignup":{"verb":"POST","url":"/api/v1/deliver-mdm-beta-signup","args":["emailAddress","fullName","jobTitle","numberOfHosts"]},"deliverAppleCsr":{"verb":"POST","url":"/api/v1/deliver-apple-csr","args":["unsignedCsrData"]},"deliverPremiumUpgradeForm":{"verb":"POST","url":"/api/v1/deliver-premium-upgrade-form","args":["organization","monthsUsingFleetFree","emailAddress","numberOfHosts"]},"deliverLaunchPartySignup":{"verb":"POST","url":"/api/v1/deliver-launch-party-signup","args":["emailAddress","firstName","lastName","jobTitle","phoneNumber"]},"deliverMdmDemoEmail":{"verb":"POST","url":"/api/v1/deliver-mdm-demo-email","args":["emailAddress"]}}
|
||||
/* eslint-enable */
|
||||
|
||||
});
|
||||
|
@ -43,10 +43,11 @@ parasails.registerPage('generate-license', {
|
||||
let validToDate = new Date(this.formData.expiresAt);
|
||||
let licenseExpiresAt = validToDate.getTime();
|
||||
|
||||
this.generatedLicenseKey = await Cloud.generateLicenseKey.with({
|
||||
this.generatedLicenseKey = await Cloud.buildLicenseKey.with({
|
||||
numberOfHosts: this.formData.numberOfHosts,
|
||||
organization: this.formData.organization,
|
||||
expiresAt: licenseExpiresAt
|
||||
expiresAt: licenseExpiresAt,
|
||||
partnerName: this.formData.partnerName,
|
||||
});
|
||||
},
|
||||
|
||||
|
2
website/config/routes.js
vendored
2
website/config/routes.js
vendored
@ -540,7 +540,7 @@ module.exports.routes = {
|
||||
'POST /api/v1/deliver-demo-signup': { action: 'deliver-demo-signup' },
|
||||
'POST /api/v1/create-or-update-one-newsletter-subscription': { action: 'create-or-update-one-newsletter-subscription' },
|
||||
'/api/v1/unsubscribe-from-all-newsletters': { action: 'unsubscribe-from-all-newsletters' },
|
||||
'POST /api/v1/admin/generate-license-key': { action: 'admin/generate-license-key' },
|
||||
'POST /api/v1/admin/build-license-key': { action: 'admin/build-license-key' },
|
||||
'POST /api/v1/create-vanta-authorization-request': { action: 'create-vanta-authorization-request' },
|
||||
'POST /api/v1/deliver-mdm-beta-signup': { action: 'deliver-mdm-beta-signup' },
|
||||
'POST /api/v1/deliver-apple-csr ': { action: 'deliver-apple-csr', csrf: false},
|
||||
|
@ -22,6 +22,10 @@
|
||||
<div class="invalid-feedback" v-if="formErrors.numberOfHosts">Please enter a number of hosts</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-12 px-0">
|
||||
<label for="partnerName">License reseller partner name</label>
|
||||
<input class="form-control" id="partnerName" type="text" placeholder="(Optional)" v-model.trim="formData.partnerName">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-12 px-0">
|
||||
<label for="expiresAt">When should this license expire?</label>
|
||||
@ -29,6 +33,7 @@
|
||||
<div class="invalid-feedback" v-if="formErrors.expiresAt">Please enter a date that this license will be valid to.</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<cloud-error purpose="cloud-error" v-if="cloudError"></cloud-error>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user