mikebridge commented on code in PR #45535:
URL: https://github.com/apache/superset/pull/45535#discussion_r4330928505
##########
superset/mcp_service/dashboard/tool/generate_dashboard.py:
##########
@@ -262,13 +262,19 @@ def generate_dashboard( # noqa: C901
),
)
- # Validate dataset access for each chart.
+ # Validate dataset access as well as chart visibility.
# check_chart_data_access is the centralized data-level
# permission check that complements the class-level RBAC
# enforced by mcp_auth_hook.
from superset.mcp_service.auth import check_chart_data_access
for chart in chart_objects:
+ if not security_manager.can_access_chart(chart):
Review Comment:
Fixed in ba71a24daa. `generate_dashboard` now loads each chart's `editors`
and `viewers` in the same bounded query that fetches the charts
(`selectinload`), so the per-chart access check no longer issues lazy
relationship queries.
A new test counts the relationship SELECTs using real mapped tables: with 5
charts, an editor went from 5 to at most 2, and an explicit viewer, or a user
denied only on the last chart, went from 10 to at most 2. The access decisions
themselves are unchanged.
`add_chart_to_existing_dashboard` checks a single chart once, so eager
loading wouldn't reduce queries there; it's left as is.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]