public static boolean hasAccess(String remoteUser, String user,
      ServletContext ctx, HttpServletRequest request) throws IOException {
    return StringUtils.equalsIgnoreCase(remoteUser, user) ||
        HttpServer.hasAdministratorAccess(ctx, request, null);
  }
Check if the remote user has access to an object (e.g. query history) that belongs to a user

@param ctx the context containing the admin ACL.
@param request the HTTP request.
@param remoteUser the user that sent out the request.
@param user the user of the object being checked against.
@return true if the remote user is the same as the user or has the admin access
@throws IOException
common/src/java/org/apache/hive/http/HttpServer.java