Examples of lookupPrincipalByName()


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

        return lookupService.lookupPrincipalByGroupName(name);
    }

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

    private Set<PosixFilePermission> toPerms(EnumSet<Permission> perms) {
        Set<PosixFilePermission> set = new HashSet<PosixFilePermission>();
        for (Permission p : perms) {
View Full Code Here

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

        return lookupService.lookupPrincipalByGroupName(name);
    }

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

    private Set<PosixFilePermission> toPerms(EnumSet<Permission> perms) {
        Set<PosixFilePermission> set = new HashSet<PosixFilePermission>();
        for (Permission p : perms) {
View Full Code Here

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

        return lookupService.lookupPrincipalByGroupName(name);
    }

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

    private Set<PosixFilePermission> toPerms(EnumSet<Permission> perms) {
        Set<PosixFilePermission> set = new HashSet<PosixFilePermission>();
        for (Permission p : perms) {
View Full Code Here

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

          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])));
            } else {
              String msg = "Can't restore 'posix' permissions on '" + item.getPath() + "'. They are not supported.";
View Full Code Here

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

              for (int i = 0; i < values.length; i = i + 4) {

                Builder aclEntryBuilder = AclEntry.newBuilder();

                aclEntryBuilder.setType(AclEntryType.valueOf(values[i]));
                aclEntryBuilder.setPrincipal(lookupService.lookupPrincipalByName(values[i + 1]));

                Set<AclEntryFlag> flags = new HashSet<AclEntryFlag>();
                for (String flag : StringUtils.splitPreserveAllTokens(values[i + 2], ",")) {
                  flags.add(AclEntryFlag.valueOf(flag));
                }
View Full Code Here

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

            }
            break;
          case Item.ATTRIBUTE_OWNER:
            FileOwnerAttributeView ownerView = Files.getFileAttributeView(path, FileOwnerAttributeView.class, LinkOption.NOFOLLOW_LINKS);
            if (ownerView != null) {
              principal = lookupService.lookupPrincipalByName(values[0]);
              ownerView.setOwner(principal);
            } else {
              String msg = "Can't restore 'owner' permissions on '" + item.getPath() + "'. They are not supported.";
              if (permissionType.equals(PermissionType.TRY))
                LOGGER.log(Level.WARNING, msg);
View Full Code Here

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

                FileSystems.getDefault().getUserPrincipalLookupService();

            // In Java, we can't actually get the unix UID, so we take a username here, rather
            // 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) {
View Full Code Here

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

public class UserLookupServiceTest {

  @Test
  public void testUserLookupService() throws IOException {
    UserPrincipalLookupService service = new UserLookupService(true);
    UserPrincipal bob1 = service.lookupPrincipalByName("bob");
    UserPrincipal bob2 = service.lookupPrincipalByName("bob");
    UserPrincipal alice = service.lookupPrincipalByName("alice");

    assertThat(bob1).isEqualTo(bob2);
    assertThat(bob1).isNotEqualTo(alice);
View Full Code Here

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

  @Test
  public void testUserLookupService() throws IOException {
    UserPrincipalLookupService service = new UserLookupService(true);
    UserPrincipal bob1 = service.lookupPrincipalByName("bob");
    UserPrincipal bob2 = service.lookupPrincipalByName("bob");
    UserPrincipal alice = service.lookupPrincipalByName("alice");

    assertThat(bob1).isEqualTo(bob2);
    assertThat(bob1).isNotEqualTo(alice);
View Full Code Here

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

  @Test
  public void testUserLookupService() throws IOException {
    UserPrincipalLookupService service = new UserLookupService(true);
    UserPrincipal bob1 = service.lookupPrincipalByName("bob");
    UserPrincipal bob2 = service.lookupPrincipalByName("bob");
    UserPrincipal alice = service.lookupPrincipalByName("alice");

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

    GroupPrincipal group1 = service.lookupPrincipalByGroupName("group");
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.