mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[feature] Read user.customerId from open config
This commit is contained in:
@ -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)
|
||||
};
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user