mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[license] Add alias field for multi tenancy
This commit is contained in:
committed by
Sergey Konovalov
parent
5c49e96831
commit
7101472719
@ -60,7 +60,8 @@ exports.readLicense = function*() {
|
||||
buildDate: oBuildDate,
|
||||
startDate: startDate,
|
||||
endDate: null,
|
||||
customerId: ""
|
||||
customerId: "",
|
||||
alias: ""
|
||||
}, null];
|
||||
};
|
||||
|
||||
|
||||
@ -135,6 +135,10 @@ function getTenantLicense(ctx) {
|
||||
nodeCache.set(licensePath, res);
|
||||
ctx.logger.debug('getTenantLicense from %s', licensePath);
|
||||
}
|
||||
if (!res.alias) {
|
||||
res.type = constants.LICENSE_RESULT.Error;
|
||||
ctx.logger.error('getTenantLicense error: missing "alias" field');
|
||||
}
|
||||
} else {
|
||||
res = licenseInfo;
|
||||
}
|
||||
|
||||
@ -967,6 +967,8 @@ exports.convertLicenseInfoToFileParams = function(licenseInfo) {
|
||||
license.users_count = licenseInfo.usersCount;
|
||||
license.users_view_count = licenseInfo.usersViewCount;
|
||||
license.users_expire = licenseInfo.usersExpire / constants.LICENSE_EXPIRE_USERS_ONE_DAY;
|
||||
license.customer_id = licenseInfo.customerId;
|
||||
license.alias = licenseInfo.alias;
|
||||
return license;
|
||||
};
|
||||
exports.convertLicenseInfoToServerParams = function(licenseInfo) {
|
||||
|
||||
@ -165,7 +165,6 @@ let lockDocumentsTimerId = {};//to drop connection that can't unlockDocument
|
||||
let pubsub;
|
||||
let queue;
|
||||
let f = {type: constants.LICENSE_RESULT.Error, light: false, branding: false, customization: false, plugins: false};
|
||||
let licenseOriginal = null;
|
||||
let shutdownFlag = false;
|
||||
let expDocumentsStep = gc.getCronStep(cfgExpDocumentsCron);
|
||||
|
||||
@ -3721,7 +3720,7 @@ let commandLicense = co.wrap(function*(ctx) {
|
||||
let users_view = yield editorData.getPresenceUniqueViewUser(ctx, nowUTC);
|
||||
let licenseInfo = yield tenantManager.getTenantLicense(ctx);
|
||||
return {
|
||||
license: licenseOriginal || utils.convertLicenseInfoToFileParams(licenseInfo),
|
||||
license: utils.convertLicenseInfoToFileParams(licenseInfo),
|
||||
server: utils.convertLicenseInfoToServerParams(licenseInfo),
|
||||
quota: {users: users, users_view: users_view}
|
||||
};
|
||||
|
||||
@ -176,14 +176,15 @@ docsCoServer.install(server, () => {
|
||||
let licenseInfo = yield tenantManager.getTenantLicense(ctx);
|
||||
let buildVersion = commonDefines.buildVersion;
|
||||
let buildNumber = commonDefines.buildNumber;
|
||||
let buildDate, packageType, customerId = "";
|
||||
let buildDate, packageType, customerId = "", alias = "";
|
||||
if (licenseInfo) {
|
||||
buildDate = licenseInfo.buildDate.toISOString();
|
||||
packageType = licenseInfo.packageType;
|
||||
customerId = licenseInfo.customerId;
|
||||
alias = licenseInfo.alias;
|
||||
}
|
||||
let output = `Server is functioning normally. Version: ${buildVersion}. Build: ${buildNumber}`;
|
||||
output += `. Release date: ${buildDate}. Package type: ${packageType}. Customer Id: ${customerId}`;
|
||||
output += `. Release date: ${buildDate}. Package type: ${packageType}. Customer Id: ${customerId}. Alias: ${alias}`;
|
||||
res.send(output);
|
||||
} catch (err) {
|
||||
ctx.logger.error('index.html error: %s', err.stack);
|
||||
|
||||
Reference in New Issue
Block a user