@Override public AclStatus getAclStatus(Path path) throws IOException { checkPathIsSlash(path); return new AclStatus.Builder().owner(ugi.getShortUserName()) .group(ugi.getPrimaryGroupName()) .addEntries(AclUtil.getMinimalAcl(PERMISSION_555)) .stickyBit(false).build(); }
@Override protected void processPath(PathData item) throws IOException { out.println("# file: " + item); out.println("# owner: " + item.stat.getOwner()); out.println("# group: " + item.stat.getGroup()); FsPermission perm = item.stat.getPermission(); if (perm.getStickyBit()) { out.println("# flags: --" + (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T")); } final AclStatus aclStatus; final List<AclEntry> entries; if (item.stat.hasAcl()) { aclStatus = item.fs.getAclStatus(item.path); entries = aclStatus.getEntries(); } else { aclStatus = null; entries = Collections.<AclEntry> emptyList(); } ScopedAclEntries scopedEntries = new ScopedAclEntries( AclUtil.getAclFromPermAndEntries(perm, entries)); printAclEntriesForSingleScope(aclStatus, perm, scopedEntries.getAccessEntries()); printAclEntriesForSingleScope(aclStatus, perm, scopedEntries.getDefaultEntries()); out.println(); }
/** * Prints all the ACL entries in a single scope. * @param aclStatus AclStatus for the path * @param fsPerm FsPermission for the path * @param entries List<AclEntry> containing ACL entries of file */ private void printAclEntriesForSingleScope(AclStatus aclStatus, FsPermission fsPerm, List<AclEntry> entries) { if (entries.isEmpty()) { return; } if (AclUtil.isMinimalAcl(entries)) { for (AclEntry entry: entries) { out.println(entry.toStringStable()); } } else { for (AclEntry entry: entries) { printExtendedAclEntry(aclStatus, fsPerm, entry); } } }
@Override public AclStatus getAclStatus(Path path) throws IOException { checkPathIsSlash(path); return new AclStatus.Builder().owner(ugi.getShortUserName()) .group(ugi.getPrimaryGroupName()) .addEntries(AclUtil.getMinimalAcl(PERMISSION_555)) .stickyBit(false).build(); }
src.fs.getAclStatus(src.path).getEntries(); List<AclEntry> srcFullEntries = AclUtil.getAclFromPermAndEntries(perm, srcEntries); target.fs.setAcl(target.path, srcFullEntries);
/** * Creates an AclFeature from the given ACL entries. * * @param accessEntries List<AclEntry> access ACL entries * @param defaultEntries List<AclEntry> default ACL entries * @return AclFeature containing the required ACL entries */ private static AclFeature createAclFeature(List<AclEntry> accessEntries, List<AclEntry> defaultEntries) { // Pre-allocate list size for the explicit entries stored in the feature, // which is all entries minus the 3 entries implicitly stored in the // permission bits. List<AclEntry> featureEntries = Lists.newArrayListWithCapacity( (accessEntries.size() - 3) + defaultEntries.size()); // For the access ACL, the feature only needs to hold the named user and // group entries. For a correctly sorted ACL, these will be in a // predictable range. if (!AclUtil.isMinimalAcl(accessEntries)) { featureEntries.addAll( accessEntries.subList(1, accessEntries.size() - 2)); } // Add all default entries to the feature. featureEntries.addAll(defaultEntries); return new AclFeature(AclEntryStatusFormat.toInt(featureEntries)); }
AclFeature f = inode.getAclFeature(); if (f == null) { return AclUtil.getMinimalAcl(perm); existingAcl.addAll(AclUtil.getMinimalAcl(perm));
/** * Returns the full logical ACL. * * @return List containing full logical ACL */ public List<AclEntry> getAclEntries() { return AclUtil.getAclFromPermAndEntries(getPermission(), aclEntries != null ? aclEntries : Collections.<AclEntry>emptyList()); }
FsPermission perm = inode.getFsPermission(); final FsPermission newPerm; if (!AclUtil.isMinimalAcl(newAcl)) {
@Override public AclStatus getAclStatus(Path path) throws IOException { checkPathIsSlash(path); return new AclStatus.Builder().owner(ugi.getUserName()) .group(ugi.getGroupNames()[0]) .addEntries(AclUtil.getMinimalAcl(PERMISSION_555)) .stickyBit(false).build(); }
/** * Returns the full logical ACL. * * @return List containing full logical ACL */ public List<AclEntry> getAclEntries() { return AclUtil.getAclFromPermAndEntries(getPermission(), aclEntries != null ? aclEntries : Collections.<AclEntry>emptyList()); }
boolean parentDefaultIsMinimal = AclUtil.isMinimalAcl(parentDefaultEntries); for (AclEntry entry: parentDefaultEntries) { AclEntryType type = entry.getType(); if (!AclUtil.isMinimalAcl(accessEntries) || !defaultEntries.isEmpty()) {
@Override public AclStatus getAclStatus(Path path) throws IOException { checkPathIsSlash(path); return new AclStatus.Builder().owner(ugi.getUserName()) .group(ugi.getGroupNames()[0]) .addEntries(AclUtil.getMinimalAcl(PERMISSION_555)) .stickyBit(false).build(); }
/** * Returns the full logical ACL. * * @return List<AclEntry> containing full logical ACL */ public List<AclEntry> getAclEntries() { return AclUtil .getAclFromPermAndEntries(getPermission(), aclEntries != null ? aclEntries : Collections.<AclEntry>emptyList()); }
/** * Prints all the ACL entries in a single scope. * @param aclStatus AclStatus for the path * @param fsPerm FsPermission for the path * @param entries List<AclEntry> containing ACL entries of file */ private void printAclEntriesForSingleScope(AclStatus aclStatus, FsPermission fsPerm, List<AclEntry> entries) { if (entries.isEmpty()) { return; } if (AclUtil.isMinimalAcl(entries)) { for (AclEntry entry: entries) { out.println(entry); } } else { for (AclEntry entry: entries) { printExtendedAclEntry(aclStatus, fsPerm, entry); } } }
@Override public AclStatus getAclStatus(Path path) throws IOException { checkPathIsSlash(path); return new AclStatus.Builder().owner(ugi.getUserName()) .group(ugi.getPrimaryGroupName()) .addEntries(AclUtil.getMinimalAcl(PERMISSION_555)) .stickyBit(false).build(); }
/** * Returns the full logical ACL. * * @return List<AclEntry> containing full logical ACL */ public List<AclEntry> getAclEntries() { return AclUtil .getAclFromPermAndEntries(getPermission(), aclEntries != null ? aclEntries : Collections.<AclEntry>emptyList()); }
/** * Prints all the ACL entries in a single scope. * @param aclStatus AclStatus for the path * @param fsPerm FsPermission for the path * @param entries List<AclEntry> containing ACL entries of file */ private void printAclEntriesForSingleScope(AclStatus aclStatus, FsPermission fsPerm, List<AclEntry> entries) { if (entries.isEmpty()) { return; } if (AclUtil.isMinimalAcl(entries)) { for (AclEntry entry: entries) { out.println(entry); } } else { for (AclEntry entry: entries) { printExtendedAclEntry(aclStatus, fsPerm, entry); } } }
@Override public AclStatus getAclStatus(Path path) throws IOException { checkPathIsSlash(path); return new AclStatus.Builder().owner(ugi.getUserName()) .group(ugi.getGroupNames()[0]) .addEntries(AclUtil.getMinimalAcl(PERMISSION_555)) .stickyBit(false).build(); }
/** * Returns a file's full logical ACL. * * @param fileSystem FileSystem containing the file * @param fileStatus FileStatus of file * @return List containing full logical ACL * @throws IOException if there is an I/O error */ public static List<AclEntry> getAcl(FileSystem fileSystem, FileStatus fileStatus) throws IOException { List<AclEntry> entries = fileSystem.getAclStatus(fileStatus.getPath()) .getEntries(); return AclUtil.getAclFromPermAndEntries(fileStatus.getPermission(), entries); }