Sets the access control list (ACL) settings for the specified Amazon S3 bucket.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket to use. |
|
|
Optional |
The ACL settings for the specified bucket. [Allowed values: |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Set a canned ACL setting on a bucket.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket-us-east-acl' . strtolower($s3->key); $response = $s3->set_bucket_acl($bucket, AmazonS3::ACL_PRIVATE); // Success? var_dump($response->isOK());Result:
bool(true)
Set a custom ACL setting on a bucket.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket-us-east-acl' . strtolower($s3->key); $response = $s3->set_bucket_acl($bucket, array( array( 'id' => AmazonS3::USERS_AUTH, 'permission' => AmazonS3::GRANT_READ ), // Authenticated users, READ array( 'id' => CFCredentials::get()->canonical_id, 'permission' => AmazonS3::GRANT_FULL_CONTROL ) // Self, FULL_CONTROL )); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
See Also
Source
Method defined in services/s3.class.php | Toggle source view (34 lines) | View on GitHub