[feature] Add tenant statistics; Fix bug 76520

This commit is contained in:
PauI Ostrovckij
2025-12-01 00:05:15 +03:00
parent ae27abdfe1
commit 80614e1d6a
7 changed files with 349 additions and 6 deletions

View File

@ -91,6 +91,21 @@ async function licenseInfo(req, res, getConnections = null) {
const ctx = new operationContext.Context();
try {
ctx.initFromRequest(req);
const requestedTenant = req.query && req.query.tenant;
if (requestedTenant) {
const userTenant = req.user && req.user.tenant;
if (userTenant && requestedTenant !== userTenant) {
const defaultTenant = tenantManager.getDefautTenant();
if (userTenant !== defaultTenant) {
if (!res.headersSent) {
res.status(403).json({error: 'Forbidden'});
}
return;
}
}
ctx.setTenant(requestedTenant);
}
await ctx.initTenantCache();
ctx.logger.debug('licenseInfo start');