更新时间:2025-12-04 GMT+08:00
分享

获取对象ACL

功能说明

获取指定桶中对象的访问权限。

方法定义

ObsClient.getObjectAcl

请求参数

字段名

类型

约束

说明

Bucket

String

必选

桶名。

Key

String

必选

对象名。

RequestDate

String

Date

可选

指定请求时间。

说明:

当为String类型时,必须符合ISO8601或RFC822规范。

VersionId

String

可选

对象的版本号。

返回结果(InterfaceResult)

字段名

类型

说明

RequestId

String

OBS服务端返回的请求ID。

VersionId

String

对象的版本号。

Owner

Object

对象的所有者。

-

ID

String

对象所有者的DomainId。

Name

String

对象所有者的名字。

Delivered

String

桶的ACL是否向桶内对象传递。

Grants

Array

被授权用户权限信息列表。

-

Grantee

Object

被授权用户。

-

Name

String

被授权用户的名字,当用户类型是Group时为空。

ID

String

被授权用户的DomainId,当用户类型是Group时为空。

URI

String

被授权的用户组,当用户类型是CanonicalUser时为空。

Permission

String

被授予的权限。

代码样例

obsClient.getObjectAcl({
       Bucket:'bucketname',
       Key : 'objectkey'
},function (err, result) {
       if(err){
              console.error('Error-->' + err);
       }else{
              if(result.CommonMsg.Status < 300){
                     console.log('RequestId-->' + result.InterfaceResult.RequestId);
                     console.log('Owner[ID]-->' + result.InterfaceResult.Owner.ID);
                     for(var i=0;i<result.InterfaceResult.Grants.length;i++){
                           console.log('Grant[' + i + ']:');
                           console.log('Grantee[ID]-->' + result.InterfaceResult.Grants[i]['Grantee']['ID']);
                           console.log('Grantee[URI]-->' + result.InterfaceResult.Grants[i]['Grantee']['URI']);
                           console.log('Permission-->' + result.InterfaceResult.Grants[i]['Permission']);
                     }
              }else{
                     console.log('Code-->' + result.CommonMsg.Code);
                     console.log('Message-->' + result.CommonMsg.Message);
              }
       }
});

相关文档