feat(iam): add user groups for policy attachment#619
Conversation
Implements GitHub issue #608 - user groups for IAM policy management. Adds three new database tables (groups, user_groups, group_policies), Group domain model, and all supporting repository/service/handler methods for CRUD operations and policy attachment.
Adds CreateGroup, GetGroupByID, ListGroups, UpdateGroup, DeleteGroup, AddUserToGroup, RemoveUserFromGroup, GetGroupsForUser, GetUsersInGroup, AttachPolicyToGroup, DetachPolicyFromGroup, GetPoliciesForGroup methods to the IAMRepository interface, IAMService interface, and iamService implementation.
Implements all group-related methods in iamRepository: CreateGroup, GetGroupByID, ListGroups, UpdateGroup, DeleteGroup, AddUserToGroup, RemoveUserFromGroup, GetGroupsForUser, GetUsersInGroup, AttachPolicyToGroup, DetachPolicyFromGroup, GetPoliciesForGroup, GetGroupsForPolicy.
Adds checkGroupIAMPolicies() method to rbacService that resolves a user's group memberships and evaluates IAM policies attached to those groups. Group policies are checked after user-attached and role-attached policies in the HasPermission authorization chain.
Adds all group HTTP handlers (CreateGroup, ListGroups, GetGroupByID, UpdateGroup, DeleteGroup, AddUserToGroup, RemoveUserFromGroup, GetGroupMembers, AttachPolicyToGroup, DetachPolicyFromGroup, GetGroupPolicies) and registers them in the IAM router group. Breaks a naming conflict with autoscaling_handler by renaming CreateGroupRequest/UpdateGroupRequest to IAMGroupRequest.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
groups,user_groups, andgroup_policiesdatabase tables via migration 114Group,UserGroup, andGroupPolicydomain modelscheckGroupIAMPolicies()— group policies are evaluated after user-attached and role-attached policiesPOST/GET/PUT/DELETE /iam/groups,POST/DELETE/GET /iam/groups/:id/members/:userId,POST/DELETE/GET /iam/groups/:id/policies/:policyIdTest plan
goose postgres \"postgres://...\" upPOST /iam/groupswith{\"name\": \"engineering\"}POST /iam/groups/{id}/members/{userId}POST /iam/groups/{id}/policies/{policyId}go test ./internal/core/services/... ./internal/repositories/postgres/...(note: mocks will need regeneration for new interface methods)