Update a user's user_group_member_roles when group membership is updated
What does this MR do and why?
Update a user's user_group_member_roles when either member_role_id or access_level value of their group membership is updated.
References
Implements part of Create user_group_member_roles when group membe... (#515215 - closed).
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Start GDK in SAAS mode
$ GITLAB_SIMULATE_SAAS=1 gdk start - Enable feature flag
$ rails c > Feature.enable(:cache_user_group_member_roles) - Login with
root, go to a group thatrootowns (e.g. http://localhost:9393/groups/flightjs), then create two new member roles in http://localhost:9393/groups/flightjs/-/settings/roles_and_permissions page - Add a new member to the group and assign them the first member role
- In Rails console, verify that a new
Authz::UserGroupMemberRoleis created for the invited user$ rails c > Authz::UserGroupMemberRole.last => #<Authz::UserGroupMemberRole ... member_role_id: <id_of_first_member_role>, > - Update the membership of the user: change the member role to the other member role
- In Rails console, verify that the
Authz::UserGroupMemberRolerecord of the user is updated:member_role_idis now that of the second member role$ rails c > Authz::UserGroupMemberRole.last => #<Authz::UserGroupMemberRole ... member_role_id: <id_of_second_member_role>, >
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