You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
736 B
31 lines
736 B
4 weeks ago
|
const proto = exports;
|
||
|
|
||
|
/*
|
||
|
* Get object's ACL
|
||
|
* @param {String} name the object key
|
||
|
* @param {Object} options
|
||
|
* @return {Object}
|
||
|
*/
|
||
|
proto.getACL = async function getACL(name, options = {}) {
|
||
|
options.subres = Object.assign({ acl: '' }, options.subres);
|
||
|
if (options.versionId) {
|
||
|
options.subres.versionId = options.versionId;
|
||
|
}
|
||
|
name = this._objectName(name);
|
||
|
|
||
|
const params = this._objectRequestParams('GET', name, options);
|
||
|
params.successStatuses = [200];
|
||
|
params.xmlResponse = true;
|
||
|
|
||
|
const result = await this.request(params);
|
||
|
|
||
|
return {
|
||
|
acl: result.data.AccessControlList.Grant,
|
||
|
owner: {
|
||
|
id: result.data.Owner.ID,
|
||
|
displayName: result.data.Owner.DisplayName
|
||
|
},
|
||
|
res: result.res
|
||
|
};
|
||
|
};
|