flysystem-google-cloud-storage
flysystem-google-cloud-storage copied to clipboard
Allow uniform access rules on upload
Currently the code forces an ACL on the files, this doesn't work if the bucket has uniform access policies set. So this PR just checks whether the bucket has uniform access before setting the ACL.
The tests are failing because they are not scoped to work with this use case.
thanks @mattfoster7 for sharing this. however , and until merging this I used your solution as a work around using Anonymous classes in PHP7
return new class ($storageClient, $bucket) extends GoogleStorageAdapter {
protected function getOptionsFromConfig(\League\Flysystem\Config $config)
{
$options = [];
if (empty($this->bucket->info()['iamConfiguration']['uniformBucketLevelAccess']['enabled'])) {
if ($visibility = $config->get('visibility')) {
$options['predefinedAcl'] = $this->getPredefinedAclForVisibility($visibility);
} else {
$options['predefinedAcl'] = $this->getPredefinedAclForVisibility(AdapterInterface::VISIBILITY_PRIVATE);
}
}
if ($metadata = $config->get('metadata')) {
$options['metadata'] = $metadata;
}
return $options;
}
};
Shouldn't the visibility
config be optional?
Instead of defaulting to private?
This way user can omit the configuration if they don't want to use the predefinedAcl
option.
Any news on this?
Just for reference, this is the related question on StackOverflow: https://stackoverflow.com/questions/61779218/trying-to-upload-to-google-cloud-storage-using-superbalist-flysystem-google-clou
Also curious about this one.
Hi is there any progress with this pr? itd be great to get this change merged in!
Hi, is this pr alive? This will solve problems for who can't change bucket access control 🙏
😭😭😭 Pls merge this pr🙏