private static Set<SQLPrivTypeGrant> getPrivilegesFromFS(
      String userName, FileSystem fs,
      FileStatus fileStatus, boolean recurse) throws Exception {
    Set<SQLPrivTypeGrant> privs = new HashSet<SQLPrivTypeGrant>();
    LOG.info("Checking fs privileges of user {} for {} {} ",
        userName, fileStatus.toString(), (recurse? "recursively":"without recursion"));
    if (FileUtils.isOwnerOfFileHierarchy(fs, fileStatus, userName, recurse)) {
      privs.add(SQLPrivTypeGrant.OWNER_PRIV);
    }
    UserGroupInformation proxyUser = null;
    try {
      proxyUser = FileUtils.getProxyUser(userName);
      FileSystem fsAsUser = FileUtils.getFsAsUser(fs, proxyUser);
      if (FileUtils.isActionPermittedForFileHierarchy(fs, fileStatus, userName, FsAction.WRITE, recurse, fsAsUser)) {
        privs.add(SQLPrivTypeGrant.INSERT_NOGRANT);
        privs.add(SQLPrivTypeGrant.DELETE_NOGRANT);
      }
      if (FileUtils.isActionPermittedForFileHierarchy(fs, fileStatus, userName, FsAction.READ, recurse, fsAsUser)) {
        privs.add(SQLPrivTypeGrant.SELECT_NOGRANT);
      }
    }
    finally {
      FileUtils.closeFs(proxyUser);
    }
    LOG.debug("addPrivilegesFromFS:[{}] asked for privileges on [{}] with recurse={} and obtained:[{}]",
        userName, fileStatus, recurse, privs);
    return privs;
  }
Map permissions for this uri to SQL Standard privileges
@param filePath
@param conf
@param userName
@return
@throws HiveAuthzPluginException
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLAuthorizationUtils.java