Support adding users to user groups at invitation time (AddOrganizationMemberUser / AddProjectMemberUser usergroups) - #9858
Open
nishantmonu51 wants to merge 3 commits into
Open
Support adding users to user groups at invitation time (AddOrganizationMemberUser / AddProjectMemberUser usergroups)#9858nishantmonu51 wants to merge 3 commits into
AddOrganizationMemberUser / AddProjectMemberUser usergroups)#9858nishantmonu51 wants to merge 3 commits into
Conversation
Admins can now pick user groups when inviting a user, instead of waiting for the invite to be accepted and adding the user to groups afterwards. Backend: - `AddOrganizationMemberUser` and `AddProjectMemberUser` accept `usergroups`. For a pending signup the groups are stored on the org invite (additively merged on re-invite) and applied on acceptance; for an existing user they are applied immediately in the same transaction. - A shared resolver validates groups (exist, not managed, admin-role guard) and is reused by `AddUsergroupMemberUser`. - `OrganizationInvite` exposes `usergroups`; `ListUsergroupMemberUsers` lists pending invitees with `pending_acceptance`; `RemoveUsergroupMemberUser` works on pending invitees; deleting a group scrubs it from pending invites. CLI: - `rill user add --group` is repeatable and rides along with the org or project invite in one call; the interactive fallback keeps attributes. - `rill user list` shows groups and attributes on pending invites and a status column on group member listings. Frontend: - Group multi-select in the Add users and Add guests dialogs. - Pending rows show their groups; a Manage groups action on every user row. - The Create and Edit group dialogs list and can add pending invitees.
rohithreddykota
approved these changes
Sep 10, 2026
Backend: - `AddOrganizationMemberUser` checks membership up front and applies the requested groups to an existing member in one transaction, reporting the conflict only after the commit; the seat quota is skipped for existing members. - `DeleteUsergroup` scrubs the group from pending invites in the same transaction as the delete. - Group member counts include pending invitees, matching the member listing. - `AddUsergroupMemberUser` and `RemoveUsergroupMemberUser` share the group resolver and its permission and managed-group checks. CLI: - `rill user add --group` treats AlreadyExists as success when the server has applied the groups, and rejects attributes on the groups-only path. Frontend: - Manage groups dialog snapshots the target user and changes before saving and locks the dialog while requests are in flight, so a save can no longer apply to a different user. - Add users dialog treats a 409 with selected groups as a partial success: caches are refreshed and the notice says the members were added to the groups. - Group changes invalidate every variant of the per-user groups query and the member lists of the affected groups, so the table dropdown no longer goes stale. - Pending rows are tagged explicitly instead of relying on invitedBy, and the invite coercion is shared between the users and guests pages. - The group multi-select stops paging after a failed page. Claude-Session: https://claude.ai/code/session_01UYzyaaSjA9gNrGJXDsCeTs
The paginated group member listing orders by the database collation, which sorts `_` before `-` on CI while Go's byte order does the opposite. Compare the pages against a single unpaginated listing instead of asserting byte-order increase. Claude-Session: https://claude.ai/code/session_01UYzyaaSjA9gNrGJXDsCeTs
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.
Admins can now assign user groups when inviting a user, instead of inviting, waiting for acceptance, and then adding them to groups. Follows the pattern used for invite-time attributes in #9797. The
org_invites.usergroup_idscolumn and its application on signup already existed; this PR exposes it through the APIs, CLI, and UI.Backend
AddOrganizationMemberUserandAddProjectMemberUseracceptusergroups(group names). For a pending signup they are stored on the org invite and merged additively on re-invite; for an existing user they are applied immediately in the same transaction (ON CONFLICT DO NOTHING, so it is safe inside the tx).resolveUsergroupsForMembershipvalidates groups (exist, not managed, admin-role guard) and is reused byAddUsergroupMemberUser, so the rules cannot drift.OrganizationInviteexposesusergroups;ListUsergroupMemberUsersincludes pending invitees withpending_acceptance;RemoveUsergroupMemberUserhandles pending invitees;DeleteUsergroupscrubs the group from pending invites.rbac_test.goandpostgres_test.go.CLI
rill user add --groupis repeatable and is sent with the org or project invite in a single call. The interactive fallback no longer drops--attributevalues.rill user listshows groups and attributes on pending invites, and astatuscolumn for group members.Frontend
UserGroupsMultiSelectin the Add users and Add guests dialogs.ManageUserGroupsDialogis reachable from a "Manage groups" action on every row of the users and guests tables.Checklist: