codeant-ai-for-open-source[bot] commented on code in PR #45535:
URL: https://github.com/apache/superset/pull/45535#discussion_r4329395666
##########
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:
**Suggestion:** For non-admin users, `can_access_chart` lazily loads each
chart’s editors and viewers, adding up to two database queries per chart when
generating a dashboard.
**Assessment:** 🟠 `Major` · 🔁 `Occurrence: Often` · 🏷️ `Performance`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cee6148bf0bf46148b1a549e372c2e3d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=cee6148bf0bf46148b1a549e372c2e3d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/mcp_service/dashboard/tool/generate_dashboard.py
**Line:** 272:272
**Comment:**
*Performance: For non-admin users, `can_access_chart` lazily loads each
chart’s editors and viewers, adding up to two database queries per chart when
generating a dashboard.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45535&comment_hash=468e9a61b6fc712f6334395efb2484d1b15db2364fb8ee407cf1013e676287d0&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45535&comment_hash=468e9a61b6fc712f6334395efb2484d1b15db2364fb8ee407cf1013e676287d0&reaction=dislike'>👎</a>
--
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]