Index: dashboard/dashboard/debug_alert.py |
diff --git a/dashboard/dashboard/debug_alert.py b/dashboard/dashboard/debug_alert.py |
index be01cd98a28351ebe0c6ce79f84d04ffc6f53781..c6d15a88284aade83179861ff02a292949e164e4 100644 |
--- a/dashboard/dashboard/debug_alert.py |
+++ b/dashboard/dashboard/debug_alert.py |
@@ -7,6 +7,7 @@ |
import json |
import urllib |
+from dashboard import datastore_hooks |
from dashboard import find_anomalies |
from dashboard import find_change_points |
from dashboard import request_handler |
@@ -53,7 +54,7 @@ class DebugAlertHandler(request_handler.RequestHandler): |
if revision: |
rows = _FetchRowsAroundRev(test.key, int(revision), num_before, num_after) |
else: |
- rows = _FetchLatestRows(test.key, num_before) |
+ rows = _FetchLatestRows(test, num_before) |
chart_series = _ChartSeries(rows) |
lookup = _RevisionList(rows) |
@@ -236,7 +237,7 @@ def _RevisionList(rows): |
return [r.revision for r in rows] |
-def _FetchLatestRows(test_key, num_points): |
+def _FetchLatestRows(test, num_points): |
"""Does a query for the latest Row entities in the given test. |
Args: |
@@ -247,8 +248,10 @@ def _FetchLatestRows(test_key, num_points): |
A list of Row entities, ordered by revision. The number to fetch is limited |
to the number that is expected to be processed at once by GASP. |
""" |
+ assert(utils.IsInternalUser() or not test.internal_only) |
+ datastore_hooks.SetSinglePrivilegedRequest() |
q = graph_data.Row.query(projection=['revision', 'value']) |
- q = q.filter(graph_data.Row.parent_test == test_key) |
+ q = q.filter(graph_data.Row.parent_test == test.key) |
q = q.order(-graph_data.Row.revision) |
rows = list(reversed(q.fetch(limit=num_points))) |
return rows |