feat(BA-5509): Add role_id to assign_users_to_project#10688
Open
feat(BA-5509): Add role_id to assign_users_to_project#10688
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the “assign users to project” flow to require a role_id and to create RBAC user_roles mappings for newly assigned users, wiring the new parameter through DTO → adapter → action/service → repository → DB source.
Changes:
- Add required
role_idtoassign_users_to_projectinputs/actions and propagate it through service/repository layers. - Validate that the provided role exists before performing assignments.
- Create
user_rolesrows in bulk for each newly assigned user.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ai/backend/manager/services/group/service.py | Passes role_id from action into repository call. |
| src/ai/backend/manager/services/group/actions/assign_users_to_project.py | Adds role_id to the action model. |
| src/ai/backend/manager/repositories/group/repository.py | Updates repository method signature to accept role_id and forwards to DB source. |
| src/ai/backend/manager/repositories/group/db_source/db_source.py | Adds role existence validation and bulk creation of user-role mappings during assignment. |
| src/ai/backend/manager/api/adapters/project.py | Passes role_id from API input into the action. |
| src/ai/backend/common/dto/manager/v2/group/request.py | Adds required role_id field to the request DTO. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/ai/backend/manager/repositories/group/db_source/db_source.py
Outdated
Show resolved
Hide resolved
fregataa
added a commit
that referenced
this pull request
Mar 31, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fregataa
added a commit
that referenced
this pull request
Apr 1, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f464539 to
7299c83
Compare
seedspirit
reviewed
Apr 2, 2026
seedspirit
reviewed
Apr 2, 2026
src/ai/backend/manager/repositories/group/db_source/db_source.py
Outdated
Show resolved
Hide resolved
…e assignment When assigning users to a project, also create UserRoleRow records so users receive the specified role within the project. The role_id is required and validated before assignment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address PR review feedback: replace generic InvalidAPIParameters with dedicated RoleNotFound exception for proper 404 semantics, and add explanation to the TODO comment about role repository migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5c2bc4b to
b24c988
Compare
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.
Summary
role_idparameter toassign_users_to_projectacross all layers (DTO → Action → Adapter → Service → Repository → DBSource)UserRoleRowrecords for each newly assigned user viaBulkCreatorTest plan
pants check/lint/fmtpass on changed filesResolves BA-5509
🤖 Generated with Claude Code