* Bucket Put ACL - Create bucket ACL * @param {AuthInfo} authInfo - Instance of AuthInfo class with requester's info * @param {object} request - http request object * @param {object} log - Werelogs logger * @param {function} callback - callback to server * @return {undefined}
(authInfo, request, log, callback)
| 42 | * @return {undefined} |
| 43 | */ |
| 44 | function bucketPutACL(authInfo, request, log, callback) { |
| 45 | log.debug('processing request', { method: 'bucketPutACL' }); |
| 46 | |
| 47 | const { bucketName } = request; |
| 48 | const canonicalID = authInfo.getCanonicalID(); |
| 49 | const newCannedACL = request.headers['x-amz-acl']; |
| 50 | const possibleCannedACL = [ |
| 51 | 'private', |
| 52 | 'public-read', |
| 53 | 'public-read-write', |
| 54 | 'authenticated-read', |
| 55 | 'log-delivery-write', |
| 56 | ]; |
| 57 | const possibleGroups = [constants.allAuthedUsersId, |
| 58 | constants.publicId, |
| 59 | constants.logId, |
| 60 | ]; |
| 61 | const metadataValParams = { |
| 62 | authInfo, |
| 63 | bucketName, |
| 64 | requestType: request.apiMethods || 'bucketPutACL', |
| 65 | request, |
| 66 | }; |
| 67 | const possibleGrants = ['FULL_CONTROL', 'WRITE', |
| 68 | 'WRITE_ACP', 'READ', 'READ_ACP']; |
| 69 | const addACLParams = { |
| 70 | Canned: '', |
| 71 | FULL_CONTROL: [], |
| 72 | WRITE: [], |
| 73 | WRITE_ACP: [], |
| 74 | READ: [], |
| 75 | READ_ACP: [], |
| 76 | }; |
| 77 | |
| 78 | const grantReadHeader = |
| 79 | aclUtils.parseGrant(request.headers[ |
| 80 | 'x-amz-grant-read'], 'READ'); |
| 81 | const grantWriteHeader = |
| 82 | aclUtils.parseGrant(request.headers['x-amz-grant-write'], 'WRITE'); |
| 83 | const grantReadACPHeader = |
| 84 | aclUtils.parseGrant(request.headers['x-amz-grant-read-acp'], |
| 85 | 'READ_ACP'); |
| 86 | const grantWriteACPHeader = |
| 87 | aclUtils.parseGrant(request.headers['x-amz-grant-write-acp'], |
| 88 | 'WRITE_ACP'); |
| 89 | const grantFullControlHeader = |
| 90 | aclUtils.parseGrant(request.headers['x-amz-grant-full-control'], |
| 91 | 'FULL_CONTROL'); |
| 92 | |
| 93 | return async.waterfall([ |
| 94 | function waterfall1(next) { |
| 95 | standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, |
| 96 | (err, bucket) => { |
| 97 | if (err) { |
| 98 | log.trace('request authorization failed', { |
| 99 | error: err, |
| 100 | method: 'metadataValidateBucket', |
| 101 | }); |
no test coverage detected