[GH-ISSUE #945] make_public and make_private don't actually update the ACL #149

Closed
opened 2026-03-03 12:08:44 +03:00 by kerem · 0 comments
Owner

Originally created by @marcguidancenl on GitHub (Oct 6, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/945

I noticed that the ACL doesn't actually get changed with make_public and make_private. Sample code (only works after applying #943, otherwise you get an error, see #941):

    os.environ["STORAGE_EMULATOR_HOST"] = "http://0.0.0.0:4443"

    client = storage.Client(
        credentials=AnonymousCredentials(),
        project="test-project",
    )

    # buckets/files to create and test
    upload_bucket_name = "test-bucket-with-globally-unique-name"
    upload_blob_name = "test-blob-upload.svg"
    upload_blob_file_path = "./image.svg"

    # initialize
    try:
        bucket = client.bucket(upload_bucket_name)
        bucket.storage_class = storage.constants.STANDARD_STORAGE_CLASS
        client.create_bucket(bucket, location="EU", retry=None)
    except:
        pass
    bucket = client.get_bucket(upload_bucket_name)
    blob = bucket.blob(upload_blob_name)
    blob.upload_from_filename(upload_blob_file_path, retry=None)

    # test
    bucket = client.get_bucket(upload_bucket_name)
    blob = bucket.blob(upload_blob_name)
    print(list(blob.acl))
    blob.make_public()
    print(list(blob.acl))  #            <<<<< didn't change ACL entities!
    blob.make_private()
    print(list(blob.acl))

this lists the same ACL three times - initial ACL, public ACL, and private ACL:

[{'entity': 'projectOwner-test-project', 'role': 'OWNER'}]
[{'entity': 'projectOwner-test-project', 'role': 'OWNER'}]
[{'entity': 'projectOwner-test-project', 'role': 'OWNER'}]

I think the second one should at least have 'allUsers' + 'READER'.


Originally posted by @marcguidancenl in https://github.com/fsouza/fake-gcs-server/issues/941#issuecomment-1269647236

Originally created by @marcguidancenl on GitHub (Oct 6, 2022). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/945 I noticed that the ACL doesn't actually get changed with make_public and make_private. Sample code (only works after applying #943, otherwise you get an error, see #941): ```python os.environ["STORAGE_EMULATOR_HOST"] = "http://0.0.0.0:4443" client = storage.Client( credentials=AnonymousCredentials(), project="test-project", ) # buckets/files to create and test upload_bucket_name = "test-bucket-with-globally-unique-name" upload_blob_name = "test-blob-upload.svg" upload_blob_file_path = "./image.svg" # initialize try: bucket = client.bucket(upload_bucket_name) bucket.storage_class = storage.constants.STANDARD_STORAGE_CLASS client.create_bucket(bucket, location="EU", retry=None) except: pass bucket = client.get_bucket(upload_bucket_name) blob = bucket.blob(upload_blob_name) blob.upload_from_filename(upload_blob_file_path, retry=None) # test bucket = client.get_bucket(upload_bucket_name) blob = bucket.blob(upload_blob_name) print(list(blob.acl)) blob.make_public() print(list(blob.acl)) # <<<<< didn't change ACL entities! blob.make_private() print(list(blob.acl)) ``` this lists the same ACL three times - initial ACL, public ACL, and private ACL: ``` [{'entity': 'projectOwner-test-project', 'role': 'OWNER'}] [{'entity': 'projectOwner-test-project', 'role': 'OWNER'}] [{'entity': 'projectOwner-test-project', 'role': 'OWNER'}] ``` I think the second one should at least have 'allUsers' + 'READER'. --- _Originally posted by @marcguidancenl in https://github.com/fsouza/fake-gcs-server/issues/941#issuecomment-1269647236_
kerem 2026-03-03 12:08:44 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#149
No description provided.