feat(web): Add org removal functionality to admin user details page#38013
Open
karthikbhandary2 wants to merge 4 commits into
Open
feat(web): Add org removal functionality to admin user details page#38013karthikbhandary2 wants to merge 4 commits into
karthikbhandary2 wants to merge 4 commits into
Conversation
lunny
reviewed
Jun 7, 2026
lunny
reviewed
Jun 8, 2026
| orgs, err := db.Find[org_model.Organization](ctx, org_model.FindOrgOptions{ | ||
| ListOptions: db.ListOptionsAll, | ||
| UserID: u.ID, | ||
| IncludeVisibility: structs.VisibleTypePrivate, |
Contributor
Author
There was a problem hiding this comment.
This is given because we are going to remove the user from all the orgs (including limited and private). Since this is behind admin only route, it is restricted to only admins and regular users cant see this.
Member
There was a problem hiding this comment.
Does this option mean it only includes private organizations?
Contributor
Author
There was a problem hiding this comment.
no it means give everything (public, limited and private) and not to filter them out.
lunny
reviewed
Jun 9, 2026
40e88d1 to
8883f15
Compare
Signed-off-by: techknowlogick <techknowlogick@gitea.com>
This file contains hidden or 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
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.
Related Issues
Closes #37071
Summary
Adds the ability for administrators to remove users from organizations directly from the admin user details page (
/-/admin/users/{userid}). This feature provides both individual organization removal and bulk removal from all organizations.Motivation
Currently, administrators need to navigate to each organization separately to remove a user from multiple organizations. This enhancement streamlines user management by allowing admins to perform these actions directly from the user details page.
Implementation
Backend (Go)
routers/web/admin/users.go(Modified)RemoveUserFromOrg()- Removes a user from a single organizationRemoveUserFromAllOrgs()- Removes a user from all organizationsorg_service.RemoveOrgUser()serviceorg_serviceimportrouters/web/web.go(Modified)/{userid}/orgs/{orgid}/remove/{userid}/orgs/remove-allFrontend (Templates)
templates/admin/user/view.tmpl(Modified)templates/admin/user/view_orgs.tmpl(New)explore/user_list.tmplbut with admin-specific actionsLocalization
options/locale/locale_en-US.json(Modified)Added:
admin.users.org_removed- Success message for single removaladmin.users.all_orgs_removed- Success message for bulk removaladmin.users.no_orgs_to_remove- Info message when user has no organizationsadmin.users.no_orgs_removed- Error message when no removals succeededadmin.users.some_orgs_removed- Partial success message with countadmin.users.remove_all_orgs_title- Modal titleadmin.users.remove_all_orgs_desc- Modal confirmation messageTests
tests/integration/admin_user_org_test.go(New)TestAdminRemoveUserFromOrg- Tests single organization removalTestAdminRemoveUserFromAllOrgs- Tests bulk removal from all organizationsFeatures
UI Changes
Before
No option to remove users from organizations on the admin user page.
After
Screenshots
Security Considerations
org_service.RemoveOrgUser()which includes proper permission checksTesting
Run integration tests:
go test -v ./tests/integration -run TestAdminRemoveUserFromDevelopment Note
This PR was developed with assistance from Amazon Q Developer and Gemini.