diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js index 600e4619..ce653d18 100644 --- a/DocService/sources/DocsCoServer.js +++ b/DocService/sources/DocsCoServer.js @@ -536,6 +536,7 @@ function fillJwtByConnection(ctx, conn) { user.id = conn.user.idOriginal; user.name = conn.user.username; user.index = conn.user.indexUser; + user.customerId = conn.user.customerId; if (conn.coEditingMode) { edit.coEditing = {mode: conn.coEditingMode}; } @@ -2504,6 +2505,9 @@ exports.install = function(server, callbackFunction) { //like in Common.Utils.fillUserInfo(web-apps/apps/common/main/lib/util/utils.js) dataUser.username = user.group.toString() + String.fromCharCode(160) + dataUser.username; } + if (user.customerId) { + dataUser.customerId = user.customerId; + } } if (edit.user && edit.user.name) { data.denyChangeName = true; @@ -2691,6 +2695,7 @@ exports.install = function(server, callbackFunction) { id: curUserId, idOriginal: curUserIdOriginal, username: fillUsername(ctx, data), + customerId: user.customerId, indexUser: curIndexUser, view: !isEditMode(data.permissions, data.mode) }; diff --git a/DocService/sources/ai/aiProxyHandler.js b/DocService/sources/ai/aiProxyHandler.js index 75127ff9..f6da8c84 100644 --- a/DocService/sources/ai/aiProxyHandler.js +++ b/DocService/sources/ai/aiProxyHandler.js @@ -174,6 +174,8 @@ async function proxyRequest(req, res) { let docId = ''; let userId = ''; + let userName = ''; + let userCustomerId = ''; if (tenTokenEnableBrowser) { let checkJwtRes = await docsCoServer.checkJwtHeader(ctx, req, 'Authorization', 'Bearer ', commonDefines.c_oAscSecretType.Session); if (!checkJwtRes || checkJwtRes.err) { @@ -186,8 +188,11 @@ async function proxyRequest(req, res) { }); return; } else { - userId = checkJwtRes?.decoded?.editorConfig?.user?.id; docId = checkJwtRes?.decoded?.document?.key; + userId = checkJwtRes?.decoded?.editorConfig?.user?.id; + userName = checkJwtRes?.decoded?.editorConfig?.user?.name; + userCustomerId = checkJwtRes?.decoded?.editorConfig?.user?.customerId; + ctx.setDocId(docId); ctx.setUserId(userId); } @@ -249,10 +254,13 @@ async function proxyRequest(req, res) { const tenTokenOutboxPrefix = ctx.getCfg('services.CoAuthoring.token.outbox.prefix', cfgTokenOutboxPrefix); let [licenseInfo] = await tenantManager.getTenantLicense(ctx); - let dataObject = { + const dataObject = { key: docId, - user: userId, - customer_id: licenseInfo.customerId + user: { + id: userId, + name: userName, + customerId: (userCustomerId || licenseInfo.customerId), + } } let secret = await tenantManager.getTenantSecret(ctx, commonDefines.c_oAscSecretType.Outbox);