fix(membership): Removing a user from the org should cleanup resources#2240
Conversation
|
Just from top of my mind, would it be easier and more localized to extend and in there make sure we delete not only that membership but all the related memberships + the group memberships? all of that from there? |
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Yes, that's why I marked as WIP and draft because I was trying to check where else we were cleaning up resources. It is not all centralized in a single place. |
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
| now := time.Now() | ||
|
|
||
| // Soft delete all group memberships for this user in this organization | ||
| if _, err := tx.GroupMembership.Update().Where( |
There was a problem hiding this comment.
do we need to do anything about invitations?
There was a problem hiding this comment.
Hmm I don't think so because you can only remove members that are already part of the organization meaning the invitation would be redeemed no?
There was a problem hiding this comment.
They are part of the same table just with an additional context but are managed in the same way
This patch updates the membership repository’s delete logic to also clean up related resources linked to the user being removed. Additionally, it ensures the user is removed from all groups they belong to.