goauthentik / authentik

The authentication glue you need.

Home Page:https://goauthentik.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide the deleted model state in the event context

local-it-dev opened this issue · comments

Is your feature request related to a problem? Please describe.
Related: #4298 (reply in thread)
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.