dosubot[bot] commented on issue #35594: URL: https://github.com/apache/superset/issues/35594#issuecomment-3395652644
<!-- Answer --> You're correct—`UserRestApi` is not the main handler for user management in Superset 3.1.1. User CRUD actions performed in the frontend (like adding, editing, or deleting users) are always routed to backend Flask AppBuilder views and APIs, such as `SupersetUserApi` and various user model views (e.g., `UserDBModelView`, `UserLDAPModelView`, etc.) [see source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/security/manager.py). This means any backend hooks you set up—like SQLAlchemy event listeners or Flask AppBuilder view hooks—will be triggered by frontend user management actions. If you use SQLAlchemy event listeners for logging, you must open a new SQLAlchemy session for your log writes to avoid transaction errors, but this approach is not officially recommended and can risk deadlocks or data loss if the main transaction fails [see source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/core.py). The upgrade-safe way is to use Flask AppBuilder view hooks (`after_model_change`, etc.), but if you stick with event listeners and a separate session, your logging will still capture all frontend-initiated CRUD actions since they're processed by the backend views. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/cb97b7af-4079-45bb-9723-b89e6c737abc?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu b) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/35594) -- 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]
