From 463efc225492b699dcc334a7983fddcf2cf283e9 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 24 Feb 2018 14:36:13 -0500 Subject: [PATCH] use new admin apis for attachments --- .../organizationVaultAttachmentsController.js | 4 ++-- src/app/services/apiService.js | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/organization/organizationVaultAttachmentsController.js b/src/app/organization/organizationVaultAttachmentsController.js index 05635c60b2..c87f2ca9f9 100644 --- a/src/app/organization/organizationVaultAttachmentsController.js +++ b/src/app/organization/organizationVaultAttachmentsController.js @@ -29,7 +29,7 @@ var fd = new FormData(); var blob = new Blob([encValue.data], { type: 'application/octet-stream' }); fd.append('data', blob, encValue.fileName); - return apiService.ciphers.postAttachment({ id: cipherId }, fd).$promise; + return apiService.ciphers.postAttachmentAdmin({ id: cipherId }, fd).$promise; }).then(function (response) { $analytics.eventTrack('Added Attachment'); toastr.success('The attachment has been added.'); @@ -61,7 +61,7 @@ } attachment.loading = true; - apiService.ciphers.delAttachment({ id: cipherId, attachmentId: attachment.id }).$promise.then(function () { + apiService.ciphers.delAttachmentAdmin({ id: cipherId, attachmentId: attachment.id }).$promise.then(function () { attachment.loading = false; $analytics.eventTrack('Deleted Organization Attachment'); var index = $scope.cipher.attachments.indexOf(attachment); diff --git a/src/app/services/apiService.js b/src/app/services/apiService.js index 330e0209a2..84a1c9473e 100644 --- a/src/app/services/apiService.js +++ b/src/app/services/apiService.js @@ -42,13 +42,20 @@ headers: { 'Content-Type': undefined }, params: { id: '@id' } }, + postAttachmentAdmin: { + url: _apiUri + '/ciphers/:id/attachment-admin', + method: 'POST', + headers: { 'Content-Type': undefined }, + params: { id: '@id' } + }, postShareAttachment: { url: _apiUri + '/ciphers/:id/attachment/:attachmentId/share?organizationId=:orgId', method: 'POST', headers: { 'Content-Type': undefined }, params: { id: '@id', attachmentId: '@attachmentId', orgId: '@orgId' } }, - delAttachment: { url: _apiUri + '/ciphers/:id/attachment/:attachmentId/delete', method: 'POST', params: { id: '@id', attachmentId: '@attachmentId' } } + delAttachment: { url: _apiUri + '/ciphers/:id/attachment/:attachmentId/delete', method: 'POST', params: { id: '@id', attachmentId: '@attachmentId' } }, + delAttachmentAdmin: { url: _apiUri + '/ciphers/:id/attachment/:attachmentId/delete-admin', method: 'POST', params: { id: '@id', attachmentId: '@attachmentId' } } }); _service.organizations = $resource(_apiUri + '/organizations/:id', {}, {