Google\Cloud\Storage\Acl::add PHP 메소드

add() 공개 메소드

Example: $acl->add('allAuthenticatedUsers', 'WRITER');
또한 보기: https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert BucketAccessControls insert API documentation.
또한 보기: https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls/insert DefaultObjectAccessControls insert API documentation.
또한 보기: https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert ObjectAccessControls insert API documentation.
public add ( string $entity, string $role, array $options = [] ) : array
$entity string The entity to add access controls to.
$role string The permissions to add for the specified entity. May be one of 'OWNER', 'READER', or 'WRITER'.
$options array [optional] Configuration Options.
리턴 array
    public function add($entity, $role, array $options = [])
    {
        $aclOptions = $this->aclOptions + ['entity' => $entity, 'role' => $role];
        return $this->connection->insertAcl($options + $aclOptions);
    }

Usage Example

예제 #1
0
 public function testAdd()
 {
     $accessControl = ['entity' => 'allAuthenticatedUsers', 'role' => 'READER'];
     $this->connection->insertAcl(Argument::any())->willReturn($accessControl);
     $acl = new Acl($this->connection->reveal(), 'bucketAccessControls', ['bucket' => 'bucket']);
     $this->assertEquals($accessControl, $acl->add('allAuthenticatedUsers', 'READER'));
 }