Examples of lookupPrincipalByGroupName()


Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

        return p;
    }

    private GroupPrincipal toGroup(String name) throws IOException {
        UserPrincipalLookupService lookupService = file.toPath().getFileSystem().getUserPrincipalLookupService();
        return lookupService.lookupPrincipalByGroupName(name);
    }

    private UserPrincipal toUser(String name) throws IOException {
        UserPrincipalLookupService lookupService = file.toPath().getFileSystem().getUserPrincipalLookupService();
        return lookupService.lookupPrincipalByName(name);
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

        return p;
    }

    private GroupPrincipal toGroup(String name) throws IOException {
        UserPrincipalLookupService lookupService = file.toPath().getFileSystem().getUserPrincipalLookupService();
        return lookupService.lookupPrincipalByGroupName(name);
    }

    private UserPrincipal toUser(String name) throws IOException {
        UserPrincipalLookupService lookupService = file.toPath().getFileSystem().getUserPrincipalLookupService();
        return lookupService.lookupPrincipalByName(name);
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

        return p;
    }

    private GroupPrincipal toGroup(String name) throws IOException {
        UserPrincipalLookupService lookupService = file.toPath().getFileSystem().getUserPrincipalLookupService();
        return lookupService.lookupPrincipalByGroupName(name);
    }

    private UserPrincipal toUser(String name) throws IOException {
        UserPrincipalLookupService lookupService = file.toPath().getFileSystem().getUserPrincipalLookupService();
        return lookupService.lookupPrincipalByName(name);
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

          switch (type) {
          case Item.ATTRIBUTE_POSIX:
            PosixFileAttributeView posixView = Files.getFileAttributeView(path, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
            if (posixView != null) {
              group = lookupService.lookupPrincipalByGroupName(values[0]);
              posixView.setGroup(group);
              principal = lookupService.lookupPrincipalByName(values[1]);
              posixView.setOwner(principal);
              if (values.length > 2)
                posixView.setPermissions(toPermissions(Integer.parseInt(values[2])));
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

            // than a UID. That may cause problems for NPM, which may try to use a UID.
            try {
                UserPrincipal user = lookupService.lookupPrincipalByName(uid);
               
                if (Platform.get().isPosixFilesystem()) {
                    GroupPrincipal group = lookupService.lookupPrincipalByGroupName(gid);
   
                    if (noFollow) {
                        Files.setAttribute(path, "posix:owner", user, LinkOption.NOFOLLOW_LINKS);
                        Files.setAttribute(path, "posix:group", group, LinkOption.NOFOLLOW_LINKS);
                    } else {
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

    UserPrincipal alice = service.lookupPrincipalByName("alice");

    assertThat(bob1).isEqualTo(bob2);
    assertThat(bob1).isNotEqualTo(alice);

    GroupPrincipal group1 = service.lookupPrincipalByGroupName("group");
    GroupPrincipal group2 = service.lookupPrincipalByGroupName("group");
    GroupPrincipal foo = service.lookupPrincipalByGroupName("foo");

    assertThat(group1).isEqualTo(group2);
    assertThat(group1).isNotEqualTo(foo);
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

    assertThat(bob1).isEqualTo(bob2);
    assertThat(bob1).isNotEqualTo(alice);

    GroupPrincipal group1 = service.lookupPrincipalByGroupName("group");
    GroupPrincipal group2 = service.lookupPrincipalByGroupName("group");
    GroupPrincipal foo = service.lookupPrincipalByGroupName("foo");

    assertThat(group1).isEqualTo(group2);
    assertThat(group1).isNotEqualTo(foo);
  }
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

    assertThat(bob1).isEqualTo(bob2);
    assertThat(bob1).isNotEqualTo(alice);

    GroupPrincipal group1 = service.lookupPrincipalByGroupName("group");
    GroupPrincipal group2 = service.lookupPrincipalByGroupName("group");
    GroupPrincipal foo = service.lookupPrincipalByGroupName("foo");

    assertThat(group1).isEqualTo(group2);
    assertThat(group1).isNotEqualTo(foo);
  }
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

  @Test
  public void testServiceNotSupportingGroups() throws IOException {
    UserPrincipalLookupService service = new UserLookupService(false);

    try {
      service.lookupPrincipalByGroupName("group");
      fail();
    } catch (UserPrincipalNotFoundException expected) {
      assertThat(expected.getName()).isEqualTo("group");
    }
  }
View Full Code Here

Examples of java.nio.file.attribute.UserPrincipalLookupService.lookupPrincipalByGroupName()

    return new BlockingAction<Void>(handler) {
      public Void perform() {

        try {
          final UserPrincipal userPrincipal = user == null ? null : service.lookupPrincipalByName(user);
          final GroupPrincipal groupPrincipal = group == null ? null : service.lookupPrincipalByGroupName(group);
          if (groupPrincipal != null) {
            PosixFileAttributeView view = Files.getFileAttributeView(target, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
            if (view == null) {
              throw new FileSystemException("Change group of file not supported");
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.