Destroy user_project_member_roles when user is removed from a group
Context
We create user_project_member_roles records for a user when they are assigned a member role in a project through project sharing.
-
User Uis added toGroup A -
Group Ais invited toProject Pand assigned a member roleMR - A
user_project_member_rolesrecord is created forUser U:{ user: User U, project: Project P, shared_with_group: Group A, member_role: MR }
What does this MR do and why?
This MR updates DestroyForGroupService to also destroy a user's user_project_member_roles records for all projects that have been shared with the group (shared_with_group_id: <membership.source_id>.
DB changes
ids = Authz::UserProjectMemberRole.for_user_shared_with_group(...).ids
EXPLAIN: https://console.postgres.ai/shared/0bab7fbe-eecf-42b9-bb71-c39474b8b97d
::Authz::UserProjectMemberRole.delete_all_with_id(ids)
EXPLAIN: https://console.postgres.ai/shared/2b1035c4-dc35-4f79-bdc0-662f513fda43
References
Destroy user_project_member_roles when user is ... (#572455 - closed)
Screenshots or screen recordings
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Eugie Limpin