-
Notifications
You must be signed in to change notification settings - Fork 38
fix(membership): Removing a user from the org should cleanup resources #2240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to do anything about invitations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
including the group ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are part of the same table just with an additional context but are managed in the same way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
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.