MCPcopy Index your code
hub / github.com/scality/cloudserver / addObjectACL

Function addObjectACL

lib/metadata/acl.js:38–63  ·  view source on GitHub ↗
(bucket, objectKey, objectMD, addACLParams, params, log, cb)

Source from the content-addressed store, hash-verified

36 },
37
38 addObjectACL(bucket, objectKey, objectMD, addACLParams, params, log, cb) {
39 log.trace('updating object acl in metadata');
40 const isAclUnchanged = Object.keys(objectMD.acl).length === Object.keys(addACLParams).length
41 && Object.keys(objectMD.acl).every(grant => this._aclGrantDidNotChange(grant, objectMD.acl, addACLParams));
42 if (!isAclUnchanged) {
43 /* eslint-disable no-param-reassign */
44 objectMD.acl = addACLParams;
45 objectMD.originOp = 's3:ObjectAcl:Put';
46
47 // Use storageType to determine if replication update is needed, as it is set only for
48 // "cloud" locations. This ensures that we reset replication when CRR is used, but not
49 // when multi-backend replication (i.e. Zenko) is used.
50 // TODO: this should be refactored to properly update the replication info, accounting
51 // for multiple rules and resetting the status only if needed CLDSRV-646
52 const replicationInfo = getReplicationInfo(config, objectKey, bucket, true);
53 if (replicationInfo && !replicationInfo.storageType) {
54 objectMD.replicationInfo = {
55 ...objectMD.replicationInfo,
56 ...replicationInfo,
57 };
58 }
59
60 return metadata.putObjectMD(bucket.getName(), objectKey, objectMD, params, log, cb);
61 }
62 return cb();
63 },
64
65 parseAclFromHeaders(params, cb) {
66 const headers = params.headers;

Callers

nothing calls this directly

Calls 2

getReplicationInfoFunction · 0.85
traceMethod · 0.80

Tested by

no test coverage detected