SilverHoodCorp / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

Error add permission to write my document for my domain #265

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello All!
1.I am using Google Java API
http://gdata-java-client.googlecode.com/files/gdata-samples.java-1.41.1.zip
2.Today i do not delegate permission for my domain.
Source code
// Functions
  public AclEntry addAclRole(AclRole role, AclScope scope,
DocumentListEntry entry)
    throws IOException, MalformedURLException, ServiceException  {
  AclEntry aclEntry = new AclEntry();
  aclEntry.setRole(role);
  aclEntry.setScope(scope);

  return service.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
  }
    /**
     * Prints out the specified ACL entry.
     *
     * @param entry the ACL entry to print.
     */
    public static void printAclEntry(AclEntry entry) {
      System.out.println(" -- " + entry.getScope().getValue() + ": " +
entry.getRole().getValue());
    }

    /**
     * Prints out the specified document entry.
     *
     * @param doc the document entry to print.
     */
    public static void printDocumentEntry(DocumentListEntry doc) {
      StringBuffer output = new StringBuffer();

      output.append(" -- " + doc.getTitle().getPlainText() + " ");
      if (!doc.getParentLinks().isEmpty()) {
        for (Link link : doc.getParentLinks()) {
          output.append("[" + link.getTitle() + "] ");
        }
      }
      output.append(doc.getResourceId());

      System.out.println(output);
    }

// main code

            demo.login(user, password);
            AclRole role = new AclRole("writer");
            AclScope scope;
            scope = new AclScope(AclScope.Type.DOMAIN, "privatbank.ua");
            DocumentListFeed feed = null;
            feed = demo.getDocsListFeed("presentations");
            if (feed != null) {
                for (DocumentListEntry entry : feed.getEntries()) {
                    printDocumentEntry(entry);
                    printAclEntry(demo.addAclRole(role, scope, entry));
                }
            }

//

Expected output:

 -- NRB_NPS_DR [PSS] presentation:0ASEo6xKU5qAKZGRtd3dwcmNfODRmZHJ6ZGJkbQ
 -- privatbank.ua: none
 -- NRB_NPS_MR [PSS] presentation:0ASEo6xKU5qAKZGRtd3dwcmNfODRkN3dzaDhjbQ
 -- privatbank.ua: none

Actual results:
User for my domain do not have permission for my document

Thank you for reply. 

Original issue reported on code.google.com by dn190768...@gmail.com on 6 May 2010 at 8:34

GoogleCodeExporter commented 9 years ago
Hi. Magic it's working.
Big thanks.

Original comment by dn190768...@gmail.com on 6 May 2010 at 12:59

GoogleCodeExporter commented 9 years ago
Closing based on your report that it's working for you.

Original comment by yanivin...@gmail.com on 6 May 2010 at 6:20