LeandroMartinMacato opened a new issue, #35594:
URL: https://github.com/apache/superset/issues/35594

   Hello we have a fork using Superset version 3.1.1, we tried creating a 
custom `DbEventLogger` and was able to put custom code in actions but there is 
no trigger for User Management actions (Ex: Add user , edit User etc..)
   
   we are planning to make User Management Security Auditing for (CRUD) 
operations, would appreciate help on how we could make logging actions on user 
management
   
   thank you!
   
   ```python
   # Inside `superset_config.py`
   
   class CustomUserEventLogger(DBEventLogger):
       def log(self, user_id, action, *args, **kwargs):
           print(f"USER: {user_id} >>>>>>>> PERFORMED : {action} 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
           # You can add custom logic here to filter for user management actions
           if action in ["user_create", "user_update", "user_delete"]:
               # Add your custom logging logic here
               print(f"User management action: {action}, user_id: {user_id}, 
details: {kwargs}")
           # Call the parent logger to keep default behavior
           super().log(user_id, action, *args, **kwargs)
   
   EVENT_LOGGER = CustomUserEventLogger()
   ```
   
   _Originally posted by @LeandroMartinMacato in 
https://github.com/apache/superset/discussions/33538#discussioncomment-14642292_


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