本文整理汇总了PHP中Aws\S3\S3Client::getObjectAcl方法的典型用法代码示例。如果您正苦于以下问题:PHP S3Client::getObjectAcl方法的具体用法?PHP S3Client::getObjectAcl怎么用?PHP S3Client::getObjectAcl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\S3\S3Client
的用法示例。
在下文中一共展示了S3Client::getObjectAcl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectAcl
/**
* getObjectAcl
*
* @param string $key
* @param string $versionId
*
* @return \Guzzle\Service\Resource\Model
*/
public function getObjectAcl($key, $versionId = '')
{
$params = ['Bucket' => $this->name, 'Key' => $key];
if ($versionId) {
$params['VersionId'] = $versionId;
}
return $this->client->getObjectAcl($params);
}
示例2: getVisibility
/**
* Get the visibility of a file
*
* @param string $path
* @return array file metadata
*/
public function getVisibility($path)
{
$options = $this->getOptions($path);
$result = $this->client->getObjectAcl($options)->getAll();
foreach ($result['Grants'] as $grant) {
if (isset($grant['Grantee']['URI']) && $grant['Grantee']['URI'] === Group::ALL_USERS && $grant['Permission'] === Permission::READ) {
return array('visibility' => AdapterInterface::VISIBILITY_PUBLIC);
}
}
return array('visibility' => AdapterInterface::VISIBILITY_PRIVATE);
}
示例3: _filePutContents
/**
* Write a string to a file
*
* @param string $path file path
* @param string $content new file content
* @return bool
**/
protected function _filePutContents($path, $content)
{
$oldSettings = $this->getFile($path);
$settings = array("Bucket" => $this->bucket, "Key" => $this->pathToKey($path), "ACL" => $this->options['acl'], "Body" => $content);
if ($oldSettings) {
$settings['Metadata'] = $oldSettings['Metadata'];
$settings['ContentType'] = $oldSettings['ContentType'];
$settings['ACP'] = Aws\S3\Model\Acp::fromArray($this->s3->getObjectAcl(array('Bucket' => $this->bucket, 'Key' => $this->pathToKey($path)))->toArray());
unset($settings['ACL']);
}
return $this->s3->putObject($settings);
}
示例4: testGetObjectAcl
/**
* @depends testPutAndListObjects
*/
public function testGetObjectAcl()
{
self::log("Getting the object's ACL");
$model = $this->client->getObjectAcl(array('Bucket' => $this->bucket, 'Key' => self::TEST_KEY));
$data = array();
foreach (Acp::fromArray($model->toArray()) as $grant) {
$grantee = $grant->getGrantee();
$data[$grantee->getGroupUri()] = array($grantee->getType(), $grant->getPermission());
}
$this->assertEquals(2, count($data));
$this->assertArrayHasKey('http://acs.amazonaws.com/groups/global/AllUsers', $data);
$this->assertArrayHasKey('http://acs.amazonaws.com/groups/global/AuthenticatedUsers', $data);
$this->assertEquals(array('Group', 'READ_ACP'), $data['http://acs.amazonaws.com/groups/global/AllUsers']);
$this->assertEquals(array('Group', 'READ'), $data['http://acs.amazonaws.com/groups/global/AuthenticatedUsers']);
}
示例5: getObjectAcl
/**
* Returns the access control list (ACL) of an object.
*
* @param $bucket
* @param $key
*
* @return mixed
*/
public function getObjectAcl($bucket, $key)
{
$params = ['Bucket' => $bucket, 'Key' => $key];
return $this->instance->getObjectAcl($params);
}