From ca5413af89a292a5a2e5ab1870f59e22691b586c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 11 Sep 2020 11:26:19 +0300 Subject: [PATCH] Depricate changeHistory and rename parameters of permissions. Use events instead. --- apps/api/documents/api.js | 2 -- apps/documenteditor/main/app/controller/Main.js | 9 ++------- apps/presentationeditor/main/app/controller/Main.js | 5 +---- apps/spreadsheeteditor/main/app/controller/Main.js | 4 +--- apps/spreadsheeteditor/mobile/app/controller/Main.js | 1 - 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 4c151a8f2..73ea7dc58 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -43,8 +43,6 @@ reader: , review: , // default = edit print: , // default = true - rename: , // default = false - changeHistory: , // default = false // must be deprecated, check onRequestRestore event instead comment: // default = edit, modifyFilter: // default = true modifyContentControl: // default = true diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 6c6757020..6d3284d4d 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1217,7 +1217,7 @@ define([ this.appOptions.canViewReview = true; this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline; this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose; - this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && (this.permissions.changeHistory !== false); + this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore; this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && !this.appOptions.isOffline; this.appOptions.canSendEmailAddresses = this.appOptions.canLicense && this.editorConfig.canSendEmailAddresses && this.appOptions.canEdit && this.appOptions.canCoAuthoring; this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? this.appOptions.isEdit : this.permissions.comment) && (this.editorConfig.mode !== 'view'); @@ -1226,7 +1226,7 @@ define([ this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; this.appOptions.canPrint = (this.permissions.print !== false); - this.appOptions.canRename = this.editorConfig.canRename && (this.permissions.rename!==false); + this.appOptions.canRename = this.editorConfig.canRename; this.appOptions.buildVersion = params.asc_getBuildVersion(); this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; @@ -1288,11 +1288,6 @@ define([ this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); this.api.asc_LoadDocument(); - - if (this.permissions.changeHistory !== undefined) - console.warn("Obsolete: The changeHistory parameter of the document permission section is deprecated. Please use onRequestRestore event instead."); - if (this.permissions.rename !== undefined) - console.warn("Obsolete: The rename parameter of the document permission section is deprecated. Please use onRequestRename event instead."); }, applyModeCommonElements: function() { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 0092197a2..d5ebf008a 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -950,7 +950,7 @@ define([ this.appOptions.canViewComments = this.appOptions.canComments || !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); this.appOptions.canPrint = (this.permissions.print !== false); - this.appOptions.canRename = this.editorConfig.canRename && (this.permissions.rename!==false); + this.appOptions.canRename = this.editorConfig.canRename; this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); @@ -986,9 +986,6 @@ define([ this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit); (this.appOptions.isRestrictedEdit && this.appOptions.canComments) && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); this.api.asc_LoadDocument(); - - if (this.permissions.rename !== undefined) - console.warn("Obsolete: The rename parameter of the document permission section is deprecated. Please use onRequestRename event instead."); }, applyModeCommonElements: function() { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index bbce25813..33fc50241 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1013,7 +1013,7 @@ define([ this.appOptions.canComments = this.appOptions.canComments && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canViewComments = this.appOptions.canComments || !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); - this.appOptions.canRename = this.editorConfig.canRename && (this.permissions.rename!==false); + this.appOptions.canRename = this.editorConfig.canRename; this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.canModifyFilter = (this.permissions.modifyFilter!==false); this.appOptions.canBranding = params.asc_getCustomization(); @@ -1024,8 +1024,6 @@ define([ this.appOptions.canUseReviewPermissions = this.appOptions.canLicense && this.editorConfig.customization && this.editorConfig.customization.reviewPermissions && (typeof (this.editorConfig.customization.reviewPermissions) == 'object'); Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions); this.headerView.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname)); - if (this.permissions.rename !== undefined) - console.warn("Obsolete: The rename parameter of the document permission section is deprecated. Please use onRequestRename event instead."); } else this.appOptions.canModifyFilter = true; diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index d9a9ddfa0..358a909dd 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -739,7 +739,6 @@ define([ me.appOptions.canViewComments = me.appOptions.canComments || !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.comments===false); me.appOptions.canEditComments = me.appOptions.isOffline || !(typeof (me.editorConfig.customization) == 'object' && me.editorConfig.customization.commentAuthorOnly); me.appOptions.canChat = me.appOptions.canLicense && !me.appOptions.isOffline && !((typeof (me.editorConfig.customization) == 'object') && me.editorConfig.customization.chat===false); - me.appOptions.canRename = !!me.permissions.rename; me.appOptions.canBranding = params.asc_getCustomization(); me.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof me.editorConfig.customization == 'object');