Note that there are some explanatory texts on larger screens.

plurals
  1. POAclRole for Commenter
    primarykey
    data
    text
    <p>I have an issue updating the Acl for a Google Document. I want to share the document with some users but only allow COMMENTER privileges. This is the code: AclEntry newAclEntry = getDservice().insert(new URL(aclFeedUrl), new AclScope( AclScope.Type.USER, "user1@domain.com"), AclRole.COMMENTER); </p> <p>Now Eclipse tells me AclRole.COMMENTER is a valid type but when I run the code I get the following exception: Service Exception: The posted entry has an invalid value for the field(s): role </p> <p>If I change this to AclRole.READER it works fine. </p> <p>So I thought I'd do a bit of investigation. You can set COMMENTER access from a Google Doc via 'share'. So I did that and then read the ACL's for the doc via:</p> <p><code> AclFeed feed = getDservice().getFeed(new URL(doc.getAclFeedLink().getHref()),AclFeed.class);</p> <pre><code> if (feed == null) System.out.println("Feed is null"); else { for (AclEntry a: feed.getEntries()) { System.out.println("acl role:" + a.getRole().getValue()); System.out.println("acl scope:" + a.getScope().getValue()); } } </code></pre> <p></code> The output for user1 with COMMENTER access, and user2 with READER access was:</p> <p>acl role:reader acl scope:user1@domain.com</p> <p>acl role:reader acl scope:user2@domain.com</p> <p>So even when user1 is explicitly a COMMENTER, it's being reported as a 'reader'</p> <p>If I access the online documentation for AclRole there is no COMMENTER enumeration (https://developers.google.com/gdata/javadoc/com/google/gdata/data/acl/AclRole).</p> <p>So, how do I set an ACL for Comment only privileges? Clearly it's supported in Google Docs, and Eclipse is picking it up from the GData jars I'm using.</p> <p>What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload