Skip to content

Commit

Permalink
[HWKMETRICS-460] Allow rate queries for read-only users
Browse files Browse the repository at this point in the history
The POST endpoint /counters/rate/query is used to read data, it should be authorized for read-only users (similar to /counters/raw/query)

(cherry picked from commit 7082fac)
Signed-off-by: Stefan Negrea <snegrea@redhat.com>
  • Loading branch information
Stefan Negrea committed Aug 18, 2016
1 parent 3e89de2 commit 2ebacb3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ private boolean isQuery(HttpServerExchange serverExchange) {

// Note the path will be something like /foo/bar/baz and the first element will be "", we need to check 2 & 3
String[] paths = serverExchange.getRelativePath().split("/");
if (paths.length >= 4 && (paths[2].equals("raw") || paths[2].equals("stats")) && paths[3].equals("query")) {
if (paths.length >= 4 && (paths[2].equals("raw") || paths[2].equals("stats") || paths[2].equals("rate")) &&
paths[3].equals("query")) {
return true;
} else {
return false;
Expand Down

0 comments on commit 2ebacb3

Please sign in to comment.