dosubot[bot] commented on issue #32872:
URL: https://github.com/apache/superset/issues/32872#issuecomment-2756159933

   <!-- Greeting -->
   Hey, @lohart13! 👋 I'm here to help you with any bugs, questions, or 
contributions. Let's tackle this together!
   
   <!-- Answer -->
   I found a similar closed issue related to custom security managers in 
Superset, which might be relevant to your problem. The issue is titled "Custom 
SecurityManager SAWarning: Usage of the 'Session.add()' operation is not 
currently supported within the execution stage of the flush process" and can be 
found [here](https://github.com/apache/superset/issues/21057). However, no 
solution was found in the comments of that issue 
<sup>[[1]](https://github.com/apache/superset/issues/21057)</sup>.
   
   In your case, the proposed fix involves modifying the `find_roles_by_id` 
method to use `self.role_model` instead of the default `Role` model. This 
change ensures that the correct role model is used during the update process, 
preventing the `FlushError` that occurs when the system attempts to flush an 
instance of the wrong role type. The suggested code modification is:
   
   ```python
   def find_roles_by_id(self, role_ids: list[int]) -> list[Role]:
       query = 
self.get_session.query(self.role_model).filter(self.role_model.id.in_(role_ids))
       return query.all()
   ```
   
   This adjustment should help resolve the issue you're encountering with the 
dashboard update process when using a custom role model.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/4d56bef0-cf5b-44a8-8c1b-45968a23a647?feedback_type=other)</sup>
   


-- 
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]

Reply via email to