mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[wopi] Send warning on forced view mode; For bug 76155
This commit is contained in:
@ -248,6 +248,7 @@ exports.VKEY_TIME_EXPIRE = -124;
|
||||
exports.VKEY_TIME_INCORRECT = -125;
|
||||
exports.EDITOR_CHANGES = -160;
|
||||
exports.PASSWORD = -180;
|
||||
exports.FORCED_VIEW_MODE = -200;
|
||||
|
||||
//Quorum queues internally only support two priorities: high and normal.
|
||||
//Messages without a priority set will be mapped to normal as will priorities 0 - 4.
|
||||
|
||||
@ -556,8 +556,8 @@ function sendData(ctx, conn, data) {
|
||||
const type = data ? data.type : null;
|
||||
ctx.logger.debug('sendData: type = %s', type);
|
||||
}
|
||||
function sendDataWarning(ctx, conn, msg) {
|
||||
sendData(ctx, conn, {type: "warning", message: msg});
|
||||
function sendDataWarning(ctx, conn, code, description) {
|
||||
sendData(ctx, conn, {type: "warning", code: code, message: description});
|
||||
}
|
||||
function sendDataMessage(ctx, conn, msg) {
|
||||
if (!conn.permissions || false !== conn.permissions.chat) {
|
||||
@ -2351,6 +2351,7 @@ exports.install = function(server, callbackFunction) {
|
||||
if (decoded.userAuth) {
|
||||
data.documentCallbackUrl = JSON.stringify(decoded.userAuth);
|
||||
data.mode = decoded.userAuth.mode;
|
||||
data.forcedViewMode = decoded.userAuth.forcedViewMode;
|
||||
}
|
||||
if (decoded.queryParams) {
|
||||
let queryParams = decoded.queryParams;
|
||||
@ -2822,6 +2823,8 @@ exports.install = function(server, callbackFunction) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (data.forcedViewMode) {
|
||||
sendDataWarning(ctx, conn, constants.FORCED_VIEW_MODE, "Forced view mode");
|
||||
}
|
||||
//Set the unique ID
|
||||
if (bIsRestore) {
|
||||
|
||||
@ -578,7 +578,7 @@ async function prepareDocumentForEditing(ctx, wopiSrc, fileInfo, userAuth, fileT
|
||||
if (!preOpenRes && userAuth.mode !== 'view') {
|
||||
ctx.logger.error('prepareDocumentForEditing error: lock failed, fallback to view mode');
|
||||
userAuth.mode = 'view';
|
||||
params.forcedViewMode = true;
|
||||
userAuth.forcedViewMode = true;
|
||||
return await prepareDocumentForEditing(ctx, wopiSrc, fileInfo, userAuth, fileType, baseUrl, params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user