public static boolean runDistCpAs(List<Path> srcPaths, Path dst, Configuration conf,
                                    String doAsUser) throws IOException {
    UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(
        doAsUser, UserGroupInformation.getLoginUser());
    try {
      return proxyUser.doAs(new PrivilegedExceptionAction<Boolean>() {
        @Override
        public Boolean run() throws Exception {
          return runDistCp(srcPaths, dst, conf);
        }
      });
    } catch (InterruptedException e) {
      throw new IOException(e);
    }
  }
Check the permissions on a file
@param fs Filesystem the file is contained in
@param stat Stat info for the file
@param action action to be performed
@param ugi user group info for the current user.  This is passed in so that tests can pass
           in mock ones.
@throws IOException If thrown by Hadoop
@throws AccessControlException if the file cannot be accessed
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/HdfsUtils.java