mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[feature] Add "multitenancy" flag as alternative to "alias"
This commit is contained in:
@ -59,7 +59,8 @@ exports.readLicense = async function () {
|
||||
startDate: startDate,
|
||||
endDate: null,
|
||||
customerId: "",
|
||||
alias: ""
|
||||
alias: "",
|
||||
multitenancy: false
|
||||
}, null];
|
||||
};
|
||||
|
||||
|
||||
@ -246,7 +246,8 @@ function fixTenantLicense(ctx, licenseInfo, licenseInfoTenant) {
|
||||
async function getTenantLicense(ctx) {
|
||||
let res = licenseTuple;
|
||||
if (isMultitenantMode(ctx) && !isDefaultTenant(ctx)) {
|
||||
if (licenseInfo.alias) {
|
||||
//todo alias is deprecated. remove one year after 8.3
|
||||
if (licenseInfo.multitenancy || licenseInfo.alias) {
|
||||
let tenantPath = utils.removeIllegalCharacters(ctx.tenant);
|
||||
let licensePath = path.join(cfgTenantsBaseDir, tenantPath, cfgTenantsFilenameLicense);
|
||||
let licenseTupleTenant = nodeCache.get(licensePath);
|
||||
@ -263,7 +264,7 @@ async function getTenantLicense(ctx) {
|
||||
res = [...res];
|
||||
res[0] = {...res[0]};
|
||||
res.type = constants.LICENSE_RESULT.Error;
|
||||
ctx.logger.error('getTenantLicense error: missing "alias" field');
|
||||
ctx.logger.error('getTenantLicense error: missing "multitenancy" or "alias" field');
|
||||
}
|
||||
}
|
||||
return res;
|
||||
@ -312,6 +313,10 @@ async function readLicenseTenant(ctx, licenseFile, baseVerifiedLicense) {
|
||||
res.alias = oLicense['alias'];
|
||||
}
|
||||
|
||||
if (oLicense['multitenancy']) {
|
||||
res.multitenancy = oLicense['multitenancy'];
|
||||
}
|
||||
|
||||
if (true === oLicense['timelimited']) {
|
||||
res.mode |= c_LM.Limited;
|
||||
}
|
||||
|
||||
@ -1159,6 +1159,7 @@ exports.convertLicenseInfoToFileParams = function(licenseInfo) {
|
||||
license.users_expire = licenseInfo.usersExpire / constants.LICENSE_EXPIRE_USERS_ONE_DAY;
|
||||
license.customer_id = licenseInfo.customerId;
|
||||
license.alias = licenseInfo.alias;
|
||||
license.multitenancy = licenseInfo.multitenancy;
|
||||
return license;
|
||||
};
|
||||
exports.convertLicenseInfoToServerParams = function(licenseInfo) {
|
||||
|
||||
Reference in New Issue
Block a user