Skip to content

Owner changes their own role to User

Background

In #441246 (closed) we made it so organization owners can change the role of organization users. This includes being able to change their own role if there is another owner in the organization. But only organization owners can see the organization user dashboard so if you change your own role from Owner to User you are then get a 404.

Screen_Recording_2024-11-12_at_8.50.22_AM

Proposal

Move changing role into a drawer similar to what we do on group/project member pages

Changing role has no affect on your access to page Changing role will cause loss of access to page
change-organization-role change-organization-role-warning

Implementation guide

  1. Add a new user_details_drawer.vue component to app/assets/javascripts/organizations/users/components
  2. user_details_drawer.vue should accept a user prop. If this prop is not null set the open prop to true
  3. user_details_drawer.vue emits a close event when closed.
  4. Render app/assets/javascripts/vue_shared/components/users_table/user_avatar.vue in user_details_drawer.vue
  5. Move role change logic in app/assets/javascripts/organizations/users/components/users_view.vue to user_details_drawer.vue
  6. Show warning if an Owner is changing their role to User
  7. Render user_details_drawer.vue in app/assets/javascripts/organizations/users/components/users_view.vue
  8. When role is clicked keep track of what user was clicked in a userDetailsDrawerActiveUser reactive data attribute.
  9. Pass userDetailsDrawerActiveUser to user_details_drawer.vue as user prop
  10. Listen for close event on drawer and set userDetailsDrawerActiveUser to null
Edited by Peter Hegman