Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow uniform access rules on upload #114

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mattfoster7
Copy link

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.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@mattfoster7
Copy link
Author

The tests are failing because they are not scoped to work with this use case.

@7snovic
Copy link

7snovic commented Sep 2, 2020

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;
    }
};

@theanchorsmith
Copy link

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.

@Aerendir
Copy link

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

@atrauzzi
Copy link

Also curious about this one.

@JesseChua94
Copy link

Hi is there any progress with this pr? itd be great to get this change merged in!

@GiusWhite
Copy link

Hi, is this pr alive? This will solve problems for who can't change bucket access control 🙏

@tai221
Copy link

tai221 commented Mar 15, 2023

😭😭😭 Pls merge this pr🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants