(authInfo, bucketName, objectKey, uploadId, log,
callback, request)
| 11 | const { config } = require('../../../Config'); |
| 12 | |
| 13 | function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log, |
| 14 | callback, request) { |
| 15 | const metadataValMPUparams = { |
| 16 | authInfo, |
| 17 | bucketName, |
| 18 | objectKey, |
| 19 | uploadId, |
| 20 | preciseRequestType: request.apiMethods || 'multipartDelete', |
| 21 | request, |
| 22 | }; |
| 23 | |
| 24 | log.debug('processing request', { method: 'abortMultipartUpload' }); |
| 25 | // For validating the request at the destinationBucket level |
| 26 | // params are the same as validating at the MPU level |
| 27 | // but the requestType is the more general 'objectDelete' |
| 28 | const metadataValParams = Object.assign({}, metadataValMPUparams); |
| 29 | metadataValParams.requestType = 'objectPut'; |
| 30 | const authzIdentityResult = request ? request.actionImplicitDenies : false; |
| 31 | |
| 32 | async.waterfall([ |
| 33 | function checkDestBucketVal(next) { |
| 34 | metadataUtils.standardMetadataValidateBucketAndObj(metadataValParams, authzIdentityResult, log, |
| 35 | (err, destinationBucket, objectMD) => { |
| 36 | if (err) { |
| 37 | log.error('error validating request', { error: err }); |
| 38 | return next(err, destinationBucket); |
| 39 | } |
| 40 | if (destinationBucket.policies) { |
| 41 | // TODO: Check bucket policies to see if user is granted |
| 42 | // permission or forbidden permission to take |
| 43 | // given action. |
| 44 | // If permitted, add 'bucketPolicyGoAhead' |
| 45 | // attribute to params for validating at MPU level. |
| 46 | // This is GH Issue#76 |
| 47 | metadataValMPUparams.requestType = |
| 48 | 'bucketPolicyGoAhead'; |
| 49 | } |
| 50 | return next(null, destinationBucket, objectMD); |
| 51 | }); |
| 52 | }, |
| 53 | function checkMPUval(destBucket, objectMD, next) { |
| 54 | metadataValParams.log = log; |
| 55 | services.metadataValidateMultipart(metadataValParams, |
| 56 | (err, mpuBucket, mpuOverviewObj) => { |
| 57 | if (err) { |
| 58 | log.error('error validating multipart', { error: err }); |
| 59 | return next(err, destBucket); |
| 60 | } |
| 61 | return next(err, mpuBucket, mpuOverviewObj, destBucket, objectMD); |
| 62 | }); |
| 63 | }, |
| 64 | function abortExternalMpu(mpuBucket, mpuOverviewObj, destBucket, objectMD, |
| 65 | next) { |
| 66 | const location = mpuOverviewObj.controllingLocationConstraint; |
| 67 | const originalIdentityAuthzResults = request.actionImplicitDenies; |
| 68 | // eslint-disable-next-line no-param-reassign |
| 69 | delete request.actionImplicitDenies; |
| 70 | return data.abortMPU(objectKey, uploadId, location, bucketName, |
no test coverage detected