Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:09:41+00:00 2026-06-07T17:09:41+00:00

I have an issue updating the Acl for a Google Document. I want to

  • 0

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);

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

If I change this to AclRole.READER it works fine.

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:


AclFeed feed = getDservice().getFeed(new URL(doc.getAclFeedLink().getHref()),AclFeed.class);

        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());
            }
        }


The output for user1 with COMMENTER access, and user2 with READER access was:

acl role:reader
acl scope:user1@domain.com

acl role:reader
acl scope:user2@domain.com

So even when user1 is explicitly a COMMENTER, it’s being reported as a ‘reader’

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).

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.

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:09:42+00:00Added an answer on June 7, 2026 at 5:09 pm

    The thing missing here is checking the additionalRole field of the ACL entry. The user is a reader and a commenter. Check out this raw XML response from the Documents List API:

    <entry gd:etag='W/&quot;D0UFQH4_eCt7ImAe9WhJREEk.&quot;'>
      <id>https://docs.google.com/feeds/id/user%3Aa%40b.com</id>
      <updated>2012-07-11T22:20:11.040Z</updated>
      <app:edited xmlns:app='http://www.w3.org/2007/app'>2012-07-11T22:20:11.040Z</app:edited>
      <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/>
      <title>Document Permission - a@b.com</title>
      <link rel='self' type='application/atom+xml' href='https://docs.google.com/feeds/default/private/expandAcl/document%3A1lD_aQPqe33JI4mObm2zc7FADUH-ypXcGekwAovPY2OpMw/acl/user%3Aa%40b.com'/>
      <link rel='edit' type='application/atom+xml' href='https://docs.google.com/feeds/default/private/expandAcl/document%3A1lD_aQPqe33JI4mObm2zc7FADUH-ypXcGekwAovPY2OpMw/acl/user%3Aa%40b.com'/>
      <gAcl:role xmlns:gAcl='http://schemas.google.com/acl/2007' value='reader'/>
      <gAcl:scope xmlns:gAcl='http://schemas.google.com/acl/2007' type='user' value='a@b.com' name='Anderson Jones'/>
      <gAcl:additionalRole xmlns:gAcl='http://schemas.google.com/acl/2007' value='commenter'/>
    </entry>
    

    Note the value of gAcl:additionalRole is commenter.

    Try this code to create a commenter entry:

    AclEntry aclEntry = new AclEntry();
    aclEntry.setScope(new AclScope("user", "user1@domain.com"));
    aclEntry.setRole(AclRole.READER);
    aclEntry.addAdditionalRole(AdditionalRole.COMMENTER);
    

    And to determine if an entry has the commenter additionalRole, do this:

    if (aclEntry.getAdditionalRoles().contains(AdditionalRole.COMMENTER)) {
      // Do something knowing this user is a commenter
    }
    

    However, you really should upgrade to the Drive API v2, which makes this easier. The following code sample is for the Drive API:

    Permission permission = new Permission();
    permission.setType("user");
    permission.setValue("user1@domain.com");
    permission.setRole("reader");
    permission.setAdditionalRoles(Arrays.asList("commenter"));
    

    Thanks to Alain Vongsouvanh for providing parts of this answer!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a website in asp.net but i have some issue.. I have
I have an updating issue with Binding in my ComboBox. I have created a
I have an issue where I'm updating millions of rows in my DB, so
Share your ideas please! I have issue to check the folder and convert a
I have an issue with a datagrid inserting/updating rows twice. The datagrid is bound
The project I have been managing has ran into an issue of updating contents
I have a strange issue where Flash Player in Chrome is not updating unless
I'm having an issue with the UITableView object updating after load. I have a
I am having some weird issue here. I have a database table which has
I don't have any experience in updating a Rails app and when I google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.