use new admin apis for attachments

This commit is contained in:
Kyle Spearrin 2018-02-24 14:36:13 -05:00
parent 0333354271
commit 463efc2254
2 changed files with 10 additions and 3 deletions

View File

@ -29,7 +29,7 @@
var fd = new FormData(); var fd = new FormData();
var blob = new Blob([encValue.data], { type: 'application/octet-stream' }); var blob = new Blob([encValue.data], { type: 'application/octet-stream' });
fd.append('data', blob, encValue.fileName); 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) { }).then(function (response) {
$analytics.eventTrack('Added Attachment'); $analytics.eventTrack('Added Attachment');
toastr.success('The attachment has been added.'); toastr.success('The attachment has been added.');
@ -61,7 +61,7 @@
} }
attachment.loading = true; 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; attachment.loading = false;
$analytics.eventTrack('Deleted Organization Attachment'); $analytics.eventTrack('Deleted Organization Attachment');
var index = $scope.cipher.attachments.indexOf(attachment); var index = $scope.cipher.attachments.indexOf(attachment);

View File

@ -42,13 +42,20 @@
headers: { 'Content-Type': undefined }, headers: { 'Content-Type': undefined },
params: { id: '@id' } params: { id: '@id' }
}, },
postAttachmentAdmin: {
url: _apiUri + '/ciphers/:id/attachment-admin',
method: 'POST',
headers: { 'Content-Type': undefined },
params: { id: '@id' }
},
postShareAttachment: { postShareAttachment: {
url: _apiUri + '/ciphers/:id/attachment/:attachmentId/share?organizationId=:orgId', url: _apiUri + '/ciphers/:id/attachment/:attachmentId/share?organizationId=:orgId',
method: 'POST', method: 'POST',
headers: { 'Content-Type': undefined }, headers: { 'Content-Type': undefined },
params: { id: '@id', attachmentId: '@attachmentId', orgId: '@orgId' } 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', {}, { _service.organizations = $resource(_apiUri + '/organizations/:id', {}, {