Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/w/7.8/feature/S3C-3112_ObjectLoc…
Browse files Browse the repository at this point in the history
…kEnabledSetterForBucket' into w/8.1/feature/S3C-3112_ObjectLockEnabledSetterForBucket
  • Loading branch information
ilkescality committed Jun 29, 2020
2 parents dc4e182 + 1e47b00 commit 6383d14
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/models/BucketInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,21 @@ class BucketInfo {
return this;
}
/**
* Check is object lock enabled.
* Check if object lock is enabled.
* @return {boolean} - depending on whether object lock is enabled
*/
isObjectLockEnabled() {
return !!this._objectLockEnabled;
}
/**
* Set the value of objectLockEnabled field.
* @param {boolean} enabled - true if object lock enabled else false.
* @return {BucketInfo} - bucket info instance
*/
setObjectLockEnabled(enabled) {
this._objectLockEnabled = enabled;
return this;
}
}

module.exports = BucketInfo;
7 changes: 7 additions & 0 deletions tests/unit/models/BucketInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,13 @@ Object.keys(acl).forEach(
assert.deepStrictEqual(dummyBucket.getObjectLockConfiguration(),
newObjectLockConfig);
});
[true, false].forEach(bool => {
it('setObjectLockEnabled should set object lock status', () => {
dummyBucket.setObjectLockEnabled(bool);
assert.deepStrictEqual(dummyBucket.isObjectLockEnabled(),
bool);
});
});
});
})
);
Expand Down

0 comments on commit 6383d14

Please sign in to comment.