From e37782e5b79db41292701a759cd3bb4b1f8740bf Mon Sep 17 00:00:00 2001 From: McMatts Date: Fri, 24 May 2019 12:29:46 +0100 Subject: [PATCH] Fix edge case for attachments download auth checks Edit permissions no longer interfere with download checks. --- .../components/document/sidebar-attachment.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gui/app/components/document/sidebar-attachment.js b/gui/app/components/document/sidebar-attachment.js index f6ee22cf..81646851 100644 --- a/gui/app/components/document/sidebar-attachment.js +++ b/gui/app/components/document/sidebar-attachment.js @@ -37,6 +37,15 @@ export default Component.extend(Modals, Notifier, { didInsertElement() { this._super(...arguments); + // For authenticated users we send server auth token. + let qry = ''; + if (this.get('session.hasSecureToken')) { + qry = '?secure=' + this.get('session.secureToken'); + } else if (this.get('session.authenticated')) { + qry = '?token=' + this.get('session.authToken'); + } + this.set('downloadQuery', qry); + if (!this.get('permissions.documentEdit') || this.get('document.protection') === this.get('constants').ProtectionType.Lock) { return; } @@ -86,15 +95,6 @@ export default Component.extend(Modals, Notifier, { dzone.removeFile(file); }); } - - // For authenticated users we send server auth token. - let qry = ''; - if (this.get('session.hasSecureToken')) { - qry = '?secure=' + this.get('session.secureToken'); - } else if (this.get('session.authenticated')) { - qry = '?token=' + this.get('session.authToken'); - } - this.set('downloadQuery', qry); }, getAttachments() {