-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Benjamin-Couey
wants to merge
15
commits into
rubyforgood:main
Choose a base branch
from
Benjamin-Couey:4819-manage-super-user-roles
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
4819 manage super user roles #5047
Benjamin-Couey
wants to merge
15
commits into
rubyforgood:main
from
Benjamin-Couey:4819-manage-super-user-roles
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… that are part of the org
…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
…wn for org admins is being used
…ers, added remove role system test
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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. TheOrganizationsController
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 aNoMethodError
when attempting to edit a super admin. Again, theAdmin::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
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 theOrganizationsController
worked on users and super admins. A check that was erroneously aimed at a path handled by theAdmin::OrganizationsController
was also moved to the more appropriatespec/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 theAdmin::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
andspec/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
The new org user list, as viewed by an org admin
The old org user list, as viewed by a super admin
The new org user list, as viewed by a super admin