feat(frontier): add SetGroupMemberRole RPC#485
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR extends the FrontierService gRPC API by adding a new Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest Buf updates on your PR. Results from workflow Validate / validate (pull_request).
|
Introduces a new RPC to change an existing group member's role, mirroring SetOrganizationMemberRole. Supports user (and future principal types) with an explicit role, replacing the implicit role assignment in AddGroupUsers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2ff8b62 to
7587672
Compare
Introduces the SetGroupMemberRole RPC and three service methods on the membership package: AddGroupMember, SetGroupMemberRole, and OnGroupCreated. These manage policy + SpiceDB relation atomically and keep them in sync, fixing the leaky-relation pattern at the group layer. - AddGroupMember validates org membership of the principal and rejects duplicates with ErrAlreadyMember (service-only, no proto). - SetGroupMemberRole rejects non-members with ErrNotMember and enforces a min-owner constraint (ErrLastGroupOwnerRole) on demotion. - OnGroupCreated bundles the group<->org hierarchy relations with the initial owner add, so group.Create can wire SpiceDB with one call. - Principal validation is restricted to app/user; the switch is kept extensible for future principal types. Audit events are added for both the added and role-changed cases. No call sites are migrated yet — group.Create, AddGroupUsers, and the deletion of legacy group service methods will follow in subsequent PRs. PROTON_COMMIT is temporarily pinned to the feature-branch SHA on raystack/proton#485; it will be re-pinned to the merge commit once that PR lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
raystack/proton#485 has merged. Re-pin from the feature-branch SHA to the merge commit on proton main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
SetGroupMemberRoleRPC + request/response messages toFrontierService, mirroringSetOrganizationMemberRole.role_idandprincipal_type(currentlyapp/user; field is generic so future principal types can be supported without a proto change).AddGroupUsersis left untouched for backward compatibility — it will be migrated and eventually removed in a follow-up.Why
Today the group membership APIs hardcode role assignments (
AddGroupUsers→ member, group creation → owner) and update policies and direct SpiceDB relations separately. A dedicatedSetGroupMemberRoleis needed so the frontier implementation can change a member's role atomically and keep policy + direct relation in sync — fixing the leaky-relation bug at the group layer (see raystack/frontier#1478).Test plan
buf lintbuf buildbuf breaking --against main(wire-compatible)