/** * Reads the existing extended ACL entries of an INodeAttribute object. * * @param inodeAttr INode to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INodeAttributes inodeAttr) { AclFeature f = inodeAttr.getAclFeature(); return getEntriesFromAclFeature(f); }
/** * Reads the existing extended ACL entries of an inode. This method returns * only the extended ACL entries stored in the AclFeature. If the inode does * not have an ACL, then this method returns an empty list. This method * supports querying by snapshot ID. * * @param inode INode to read * @param snapshotId int ID of snapshot to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INode inode, int snapshotId) { AclFeature f = inode.getAclFeature(snapshotId); return getEntriesFromAclFeature(f); }
List<AclEntry> featureEntries = AclStorage.getEntriesFromAclFeature(f); if (featureEntries.get(0).getScope() == AclEntryScope.ACCESS) {
List<AclEntry> featureEntries = getEntriesFromAclFeature(f); ScopedAclEntries scoped = new ScopedAclEntries(featureEntries); List<AclEntry> accessEntries = scoped.getAccessEntries();
List<AclEntry> featureEntries = getEntriesFromAclFeature(parent .getAclFeature()); ScopedAclEntries scopedEntries = new ScopedAclEntries(featureEntries);
/** * Reads the existing extended ACL entries of an INodeAttribute object. * * @param inodeAttr INode to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INodeAttributes inodeAttr) { AclFeature f = inodeAttr.getAclFeature(); return getEntriesFromAclFeature(f); }
/** * Reads the existing extended ACL entries of an INodeAttribute object. * * @param inodeAttr INode to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INodeAttributes inodeAttr) { AclFeature f = inodeAttr.getAclFeature(); return getEntriesFromAclFeature(f); }
/** * Reads the existing extended ACL entries of an inode. This method returns * only the extended ACL entries stored in the AclFeature. If the inode does * not have an ACL, then this method returns an empty list. This method * supports querying by snapshot ID. * * @param inode INode to read * @param snapshotId int ID of snapshot to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INode inode, int snapshotId) { AclFeature f = inode.getAclFeature(snapshotId); return getEntriesFromAclFeature(f); }
/** * Reads the existing extended ACL entries of an inode. This method returns * only the extended ACL entries stored in the AclFeature. If the inode does * not have an ACL, then this method returns an empty list. This method * supports querying by snapshot ID. * * @param inode INode to read * @param snapshotId int ID of snapshot to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INode inode, int snapshotId) { AclFeature f = inode.getAclFeature(snapshotId); return getEntriesFromAclFeature(f); }
private static void unprotectedRemoveAcl(FSDirectory fsd, INodesInPath iip) throws IOException { assert fsd.hasWriteLock(); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); AclFeature f = inode.getAclFeature(); if (f == null) { return; } FsPermission perm = inode.getFsPermission(); List<AclEntry> featureEntries = AclStorage.getEntriesFromAclFeature(f); if (featureEntries.get(0).getScope() == AclEntryScope.ACCESS) { // Restore group permissions from the feature's entry to permission // bits, overwriting the mask, which is not part of a minimal ACL. AclEntry groupEntryKey = new AclEntry.Builder() .setScope(AclEntryScope.ACCESS).setType(AclEntryType.GROUP).build(); int groupEntryIndex = Collections.binarySearch( featureEntries, groupEntryKey, AclTransformation.ACL_ENTRY_COMPARATOR); assert groupEntryIndex >= 0; FsAction groupPerm = featureEntries.get(groupEntryIndex).getPermission(); FsPermission newPerm = new FsPermission(perm.getUserAction(), groupPerm, perm.getOtherAction(), perm.getStickyBit()); inode.setPermission(newPerm, snapshotId); } inode.removeAclFeature(snapshotId); } }
private static void unprotectedRemoveAcl(FSDirectory fsd, INodesInPath iip) throws IOException { assert fsd.hasWriteLock(); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); AclFeature f = inode.getAclFeature(); if (f == null) { return; } FsPermission perm = inode.getFsPermission(); List<AclEntry> featureEntries = AclStorage.getEntriesFromAclFeature(f); if (featureEntries.get(0).getScope() == AclEntryScope.ACCESS) { // Restore group permissions from the feature's entry to permission // bits, overwriting the mask, which is not part of a minimal ACL. AclEntry groupEntryKey = new AclEntry.Builder() .setScope(AclEntryScope.ACCESS).setType(AclEntryType.GROUP).build(); int groupEntryIndex = Collections.binarySearch( featureEntries, groupEntryKey, AclTransformation.ACL_ENTRY_COMPARATOR); assert groupEntryIndex >= 0; FsAction groupPerm = featureEntries.get(groupEntryIndex).getPermission(); FsPermission newPerm = new FsPermission(perm.getUserAction(), groupPerm, perm.getOtherAction(), perm.getStickyBit()); inode.setPermission(newPerm, snapshotId); } inode.removeAclFeature(snapshotId); } }
/** * Asserts whether or not the inode for a specific path has an AclFeature. * * @param pathToCheck Path inode to check * @param expectAclFeature boolean true if an AclFeature must be present, * false if an AclFeature must not be present * @throws IOException thrown if there is an I/O error */ private static void assertAclFeature(Path pathToCheck, boolean expectAclFeature) throws IOException { AclFeature aclFeature = getAclFeature(pathToCheck, cluster); if (expectAclFeature) { assertNotNull(aclFeature); // Intentionally capturing a reference to the entries, not using nested // calls. This way, we get compile-time enforcement that the entries are // stored in an ImmutableList. ImmutableList<AclEntry> entries = AclStorage .getEntriesFromAclFeature(aclFeature); assertFalse(entries.isEmpty()); } else { assertNull(aclFeature); } }
List<AclEntry> featureEntries = getEntriesFromAclFeature(f); ScopedAclEntries scoped = new ScopedAclEntries(featureEntries); List<AclEntry> accessEntries = scoped.getAccessEntries();
List<AclEntry> featureEntries = getEntriesFromAclFeature(f); ScopedAclEntries scoped = new ScopedAclEntries(featureEntries); List<AclEntry> accessEntries = scoped.getAccessEntries();
List<AclEntry> featureEntries = getEntriesFromAclFeature(parent .getAclFeature()); ScopedAclEntries scopedEntries = new ScopedAclEntries(featureEntries);
List<AclEntry> featureEntries = getEntriesFromAclFeature(parent .getAclFeature()); ScopedAclEntries scopedEntries = new ScopedAclEntries(featureEntries);