/** * @param path Remove "Everyone" from this path's Windows ACL permissions. */ public static void setPrivate(Path path) throws IOException { UserPrincipal everyone = getDefault().getUserPrincipalLookupService() .lookupPrincipalByName(WINDOWS_EVERYONE); AclFileAttributeView aclFileAttributes = java.nio.file.Files.getFileAttributeView( path, AclFileAttributeView.class); CopyOnWriteArrayList<AclEntry> aclList = new CopyOnWriteArrayList(aclFileAttributes.getAcl()); for (AclEntry aclEntry : aclList) { if (aclEntry.principal().equals(everyone) && aclEntry.type().equals(AclEntryType.ALLOW)) { aclList.remove(aclEntry); } } aclFileAttributes.setAcl(aclList); }
/** * @param path Remove "Everyone" from this path's Windows ACL permissions. */ public static void setPrivate(Path path) throws IOException { UserPrincipal everyone = getDefault().getUserPrincipalLookupService() .lookupPrincipalByName(WINDOWS_EVERYONE); AclFileAttributeView aclFileAttributes = java.nio.file.Files.getFileAttributeView( path, AclFileAttributeView.class); CopyOnWriteArrayList<AclEntry> aclList = new CopyOnWriteArrayList(aclFileAttributes.getAcl()); for (AclEntry aclEntry : aclList) { if (aclEntry.principal().equals(everyone) && aclEntry.type().equals(AclEntryType.ALLOW)) { aclList.remove(aclEntry); } } aclFileAttributes.setAcl(aclList); }
/** * @param path Remove "Everyone" from this path's Windows ACL permissions. */ public static void setPrivate(Path path) throws IOException { UserPrincipal everyone = getDefault().getUserPrincipalLookupService() .lookupPrincipalByName(WINDOWS_EVERYONE); AclFileAttributeView aclFileAttributes = java.nio.file.Files.getFileAttributeView( path, AclFileAttributeView.class); CopyOnWriteArrayList<AclEntry> aclList = new CopyOnWriteArrayList(aclFileAttributes.getAcl()); for (AclEntry aclEntry : aclList) { if (aclEntry.principal().equals(everyone) && aclEntry.type().equals(AclEntryType.ALLOW)) { aclList.remove(aclEntry); } } aclFileAttributes.setAcl(aclList); }