Package com.google.gdata.data.acl

Examples of com.google.gdata.data.acl.AclEntry


  DocumentListException {
    if (role == null || scope == null || resourceId == null) {
      throw new DocumentListException("null passed in for required parameters");
    }

    AclEntry entry = new AclEntry();
    entry.setRole(role);
    entry.setScope(scope);
    URL url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + "/" + resourceId + URL_ACL);

    return service.insert(url, entry);
  }
View Full Code Here


    }

    //This request makes our previously uploaded document public
    AclScope scope = new AclScope(AclScope.Type.DOMAIN,uploadedExcelDocumentID);

    AclEntry aclEntry = demo.addAclRole(AclRole.READER, scope,  uploadedExcelDocumentID);
    assertNotNull("aclEntry should not be null",aclEntry);

  }
View Full Code Here

            foundEntries = true;
          }
        }
      }
      if (foundEntries == false) {
        AclEntry aclEntry = new AclEntry();
        aclEntry.setRole(new AclRole("reader"));
        aclEntry.setScope(scope);
        documentsService.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
      }
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

  }

  public void addAclRole(DocumentListEntry entry, String user, String role) {
    if (Strings.isValidDomainAccount(user, "gmail.com") || Strings.isValidDomainAccount(user, "casamind.com")) {
      try {
        AclEntry aclEntry = new AclEntry();
        aclEntry.setRole(new AclRole(role));
        aclEntry.setScope(new AclScope(AclScope.Type.USER, user));
        documentsService.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
      } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
View Full Code Here

   * @throws ServiceException If the service is unable to handle the request.
   * @throws IOException Error communicating with the server.
   */
  private static void addAccessControl(CalendarService service,
      String userEmail, AclRole role) throws ServiceException, IOException {
    AclEntry entry = new AclEntry();
    entry.setScope(new AclScope(AclScope.Type.USER, userEmail));
    entry.setRole(role);

    AclEntry insertedEntry = service.insert(aclFeedUrl, entry);

    System.out.println("Added user to access control list:");
    System.out.println("\tScope: Type=" + insertedEntry.getScope().getType()
        + " (" + insertedEntry.getScope().getValue() + ")");
    System.out.println("\tRole: " + insertedEntry.getRole().getValue());
  }
View Full Code Here

    AclFeed aclFeed = service.getFeed(aclFeedUrl, AclFeed.class);

    for (AclEntry aclEntry : aclFeed.getEntries()) {
      if (userEmail.equals(aclEntry.getScope().getValue())) {
        aclEntry.setRole(newRole);
        AclEntry updatedEntry = aclEntry.update();

        System.out.println("Updated user's access control:");
        System.out.println("\tScope: Type=" + updatedEntry.getScope().getType()
            + " (" + updatedEntry.getScope().getValue() + ")");
        System.out.println("\tRole: " + updatedEntry.getRole().getValue());

        break;
      }
    }
  }
View Full Code Here

      DocumentListException {
    if (role == null || scope == null || resourceId == null) {
      throw new DocumentListException("null passed in for required parameters");
    }

    AclEntry entry = new AclEntry();
    entry.setRole(role);
    entry.setScope(scope);
    URL url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + "/" + resourceId + URL_ACL);

    return service.insert(url, entry);
  }
View Full Code Here

      if ("add".equals(changeType)) {
        AclScope scope = new AclScope(AclScope.Type.USER, emailId);
        AclRole role = new AclRole(parser.getValue("role"));

        // Add a new accessor for this entry
        AclEntry entry = new AclEntry();
        entry.setRole(role);
        entry.setScope(scope);

        System.out.println("Adding user " + emailId + " as " + role.getValue()
            + " to " + feedName + " with id " + entryId + " ...");
        URL feedUrl = FeedUris.getAclFeedUrl(feedName, entryId);
        service.insert(feedUrl, entry);
        System.out.println("...done");

      } else if ("change".equals(changeType)) {
        AclScope scope = new AclScope(AclScope.Type.USER, emailId);
        AclRole role = new AclRole(parser.getValue("role"));

        // Change the role of an accessor for this entry
        AclEntry entry = new AclEntry();
        entry.setRole(role);
        entry.setScope(scope);

        System.out.println("Changing user " + emailId + "'s access to "
            + role.getValue() + " for " + feedName + " with id "
            + entryId + " ...");
        URL feedUrl = FeedUris.getAclFeedUrl(feedName, entryId, emailId);
View Full Code Here

      DocumentListException {
    if (role == null || scope == null || resourceId == null) {
      throw new DocumentListException("null passed in for required parameters");
    }

    AclEntry entry = new AclEntry();
    entry.setRole(role);
    entry.setScope(scope);
    URL url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + "/" + resourceId + URL_ACL);

    return service.insert(url, entry);
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.acl.AclEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.