Skip to content
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

4819 manage super user roles #5047

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Benjamin-Couey
Copy link
Contributor

Resolves #4819

Description

This PR updates app/views/users/_organization_user.html.erb to show organization admins options to promote and demote other members of the organization, regardless of whether those other members are super admins. The OrganizationsController and role services were already set up to allow an org admin to promote or demote super admins, so this was the only necessary change.

This PR also updates app/views/admin/users/_roles.html.erb to avoid encountering a NoMethodError when attempting to edit a super admin. Again, the Admin::UsersController and role services correctly handled a super admin managing the org roles of another super admin.

Lastly, this PR updates _organization_user.html.erb so that super admins will always be shown an 'edit' button that takes them to the super admin facing user edit page for the sake of consistency. Previously super admins were shown this edit button in place of the 'promote user' button, but still were shown the 'demote user' button.

Regarding the potential connection to the issue #4503, while a PR for 4503 might end up modifying some of the same files, resolving issue 4819 doesn't seem to rely on resolving 4503 and vice versa. As such, this PR will made while I am still working on 4503.

Type of change

  • Bug fix

How Has This Been Tested?

This was manually tested as an org admin and a super admin, verifying that both were able to manage the org roles of both normal users and super admins.

Tests were added to spec/requests/organization_requests_spec.rb to verify the promote user, demote user, and remove user actions provided by the OrganizationsController worked on users and super admins. A check that was erroneously aimed at a path handled by the Admin::OrganizationsController was also moved to the more appropriate spec/requests/admin/organizations_requests_spec.rb.

Tests were added to spec/requests/admin/users_requests_spec.rb to verify that the add role and remove role actions provided by the Admin::UsersController worked on users and super admins, as this is the interface super admins would use to manage org roles.

Tests were added to spec/system/organization_system_spec.rb and spec/system/admin/users_system_spec.rb to verify that the whole process of visiting these forms and using them to add or remove roles worked.

Screenshots

The old org user list, as viewed by an org admin

OrgAdminOldOrgUsersList

The new org user list, as viewed by an org admin

OrgAdminNewOrgUsersList

The old org user list, as viewed by a super admin

SuperAdminOldOrgUsersList

The new org user list, as viewed by a super admin

SuperAdminNewOrgUsersList

Benjamin-Couey and others added 15 commits February 18, 2025 08:45
…te sub directory, updated tests for organization path visited by super admin to only expect edit button for users
…as the ones making the request, updated tests for when super admins are logged in to run on both normal and super admin users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Management of roles on people who are superusers
1 participant