Skip to content

Commit af3d533

Browse files
dead-horsefengmk2
authored andcommitted
feat: cluster mode support acl (#439)
1 parent fdbd822 commit af3d533

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/cluster.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module.exports = function (OssClient) {
5252
'get',
5353
'getStream',
5454
'list',
55+
'getACL',
5556
];
5657

5758
const PUT_METHODS = [
@@ -61,6 +62,7 @@ module.exports = function (OssClient) {
6162
'deleteMulti',
6263
'copy',
6364
'putMeta',
65+
'putACL',
6466
];
6567

6668
GET_METHODS.forEach((method) => {

test/node/cluster.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,24 @@ describe('test/cluster.test.js', () => {
107107
});
108108
});
109109

110+
describe('putACL() and getACL()', () => {
111+
it('should add object with local file path', function* () {
112+
const name = `${prefix}ali-sdk/oss/put-localfile.js`;
113+
const object = yield this.store.put(name, __filename);
114+
assert.equal(typeof object.res.headers['x-oss-request-id'], 'string');
115+
assert.equal(typeof object.res.rt, 'number');
116+
assert.equal(object.res.size, 0);
117+
assert(object.name, name);
118+
119+
let res = yield this.store.getACL(name);
120+
assert.equal(res.acl, 'default');
121+
122+
yield this.store.putACL(name, 'public-read');
123+
res = yield this.store.getACL(name);
124+
assert.equal(res.acl, 'public-read');
125+
});
126+
});
127+
110128
describe('get()', () => {
111129
before(function* () {
112130
this.name = `${prefix}ali-sdk/oss/get-meta.js`;

0 commit comments

Comments
 (0)