Skip to content

Commit 72c8d3c

Browse files
FedericoCerattoFederico Ceratto
authored and
Federico Ceratto
committed
Hide incident email to non-admins
1 parent dd0e77c commit 72c8d3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/ooniapi/incidents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def search_list_incidents() -> Response:
9696
rows = list(q)
9797
for r in rows:
9898
r["published"] = bool(r["published"])
99+
if account_id is None or get_client_role() != "admin":
100+
r["email_address"] = None # hide email
99101
return nocachejson(incidents=rows, v=1)
100102
except BaseOONIException as e:
101103
return jerror(e)
@@ -140,6 +142,8 @@ def show_incident(incident_id: str) -> Response:
140142
return jerror("Not found")
141143
inc = q[0]
142144
inc["published"] = bool(inc["published"])
145+
if account_id is None or get_client_role() != "admin":
146+
inc["email_address"] = None # hide email
143147
# TODO: cache if possible
144148
return nocachejson(incident=inc, v=1)
145149
except BaseOONIException as e:

0 commit comments

Comments
 (0)