/** The same as getGroupName(Snapshot.CURRENT_STATE_ID). */ @Override public final String getGroupName() { return getGroupName(Snapshot.CURRENT_STATE_ID); }
@Override public final String getGroupName(int snapshotId) { return referred.getGroupName(snapshotId); }
/** * Add the node to the children list at the given insertion point. * The basic add method which actually calls children.add(..). */ private void addChild(final INode node, final int insertionPoint) { if (children == null) { children = new ArrayList<>(DEFAULT_FILES_PER_DIRECTORY); } node.setParent(this); children.add(-insertionPoint - 1, node); if (node.getGroupName() == null) { node.setGroup(getGroupName()); } }
/** The same as getGroupName(Snapshot.CURRENT_STATE_ID). */ @Override public final String getGroupName() { return getGroupName(Snapshot.CURRENT_STATE_ID); }
@Override public final String getGroupName(int snapshotId) { return referred.getGroupName(snapshotId); }
@Override public final String getGroupName(int snapshotId) { return referred.getGroupName(snapshotId); }
/** The same as getGroupName(Snapshot.CURRENT_STATE_ID). */ @Override public final String getGroupName() { return getGroupName(Snapshot.CURRENT_STATE_ID); }
inode.getFsPermission(snapshot), inode.getUserName(snapshot), inode.getGroupName(snapshot), symlink, new Path(iip.getPath()));
private static final void logAuditEvent(UserGroupInformation ugi, InetAddress addr, String cmd, String src, String dst, INode node) { final StringBuilder builder = auditStringBuilder.get(); builder.setLength(0); builder.append("ugi=").append(ugi).append("\t"). append("ip=").append(addr).append("\t"). append("cmd=").append(cmd).append("\t"). append("src=").append(src).append("\t"). append("dst=").append(dst).append("\t"). append("perm="); if (node == null) { builder.append("null"); } else { builder.append(node.getUserName() + ':' + node.getGroupName() + ':' + node.getFsPermission()); } auditLog.info(builder.toString()); }
/** * Add the node to the children list at the given insertion point. * The basic add method which actually calls children.add(..). */ private void addChild(final INode node, final int insertionPoint) { if (children == null) { children = new ArrayList<INode>(DEFAULT_FILES_PER_DIRECTORY); } node.setParent(this); children.add(-insertionPoint - 1, node); if (node.getGroupName() == null) { node.setGroup(getGroupName()); } }
/** * Add the node to the children list at the given insertion point. * The basic add method which actually calls children.add(..). */ private void addChild(final INode node, final int insertionPoint) { if (children == null) { children = new ArrayList<INode>(DEFAULT_FILES_PER_DIRECTORY); } node.setParent(this); children.add(-insertionPoint - 1, node); if (node.getGroupName() == null) { node.setGroup(getGroupName()); } }
static AclStatus getAclStatus( FSDirectory fsd, FSPermissionChecker pc, String src) throws IOException { checkAclsConfigFlag(fsd); fsd.readLock(); try { INodesInPath iip = fsd.resolvePath(pc, src, DirOp.READ); // There is no real inode for the path ending in ".snapshot", so return a // non-null, unpopulated AclStatus. This is similar to getFileInfo. if (iip.isDotSnapshotDir() && fsd.getINode4DotSnapshot(iip) != null) { return new AclStatus.Builder().owner("").group("").build(); } INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getPathSnapshotId(); List<AclEntry> acl = AclStorage.readINodeAcl(fsd.getAttributes(iip)); FsPermission fsPermission = inode.getFsPermission(snapshotId); return new AclStatus.Builder() .owner(inode.getUserName()).group(inode.getGroupName()) .stickyBit(fsPermission.getStickyBit()) .setPermission(fsPermission) .addEntries(acl).build(); } catch (AclException e){ throw new AclException(e.getMessage() + " Path: " + src, e); } finally { fsd.readUnlock(); } }
/** Get the {@link PermissionStatus} */ protected PermissionStatus getPermissionStatus() { return new PermissionStatus(getUserName(),getGroupName(),getFsPermission()); } private synchronized void updatePermissionStatus(
/** Get the {@link PermissionStatus} */ protected PermissionStatus getPermissionStatus() { return new PermissionStatus(getUserName(),getGroupName(),getFsPermission()); } private synchronized void updatePermissionStatus(
private void check(INode inode, FsAction access ) throws AccessControlException { if (inode == null) { return; } FsPermission mode = inode.getFsPermission(); if (user.equals(inode.getUserName())) { //user class if (mode.getUserAction().implies(access)) { return; } } else if (groups.contains(inode.getGroupName())) { //group class if (mode.getGroupAction().implies(access)) { return; } } else { //other class if (mode.getOtherAction().implies(access)) { return; } } throw new AccessControlException("Permission denied: user=" + user + ", access=" + access + ", inode=" + inode); } }
private void check(INode inode, FsAction access ) throws AccessControlException { if (inode == null) { return; } FsPermission mode = inode.getFsPermission(); if (user.equals(inode.getUserName())) { //user class if (mode.getUserAction().implies(access)) { return; } } else if (groups.contains(inode.getGroupName())) { //group class if (mode.getGroupAction().implies(access)) { return; } } else { //other class if (mode.getOtherAction().implies(access)) { return; } } throw new AccessControlException("Permission denied: user=" + user + ", access=" + access + ", inode=" + inode); } }
private void check(INode inode, FsAction access ) throws AccessControlException { if (inode == null) { return; } FsPermission mode = inode.getFsPermission(); if (user.equals(inode.getUserName())) { //user class if (mode.getUserAction().implies(access)) { return; } } else if (groups.contains(inode.getGroupName())) { //group class if (mode.getGroupAction().implies(access)) { return; } } else { //other class if (mode.getOtherAction().implies(access)) { return; } } throw new AccessControlException("Permission denied: user=" + user + ", access=" + access + ", inode=" + inode); } }
/** * Create HdfsFileStatus by file INode */ static FileStatus createFileStatus(String path, INode node) { // length is zero for directories return new FileStatus(node.isDirectory() ? 0 : node.computeContentSummary().getLength(), node.isDirectory(), node.isDirectory() ? 0 : ((INodeFile)node).getReplication(), node.isDirectory() ? 0 : ((INodeFile)node).getPreferredBlockSize(), node.getModificationTime(), node.getAccessTime(), node.getFsPermission(), node.getUserName(), node.getGroupName(), new Path(path)); }
/** * Create FileStatus by file INode */ private static FileStatus createFileStatus(String path, INode node) { // length is zero for directories return new FileStatus(node.isDirectory() ? 0 : node.computeContentSummary().getLength(), node.isDirectory(), node.isDirectory() ? 0 : ((INodeFile)node).getReplication(), node.isDirectory() ? 0 : ((INodeFile)node).getPreferredBlockSize(), node.getModificationTime(), node.getAccessTime(), node.getFsPermission(), node.getUserName(), node.getGroupName(), new Path(path)); } }
static AclStatus getAclStatus( FSDirectory fsd, String src) throws IOException { checkAclsConfigFlag(fsd); FSPermissionChecker pc = fsd.getPermissionChecker(); fsd.readLock(); try { INodesInPath iip = fsd.resolvePath(pc, src); src = iip.getPath(); // There is no real inode for the path ending in ".snapshot", so return a // non-null, unpopulated AclStatus. This is similar to getFileInfo. if (iip.isDotSnapshotDir() && fsd.getINode4DotSnapshot(iip) != null) { return new AclStatus.Builder().owner("").group("").build(); } if (fsd.isPermissionEnabled()) { fsd.checkTraverse(pc, iip); } INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getPathSnapshotId(); List<AclEntry> acl = AclStorage.readINodeAcl(fsd.getAttributes(src, inode.getLocalNameBytes(), inode, snapshotId)); FsPermission fsPermission = inode.getFsPermission(snapshotId); return new AclStatus.Builder() .owner(inode.getUserName()).group(inode.getGroupName()) .stickyBit(fsPermission.getStickyBit()) .setPermission(fsPermission) .addEntries(acl).build(); } finally { fsd.readUnlock(); } }