debug: логирование switchTo, resolveContext, enhanceImpersonation
This commit is contained in:
@@ -26,9 +26,24 @@ function enhanceImpersonation(req, res, next) {
|
||||
const u = req.session && req.session.user;
|
||||
if (!u) return next();
|
||||
|
||||
console.log('[v2:impersonation] enter', {
|
||||
sessionID: req.sessionID,
|
||||
email: u.email,
|
||||
activeClientId: u.activeClientId,
|
||||
clientId: u.clientId,
|
||||
isImpersonated: u.isImpersonated,
|
||||
originalUserEmail: u.originalUserEmail,
|
||||
path: req.originalUrl,
|
||||
});
|
||||
|
||||
// ── IAM-имперсонация (уже есть в сессии) — просто добавляем компании ──
|
||||
if (u.isImpersonated && u.originalUserEmail === ORIGINAL_EMAIL) {
|
||||
addExtraCompanies(u);
|
||||
console.log('[v2:impersonation] addExtraCompanies', {
|
||||
sessionID: req.sessionID,
|
||||
activeClientId: u.activeClientId,
|
||||
allClientIds: u.allClientIds,
|
||||
});
|
||||
return next();
|
||||
}
|
||||
|
||||
@@ -56,6 +71,14 @@ function enhanceImpersonation(req, res, next) {
|
||||
is_active_profile: cid === MAIN_COMPANY,
|
||||
}));
|
||||
|
||||
console.log('[v2:impersonation] applied test impersonation', {
|
||||
sessionID: req.sessionID,
|
||||
activeClientId: u.activeClientId,
|
||||
clientId: u.clientId,
|
||||
originalUserEmail: u.originalUserEmail,
|
||||
allClientIds: u.allClientIds,
|
||||
});
|
||||
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user