PUT Object ACL

You can perform this operation to modify an object ACL.

OBS allows you to control access permission for objects. By default, only an object creator can access the object. However, the creator can set an access policy (such as a public access policy) to grant the READ permission for the object to other users. This setting is ineffective even across tenants, if the ACL is set for an object encrypted using SSE-KMS.

You can set an access control policy when uploading an object or send a PUT Object ACL or GET Object ACL request to modify or obtain the object ACL.

This section explains how to modify an object ACL and change access permission on an object.

Versioning

By default, this operation modifies the ACL of an object of the latest version. You can specify versionId to modify the ACL of an object of the desired version.

Request Syntax

PUT /ObjectName?acl HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Date: date
Authorization: authorization

<AccessControlPolicy>
    <Owner>
        <ID>ID</ID>
        <DisplayName>displayname</DisplayName>
    </Owner>
    <AccessControlList>
        <Grant>
            <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">grantee</Grantee>
            <Permission>permission</Permission>
        </Grant>
    </AccessControlList>
</AccessControlPolicy>

Request Parameters

Table 1 describes the request parameter.

Table 1 Request parameter

Parameter

Description

Required or Optional

versionId

Indicates the version ID of an object whose ACL is to be modified.

Type: string

Optional

Request Headers

This request uses common headers. For details, see Common Request Headers.

Request Elements

This request contains elements to specify the ACL. Table 2 describes the elements.

Table 2 Request elements

Element

Description

Required or Optional

ID

Domain ID of the user.

Type: string

Optional

DisplayName

Indicates the username.

Type: string

Optional

Permission

Indicates the permission to be granted.

Type: enumeration

Optional

Response Syntax

HTTP/1.1 status_code
Content-Length: length
Content-Type: application/xml

Response Headers

This response uses common headers. For details, see Common Response Headers.

This response also uses one additional header, as described in Table 3.

Table 3 Additional response header

Header

Description

x-amz-version-id

Indicates the version ID of the object whose ACL is modified.

Type: string

Response Elements

This response involves no elements.

Error Responses

No special error responses are returned. For details about error responses, see Table 1.

Registration