Google\Cloud\Storage\Acl::update PHP Method

update() public method

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

Usage Example

 public function testUpdate()
 {
     $accessControl = ['entity' => 'allAuthenticatedUsers', 'role' => 'WRITER'];
     $this->connection->patchAcl(Argument::any())->willReturn($accessControl);
     $acl = new Acl($this->connection->reveal(), 'bucketAccessControls', ['bucket' => 'bucket']);
     $this->assertEquals($accessControl, $acl->update('allAuthenticatedUsers', 'WRITER'));
 }