Skip to content

Commit

Permalink
Merge branch 'bugfix/CLDSRV-552' into tmp/octopus/w/8.8/bugfix/CLDSRV…
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Jan 7, 2025
2 parents 45c0c6f + 830ba20 commit 02666d6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/api/objectPutLegalHold.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ function objectPutLegalHold(authInfo, request, log, callback) {
objectMD.replicationInfo = Object.assign({},
objectMD.replicationInfo, replicationInfo);
}
// eslint-disable-next-line no-param-reassign
objectMD.originOp = 's3:ObjectLegalHold:Put';
metadata.putObjectMD(bucket.getName(), objectKey, objectMD, params,
log, err => next(err, bucket, objectMD));
},
Expand Down
1 change: 1 addition & 0 deletions lib/api/objectPutRetention.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function objectPutRetention(authInfo, request, log, callback) {
objectMD.replicationInfo = Object.assign({},
objectMD.replicationInfo, replicationInfo);
}
objectMD.originOp = 's3:ObjectRetention:Put';
/* eslint-enable no-param-reassign */
metadata.putObjectMD(bucket.getName(), objectKey, objectMD, params,
log, err => next(err, bucket, objectMD));
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/api/objectPutLegalHold.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,17 @@ describe('putObjectLegalHold API', () => {
});
});
});

it('should set originOp in object\'s metadata to s3:ObjectLegalHold:Put', done => {
objectPutLegalHold(authInfo, putLegalHoldReq('ON'), log, err => {
assert.ifError(err);
return metadata.getObjectMD(bucketName, objectName, {}, log,
(err, objMD) => {
assert.ifError(err);
assert.strictEqual(objMD.originOp, 's3:ObjectLegalHold:Put');
return done();
});
});
});
});
});
12 changes: 12 additions & 0 deletions tests/unit/api/objectPutRetention.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ describe('putObjectRetention API', () => {
});
});

it('should set originOp in object\'s metadata to s3:ObjectRetention:Put', done => {
objectPutRetention(authInfo, putObjRetRequestGovernance, log, err => {
assert.ifError(err);
return metadata.getObjectMD(bucketName, objectName, {}, log,
(err, objMD) => {
assert.ifError(err);
assert.strictEqual(objMD.originOp, 's3:ObjectRetention:Put');
return done();
});
});
});

it('should disallow COMPLIANCE => GOVERNANCE', done => {
objectPutRetention(authInfo, putObjRetRequestCompliance, log, err => {
assert.ifError(err);
Expand Down

0 comments on commit 02666d6

Please sign in to comment.