Storage Legacy Bucket Owner cannot download blobs (GCP)

Viewed 109

I am the owner of my GCP project and have created a storage within that project. I have uploaded a test-file to the storage which worked fine, but I'm unable to download the file again.

Opening the bucket there is the following standard permissions enter image description here

where it says that "Storage Legacy Bucket Owner has reading/writing access".

But I still have to add "Storage Admin" as role to the user, which have uploaded the file, before being able to download the file.

  1. Since the user is owner of the project; why do I need to set the role specific. Why isnt the "Storage legacy bucket owner" enough when it's stated that they have Read/write permissions?
def download_blob(bucket_name="bucket", source_blob_name="file", destination_file_name="downloaded_test.txt"):
    """Downloads a blob from the bucket."""
    # bucket_name = "your-bucket-name"
    # source_blob_name = "storage-object-name"
    # destination_file_name = "local/path/to/file"

    storage_client = storage.Client.from_service_account_json("credentials.json")
    bucket = storage_client.bucket(bucket_name)

    blob = bucket.blob(source_blob_name)
    blob.download_to_filename(destination_file_name,)

download_blob()
0 Answers
Related