How to add domain to Google Cloud Storage object ACL at creation?

浪子不回头ぞ 提交于 2019-12-24 02:45:26

问题


In my Java based app-engine project, i allow users to upload files to google cloud store (this works), but i can't seem to add a specific domain to the access list, so that only people from within my company can access my files. How do i do this?

i tried using:

    GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
    GcsFilename gcsFileName = new GcsFilename("my-bucket", user_uploaded_file_name);
    Builder fileOptionsBuilder = new GcsFileOptions.Builder();
    fileOptionsBuilder.mimeType(mimeType);
    fileOptionsBuilder.acl("authenticated-read"); // how do i modify this list?
    GcsFileOptions fileOptions = fileOptionsBuilder.build();
    GcsOutputChannel outputChannel = gcsService.createOrReplace(gcsFileName, fileOptions);

and this authenticated-read just makes the file public (not what i want). i want to add everyone from the organization "@mycompany.com" to the access list. do i do this through code? or do i do this using the google cloud console?

I will be providing people the links to files they upload via this url:

String url = https://console.developers.google.com/m/cloudstorage/b/" + "my-bucket" + "/o/" + user_uploaded_file_name;


回答1:


Oh wow. this guy was really helpful and had a Java version:

Changing ACL for Google Cloud Storage from Appengine (JAVA)

this totally worked for me!



来源:https://stackoverflow.com/questions/25393406/how-to-add-domain-to-google-cloud-storage-object-acl-at-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!