Setting ACL to "Anyone with the link"

149 views
Skip to first unread message

jay...@gmail.com

unread,
Jan 20, 2011, 8:31:29 AM1/20/11
to google-docum...@googlegroups.com
Does the API support a way to set the ACL for an uploaded document to the sharing option of "Anyone with the link can edit without signing in"? I didn't see this in the documentation, but need to do this for my site. Is there any way to do so?

Vic Fryzel

unread,
Jan 20, 2011, 12:20:23 PM1/20/11
to google-docum...@googlegroups.com
Hey jayred,

Yes, you can :D

Here's a sample ACL entry:

<entry gd:etag="W/&quot;CU8CQXk_eit7ImA9Wx9WFUk.&quot;">
<id>https://docs.google.com/feeds/id/document%3A1I9YlQF5yTrnZv8gYS8VoNIVAn-soDDNY6_qhn7Bg/acl/default</id>
<updated>2011-01-20T17:17:40.742Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-20T17:17:40.742Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>
<title>Document Permission - default</title>
<link rel="self" type="application/atom+xml" href="https://docs.google.com/feeds/default/private/full/document%3A1I9YlQF5yTrnZv8gYS8VoNIVAn-soDDNY6_qhn7Bg/acl/default"/>
<link rel="edit" type="application/atom+xml" href="https://docs.google.com/feeds/default/private/full/document%3A1I9YlQF5yTrnZv8gYS8VoNIVAn-soDDNY6_qhn7Bg/acl/default"/>
<gAcl:withKey key="CLJK4IsE">
<gAcl:role value="writer"/>
</gAcl:withKey>
<gAcl:role value="none"/>
<gAcl:scope type="default"/>
</entry>

Thanks,
-Vic

jay...@gmail.com

unread,
Jan 20, 2011, 12:40:23 PM1/20/11
to google-docum...@googlegroups.com
Hi Vic,

Thanks for the quick reply. Would you mind explaining to me how the following lines indicate this ACL setting? 

<gAcl:withKey key="CLJK4IsE">
<gAcl:role value="writer"/>
</gAcl:withKey>
<gAcl:role value="none"/>
<gAcl:scope type="default"/>


Thanks,
Jared

Vic Fryzel

unread,
Jan 20, 2011, 4:44:05 PM1/20/11
to google-docum...@googlegroups.com
Sure, I'll respond inline:

On Thu, Jan 20, 2011 at 9:40 AM, <jay...@gmail.com> wrote:
<gAcl:withKey key="CLJK4IsE">
Require that the URL contain this value as the value of the authkey GET parameter.
 
<gAcl:role value="writer"/>
Anyone with the above key is a writer.
 
</gAcl:withKey>
Close the above gAcl:withKey element.
 
<gAcl:role value="none"/>
Everyone not with the key should not be able to read or write. 

<gAcl:scope type="default"/>
The above gAcl:role element applies to everyone in the "default" scope, which is everyone on the internet.  Essentially, block all access to the document unless they have the specified key.

-Vic

VHanded

unread,
Mar 15, 2011, 12:35:28 AM3/15/11
to google-docum...@googlegroups.com
Hi, I am having the same problem.

Where can I get the key? I tried my ClientLogin token, it's not working. 

This is the code I used:

 string stringEntry = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gAcl='http://schemas.google.com/acl/2007' " +
                "xmlns:gd='http://schemas.google.com/g/2005' gd:etag='" + doc.ETag + "'>" +
                "<gAcl:withKey key='" + service.QueryClientLoginToken() + "'><gAcl:role value='" + role + "'/></gAcl:withKey>" +
                "<gAcl:scope type='" + scope + "' value='default'/>" +
                "</entry>";

        Stream responseStream = service.StringSend(doc.AccessControlList, stringEntry, GDataRequestType.Insert);

Thanks.

M. FarouQ

unread,
Apr 26, 2011, 3:28:47 AM4/26/11
to google-docum...@googlegroups.com
Same problem here, I CAN'T GET THE KEY, when I want to update from one visibility mode (which doesn't require a key) to another "with link" which requires it. I know Google generates it at run-time but how are we supposed to use the API to update an aclEntry like that?

L. G.

unread,
Aug 1, 2011, 5:10:57 AM8/1/11
to google-docum...@googlegroups.com
Same problem as M. FarouQ, can anyone help ?

L. G.

unread,
Aug 1, 2011, 8:24:06 AM8/1/11
to google-docum...@googlegroups.com
ok, problem solved : after inserting a new WithKey object into the AclEntry, getWithKey() on the updated AclEntry retrieve the new auto-regenerated key, different from the first one.

2011/8/1 L. G. <lg.g...@gmail.com>

Andrew Fields

unread,
Aug 1, 2011, 8:06:22 PM8/1/11
to google-docum...@googlegroups.com
This discussion might help you too:
http://code.google.com/apis/documents/forum.html?place=topic%2Fgoogle-documents-list-api%2Fh2Iy0yK057Y%2Fdiscussion

Note that there is discussion on the Docs List user group that Google may soon be changing the way "Anyone with link" works.
Reply all
Reply to author
Forward
0 new messages