Disable downloadAs api method when permission.download = false
This commit is contained in:
parent
04bf403d3b
commit
ff9beb8a87
|
@ -452,6 +452,10 @@ var ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDownloadAs() {
|
function onDownloadAs() {
|
||||||
|
if ( permissions.download === false) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (api) api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
if (api) api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,6 +543,7 @@ var ApplicationController = new(function(){
|
||||||
criticalErrorTitle : 'Error',
|
criticalErrorTitle : 'Error',
|
||||||
notcriticalErrorTitle : 'Warning',
|
notcriticalErrorTitle : 'Warning',
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||||
errorFilePassProtect: 'The file is password protected and cannot be opened.'
|
errorFilePassProtect: 'The file is password protected and cannot be opened.',
|
||||||
|
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -403,6 +403,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function(format) {
|
onDownloadAs: function(format) {
|
||||||
|
if ( !this.appOptions.canDownload && !this.appOptions.canDownloadOrigin) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._state.isFromGatewayDownloadAs = true;
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
||||||
if (type && typeof type[1] === 'string')
|
if (type && typeof type[1] === 'string')
|
||||||
|
|
|
@ -306,6 +306,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function() {
|
onDownloadAs: function() {
|
||||||
|
if ( !this.appOptions.canDownload && !this.appOptions.canDownloadOrigin) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._state.isFromGatewayDownloadAs = true;
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
||||||
|
|
||||||
|
@ -888,6 +893,10 @@ define([
|
||||||
config.msg = this.errorDataEncrypted;
|
config.msg = this.errorDataEncrypted;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AccessDeny:
|
||||||
|
config.msg = this.errorAccessDeny;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
config.msg = this.errorDefaultMessage.replace('%1', id);
|
config.msg = this.errorDefaultMessage.replace('%1', id);
|
||||||
break;
|
break;
|
||||||
|
@ -1355,7 +1364,8 @@ define([
|
||||||
warnLicenseUsersExceeded: 'The number of concurrent users has been exceeded and the document will be opened for viewing only.<br>Please contact your administrator for more information.',
|
warnLicenseUsersExceeded: 'The number of concurrent users has been exceeded and the document will be opened for viewing only.<br>Please contact your administrator for more information.',
|
||||||
errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.',
|
errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.',
|
||||||
closeButtonText: 'Close File',
|
closeButtonText: 'Close File',
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.'
|
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||||
|
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), DE.Controllers.Main || {}))
|
})(), DE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -53,6 +53,7 @@
|
||||||
"DE.Controllers.Main.downloadMergeTitle": "Downloading",
|
"DE.Controllers.Main.downloadMergeTitle": "Downloading",
|
||||||
"DE.Controllers.Main.downloadTextText": "Downloading document...",
|
"DE.Controllers.Main.downloadTextText": "Downloading document...",
|
||||||
"DE.Controllers.Main.downloadTitleText": "Downloading Document",
|
"DE.Controllers.Main.downloadTitleText": "Downloading Document",
|
||||||
|
"DE.Controllers.Main.errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",
|
||||||
"DE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect",
|
"DE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect",
|
||||||
"DE.Controllers.Main.errorCoAuthoringDisconnect": "Server connection lost. You can't edit anymore.",
|
"DE.Controllers.Main.errorCoAuthoringDisconnect": "Server connection lost. You can't edit anymore.",
|
||||||
"DE.Controllers.Main.errorConnectToServer": "The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the 'OK' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href=\"https://api.onlyoffice.com/editors/callback\" target=\"_blank\">here</a>",
|
"DE.Controllers.Main.errorConnectToServer": "The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the 'OK' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href=\"https://api.onlyoffice.com/editors/callback\" target=\"_blank\">here</a>",
|
||||||
|
|
|
@ -552,6 +552,10 @@ var ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDownloadAs() {
|
function onDownloadAs() {
|
||||||
|
if ( permissions.download === false) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (api) api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
|
if (api) api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
|
||||||
}
|
}
|
||||||
// Helpers
|
// Helpers
|
||||||
|
@ -610,6 +614,7 @@ var ApplicationController = new(function(){
|
||||||
criticalErrorTitle : 'Error',
|
criticalErrorTitle : 'Error',
|
||||||
notcriticalErrorTitle : 'Warning',
|
notcriticalErrorTitle : 'Warning',
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||||
errorFilePassProtect: 'The file is password protected and cannot be opened.'
|
errorFilePassProtect: 'The file is password protected and cannot be opened.',
|
||||||
|
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -383,6 +383,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function(format) {
|
onDownloadAs: function(format) {
|
||||||
|
if ( !this.appOptions.canDownload ) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._state.isFromGatewayDownloadAs = true;
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
|
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
|
||||||
_supported = [
|
_supported = [
|
||||||
|
|
|
@ -303,6 +303,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function() {
|
onDownloadAs: function() {
|
||||||
|
if ( !this.appOptions.canDownload) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
|
this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -838,6 +843,10 @@ define([
|
||||||
config.msg = this.errorDataEncrypted;
|
config.msg = this.errorDataEncrypted;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Asc.c_oAscError.ID.AccessDeny:
|
||||||
|
config.msg = this.errorAccessDeny;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
config.msg = this.errorDefaultMessage.replace('%1', id);
|
config.msg = this.errorDefaultMessage.replace('%1', id);
|
||||||
break;
|
break;
|
||||||
|
@ -1347,7 +1356,8 @@ define([
|
||||||
warnLicenseUsersExceeded: 'The number of concurrent users has been exceeded and the document will be opened for viewing only.<br>Please contact your administrator for more information.',
|
warnLicenseUsersExceeded: 'The number of concurrent users has been exceeded and the document will be opened for viewing only.<br>Please contact your administrator for more information.',
|
||||||
errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.',
|
errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.',
|
||||||
closeButtonText: 'Close File',
|
closeButtonText: 'Close File',
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.'
|
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||||
|
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -68,6 +68,7 @@
|
||||||
"PE.Controllers.Main.downloadErrorText": "Download failed.",
|
"PE.Controllers.Main.downloadErrorText": "Download failed.",
|
||||||
"PE.Controllers.Main.downloadTextText": "Downloading document...",
|
"PE.Controllers.Main.downloadTextText": "Downloading document...",
|
||||||
"PE.Controllers.Main.downloadTitleText": "Downloading Document",
|
"PE.Controllers.Main.downloadTitleText": "Downloading Document",
|
||||||
|
"PE.Controllers.Main.errorAccessDeny": "You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",
|
||||||
"PE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect",
|
"PE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect",
|
||||||
"PE.Controllers.Main.errorCoAuthoringDisconnect": "Server connection lost. You can't edit anymore.",
|
"PE.Controllers.Main.errorCoAuthoringDisconnect": "Server connection lost. You can't edit anymore.",
|
||||||
"PE.Controllers.Main.errorConnectToServer": "The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the 'OK' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href=\"https://api.onlyoffice.com/editors/callback\" target=\"_blank\">here</a>",
|
"PE.Controllers.Main.errorConnectToServer": "The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the 'OK' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href=\"https://api.onlyoffice.com/editors/callback\" target=\"_blank\">here</a>",
|
||||||
|
|
|
@ -458,6 +458,10 @@ var ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDownloadAs() {
|
function onDownloadAs() {
|
||||||
|
if ( permissions.download === false) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true);
|
api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,6 +561,7 @@ var ApplicationController = new(function(){
|
||||||
criticalErrorTitle : 'Error',
|
criticalErrorTitle : 'Error',
|
||||||
notcriticalErrorTitle : 'Warning',
|
notcriticalErrorTitle : 'Warning',
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
||||||
errorFilePassProtect: 'The file is password protected and cannot be opened.'
|
errorFilePassProtect: 'The file is password protected and cannot be opened.',
|
||||||
|
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -409,6 +409,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function(format) {
|
onDownloadAs: function(format) {
|
||||||
|
if ( !this.appOptions.canDownload) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._state.isFromGatewayDownloadAs = true;
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
|
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
|
||||||
_supported = [
|
_supported = [
|
||||||
|
|
|
@ -306,6 +306,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAs: function() {
|
onDownloadAs: function() {
|
||||||
|
if ( !this.appOptions.canDownload) {
|
||||||
|
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._state.isFromGatewayDownloadAs = true;
|
||||||
this.api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true);
|
this.api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue