FrancescoCastaldi opened a new pull request, #45036: URL: https://github.com/apache/superset/pull/45036
### SUMMARY Fixes #45023. When using a custom User model extended from Flask-AppBuilder, MCP chart creation and dashboard copy operations failed due to static references to User in SQLAlchemy event listeners and query filters, causing FlushError and unmapped table errors. This change: 1. Registers dashboard copy event listeners dynamically using security_manager.user_model. 2. Isolates the database session in copy_dashboard to prevent SQLAlchemy FlushError when cloning dashboards with extended user relationships. 3. Updates ExcludeUsersFilter in superset/security/manager.py to resolve username columns dynamically from security_manager.user_model. ### TESTING INSTRUCTIONS Run the dashboard unit tests: pytest tests/unit_tests/models/dashboard_test.py All tests pass, including unit tests verifying copy operations with custom extended user models. ### ADDITIONAL INFORMATION - [x] Has associated issue: fixes #45023 - [x] Changes UI: No - [x] Requires DB Migration: No -- 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]
