最近更新时间:2021-12-24
使用PutBucketACL接口设置Bucket的访问控制列表。
PUT /?acl HTTP/1.1 Host: examplebucket.region.unicloudsrv.com Date: date Authorization: authorization string
<AccessControlPolicy> <Owner> <ID>ID</ID> <DisplayName>EmailAddress</DisplayName> </Owner> <AccessControlList> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> <ID>ID</ID> <DisplayName>EmailAddress</DisplayName> </Grantee> <Permission>Permission</Permission> </Grant> ... </AccessControlList> </AccessControlPolicy> |
参数 | 描述 |
x-amz-acl | 用于对象的预定义权限 有效值:private,public-read,public-read-write。 |
x-amz-grant-read | 受让人可以查询Bucket中object。 |
x-amz-grant-write | 受让人可以创建、覆盖、删除Bucket中object。 |
x-amz-grant-read-acp | 允许为适当的Bucket读ACL。 |
x-amz-grant-full-control | 受让人可以读、写、读ACL、写ACLBucket中权限。 |
参数 | 描述 |
AccessControlList | 包含许可、受让、批准的容器。 |
AccessControlPolicy | 包含为每个受让人设置object权限的元素。 |
DisplayName | 桶所有者的展现名称。 |
Grant | 包含受让人和他或她的权限。 |
Grantee | 设置权限的主体。 |
ID | Bucket所有者ID或者让人ID。 |
Owner | 包含Bucket所有者显示名称和ID。 |
Permission | 包含受让人的权限。 |
为Bucket名称是examplebucket授予访问权限
PUT ?acl HTTP/1.1 Host: acs.oss-cn-north-1.unicloudsrv.com Content-Length: 1660 x-amz-date: Thu, 12 Apr 2012 20:04:21 GMT Authorization: authorization string
<AccessControlPolicy xmlns="http://region.unicloudsrv.com/doc/2006-03-01/"> <Owner> <ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID> <DisplayName>OwnerDisplayName</DisplayName> </Owner> <AccessControlList> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> <ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID> <DisplayName>OwnerDisplayName</DisplayName> </Grantee> <Permission>FULL_CONTROL</Permission> </Grant> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group"> <URI xmlns="">http://acs.unicloud.com/groups/global/AllUsers</URI> </Grantee> <Permission xmlns="">READ</Permission> </Grant> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group"> <URI xmlns="">http://acs.unicloud.com/groups/s3/LogDelivery</URI> </Grantee> <Permission xmlns="">WRITE</Permission> </Grant> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AmazonCustomerByEmail"> <EmailAddress xmlns="">xyz@unicloud.com</EmailAddress> </Grantee> <Permission xmlns="">WRITE_ACP</Permission> </Grant> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> <ID xmlns="">f30716ab7115dcb44a5ef76e9d74b8e20567f63TestAccountCanonicalUserID</ID> </Grantee> <Permission xmlns="">READ_ACP</Permission> </Grant> </AccessControlList> </AccessControlPolicy> |
HTTP/1.1 200 OK x-amz-id-2: NxqO3PNiMHXXGwjgv15LLgUoAmPVmG0xtZw2sxePXLhpIvcyouXDrcQUaWWXcOK0 x-amz-request-id: C651BC9B4E1BD401 Date: Thu, 12 Apr 2012 20:04:28 GMT Content-Length: 0 Server: nginx |
使用ACL具体请求头授予下列权限:
PUT ?acl HTTP/1.1 Host: acs.oss-cn-north-1.unicloudsrv.com x-amz-date: Sun, 29 Apr 2012 22:00:57 GMT x-amz-grant-write: uri="http://acs.unicloud.com/groups/s3/LogDelivery", emailAddress="xyz@unicloud.com" x-amz-grant-read: uri="http://acs.unicloud.com/groups/global/AllUsers" Accept: */* Authorization: authorization string |
HTTP/1.1 200 OK x-amz-id-2: 0w9iImt23VF9s6QofOTDzelF7mrryz7d04Mw23FQCi4O205Zw28Zn+d340/RytoQ x-amz-request-id: A6A8F01A38EC7138 Date: Sun, 29 Apr 2012 22:01:10 GMT Content-Length: 0 Server: los |