You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "betodealmeida (via GitHub)" <gi...@apache.org> on 2024/11/06 17:34:55 UTC
Re: [PR] fix(chart data): removing query from /chart/data payload when accessing as guest user [superset]
betodealmeida commented on code in PR #30858:
URL: https://github.com/apache/superset/pull/30858#discussion_r1831455027
##########
superset/charts/data/api.py:
##########
@@ -394,8 +394,13 @@ def _process_data(query_data: Any) -> Any:
)
if result_format == ChartDataResultFormat.JSON:
+ queries = result["queries"]
+ if security_manager.is_guest_user():
+ for query in queries:
+ with contextlib.suppress(KeyError):
+ del query["query"]
Review Comment:
This works too, `contextlib.supress` seems like using a canon to kill a fly. :)
```suggestion
query.pop("query", None)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org