feat(api): new membership API for org and suborgs groups#5472
feat(api): new membership API for org and suborgs groups#5472
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile SummaryThis PR introduces a new membership API shape for org and project group memberships, enabling groups from a parent organization to be linked into sub-organizations. The key changes are:
Key observations:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: 58ea679 |
akhilmhdh
left a comment
There was a problem hiding this comment.
Pending: Application testing
backend/src/server/routes/v1/organization-memberships-router.ts
Outdated
Show resolved
Hide resolved
backend/src/server/routes/v1/project-group-memberships-router.ts
Outdated
Show resolved
Hide resolved
backend/src/services/membership-group/org/org-membership-group-factory.ts
Outdated
Show resolved
Hide resolved
backend/src/services/membership-group/org/org-membership-group-factory.ts
Show resolved
Hide resolved
backend/src/services/membership-group/org/org-membership-group-factory.ts
Outdated
Show resolved
Hide resolved
...n/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupModal.tsx
Outdated
Show resolved
Hide resolved
|
@greptile please review this again |
Application Testing Feedback1. Sub-org project visibility leak from rootUsers in a sub-org should not see projects belonging to the root org. Currently, if a group has a project in root, members can see it when viewing the sub-org. 2. Machine identity – missing project listing fixThe project listing fix was not applied to machine identities. They still show the old behavior. 3. Empty membership list for group-created projects in sub-orgWhen a project is created in a sub-org where access comes solely through group membership, the project's member listing appears empty — no users are shown. 4. Group deletion failingDeleting a group throws an error. The use of 5. Group re-linking restores previously removed project accessSteps to reproduce: Link a group from root → add a project → remove the group → re-add the group. 6. User retains direct project membership after losing suborg accessWhen a user's only link to a sub-org (via a group) is removed, their direct project memberships in that sub-org are not cleaned up. When the group is re-added, those memberships resurface. Project membership should be revoked when the user's last access path to the org/sub-org is removed. Also ensure this cleanup happens for identities as well as it's not happening for the same reason |
- Phase 1: Org/project group list includes orgId; frontend hides edit for inherited groups - Cache: useUpdateGroup/useDeleteGroup accept organizationId to invalidate current org list - Phase 2: Frontend uses new membership endpoints (org + project) - Deprecate legacy routes in docs; new routes note restructure + retrocompatibility - Fix ESLint unused destructuring in group mutations - Backend: project-group-memberships allows optional group.orgId Co-authored-by: Cursor <cursoragent@cursor.com>
ad35ce6 to
516bf92
Compare
- Add findEffectiveInOrg to membership-group-dal for checking remaining org access (direct + group-based) after excluding specific memberships - Rewrite unlinkGroupFromSubOrg to collect all membership IDs and delete in a single batch instead of incremental deletes - Fix missing scope=Organization filter that caused project memberships to be counted as effective org access, preventing cleanup - Extract deleteOwnedGroup and unlinkGroupFromSubOrg as separate methods for readability - Remove unused ActorType import and findEffectiveOrgMembership from orgDAL Pick type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… from group When a user or identity is removed from a group that is linked to sub-orgs, their direct project memberships in those sub-orgs are now cleaned up if they no longer have effective org access (direct or through another linked group).
|
@greptile this pr has made a lot of changes from your last review. Do a complete review once more |
Additional Comments (2)
Same concern as Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Changing from |
|
Good job @IgorHorta |









Context
Sub-organization groups and project groups previously used legacy group endpoints (e.g.
POST/DELETE /groups/:id/linkfor org link/unlink). We're moving to the new membership API shape{scope}/memberships/{actor-type}/{actor-id}so org and project group membership is consistent and easier to extend.Before: Org/project groups used a mix of legacy group routes; link/unlink used
POST/DELETE /groups/:id/link.After: Org groups use
GET/POST/PATCH/DELETE /api/v1/organizations/memberships/groups(and.../groups/:groupIdfor PATCH/DELETE). Project groups use.../projects/:projectId/memberships/groups. Link/unlink use the new create/delete org group membership endpoints. Legacy/:id/linkroutes are removed. Group service fetches membership + group in parallel where both are needed.Related: PLATFRM-198
Screenshots
Steps to verify the change
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).