public static boolean isActionPermittedForFileHierarchy(FileSystem fs, FileStatus fileStatus,
      String userName, FsAction action, boolean recurse) throws Exception {
    UserGroupInformation proxyUser = null;
    boolean isPermitted;
    try {
      proxyUser = getProxyUser(userName);
      FileSystem fsAsUser = getFsAsUser(fs, proxyUser);
      isPermitted = isActionPermittedForFileHierarchy(fs, fileStatus, userName, action, recurse, fsAsUser);
    } finally {
      closeFs(proxyUser);
    }
    return isPermitted;
  }
Check if user userName has permissions to perform the given FsAction action
on all files under the file whose FileStatus fileStatus is provided

@param fs
@param fileStatus
@param userName
@param action
@return
@throws IOException
common/src/java/org/apache/hadoop/hive/common/FileUtils.java