Package com.google.gdata.data.acl

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


    if (uploadedExcelDocumentID==null){
      fail("Document Upload Test should run first");
    }

    //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


  }

  public void updateAclRole(DocumentListEntry entry, String newUser, String oldUser) {
    AclFeed aclFeed;
    boolean foundEntries = false;
    AclScope scope = new AclScope(AclScope.Type.USER, newUser);
    try {
      if (oldUser != null) {
        aclFeed = documentsService.getFeed(new URL(entry.getAclFeedLink().getHref()), AclFeed.class);
        for (AclEntry aclEntry : aclFeed.getEntries()) {
          if (aclEntry.getScope().getValue().equals(oldUser)) {
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

          printAclEntry(entry);
        }
      }
    } else if (args[1].equals("add") && args.length == 6) {
      AclRole role = new AclRole(args[2]);
      AclScope scope;
      if (args[3].equals("user")) {
        scope = new AclScope(AclScope.Type.USER, args[4]);
      } else if (args[3].equals("domain")) {
        scope = new AclScope(AclScope.Type.DOMAIN, args[4]);
      } else {
        printMessage(COMMAND_HELP_PERMS);
        return;
      }
      printAclEntry(documentList.addAclRole(role, scope, args[5]));
    } else if (args[1].equals("change") && args.length == 6) {
      AclRole role = new AclRole(args[2]);
      AclScope scope;
      if (args[3].equals("user")) {
        scope = new AclScope(AclScope.Type.USER, args[4]);
      } else if (args[3].equals("domain")) {
        scope = new AclScope(AclScope.Type.DOMAIN, args[4]);
      } else {
        printMessage(COMMAND_HELP_PERMS);
        return;
      }
      printAclEntry(documentList.changeAclRole(role, scope, args[5]));
View Full Code Here

   * @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:");
View Full Code Here

    } else if (parser.containsKey("changetype")) {
      String changeType = parser.getValue("changetype");
      String emailId = parser.getValue("email");

      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);
View Full Code Here

TOP

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

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.