[feature] Add "multitenancy" flag as alternative to "alias"

This commit is contained in:
Sergey Konovalov
2024-11-12 16:48:35 +03:00
parent 8b8dacf3e4
commit d0a6670bfc
4 changed files with 14 additions and 6 deletions

View File

@ -59,7 +59,8 @@ exports.readLicense = async function () {
startDate: startDate,
endDate: null,
customerId: "",
alias: ""
alias: "",
multitenancy: false
}, null];
};

View File

@ -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;
}

View File

@ -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) {