get_object_acl ( $bucket, $filename, $opt )

Gets the access control list (ACL) settings for the specified Amazon S3 object.

Access

public

Parameters

Parameter

Type

Required

Description

$bucket

string

Required

The name of the bucket to use.

$filename

string

Required

The file name for the object.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • versionId - string - Optional - The version of the object to retrieve. Version IDs are returned in the x-amz-version-id header of any previous object-related request.
  • preauth - integer|string - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with strtotime().
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Get the ACL settings for an object.

// Instantiate the class
$s3 = new AmazonS3();
$bucket = 'my-bucket' . strtolower($s3->key);

$response = $s3->get_object_acl($bucket, 'test1.txt');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Get the ACL settings for a specific version of an object.

// Instantiate the class
$s3 = new AmazonS3();
$bucket = 'my-bucket' . strtolower($s3->key);

// Get a specific version
$response = $s3->get_object_acl($bucket, 'test1.txt', array(
	'versionId' => '0NNAq8PwvXvg8EfAYG9sSmwKTZeixZgZNE6PbodG8td0DJ3gVOmjI2Gh/oFnb0Ie='
));

// Success?
var_dump($response->isOK());
var_dump(strpos((string) $response->header['_info']['url'], 'versionId=' . '0NNAq8PwvXvg8EfAYG9sSmwKTZeixZgZNE6PbodG8td0DJ3gVOmjI2Gh/oFnb0Ie=') !== false);
Result:
bool(true)
bool(true)

See Also

Source

Method defined in services/s3.class.php | Toggle source view (11 lines) | View on GitHub

public function get_object_acl($bucket, $filename, $opt = null)
{
    // Add this to our request
    if (!$opt) $opt = array();
    $opt['verb'] = 'GET';
    $opt['resource'] = $filename;
    $opt['sub_resource'] = 'acl';

    // Authenticate to S3
    return $this->authenticate($bucket, $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback