
So far, enforcing authentication for query operators which require it was done by matching an error message. Problem with this approach is, if the query operator is invalid (as, for example, "has:starss") this invalidates the web session for the logged in user. Create a new exception QueryRequiresAuthException to explicitly handle the case where an operator requires authentication and throw this when needed instead of the generic QueryParseException. Bug: issue 6657 Change-Id: I93096ec3b0918f8238cf2eeef96cf2cf42410e72
36 lines
959 B
Python
36 lines
959 B
Python
load("//tools/bzl:genrule2.bzl", "genrule2")
|
|
|
|
java_library(
|
|
name = "query_exception",
|
|
srcs = [
|
|
"src/main/java/com/google/gerrit/server/query/QueryParseException.java",
|
|
"src/main/java/com/google/gerrit/server/query/QueryRequiresAuthException.java",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
genrule2(
|
|
name = "query_antlr",
|
|
srcs = ["src/main/antlr3/com/google/gerrit/server/query/Query.g"],
|
|
outs = ["query_antlr.srcjar"],
|
|
cmd = " && ".join([
|
|
"$(location //lib/antlr:antlr-tool) -o $$TMP $<",
|
|
"cd $$TMP",
|
|
"$$ROOT/$(location @bazel_tools//tools/zip:zipper) cC $$ROOT/$@ $$(find *)",
|
|
]),
|
|
tools = [
|
|
"//lib/antlr:antlr-tool",
|
|
"@bazel_tools//tools/zip:zipper",
|
|
],
|
|
)
|
|
|
|
java_library(
|
|
name = "query_parser",
|
|
srcs = [":query_antlr"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":query_exception",
|
|
"//lib/antlr:java_runtime",
|
|
],
|
|
)
|