goauthentik / goauthentik/authentik
Provide the deleted model state in the event context
- Dominant language
- Python
- Stars
- 25.6k
- Forks
- 2k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 651
Description
**Is your feature request related to a problem? Please describe.**
Related: https://github.com/goauthentik/authentik/discussions/4298#discussioncomment-9817112
When deleting a model (user/group etc) only the model `Name` and the `pk` is provided. I would like to use event policies to automate things like user and group deletion from the connected Applications. For these processes I need more information about the model, like username, hashed id and mail address. As the model is already deleted I can't access these information using the `pk`.
**Describe the solution you'd like**
My solution is to provide the model state information in each `model_deleted` event. This would allow many possibilities for automating deletions.
This could be implemented by adding a `model_state` field that contains the sanitized model dict or it could be implemented as `diff` similar to `model_created` events. In this case the `previous_value` would be the current model state and the `new_value` would be empty.
Contributor guide
Research direction
No files, tests, or entry points are named. Start by locating where model_deleted events are built and compare how model_created event diffs are represented; done means deletion events expose sanitized pre-deletion model state for event policies without leaking sensitive data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authentication, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100