Skip to content

feat(BA-5509): Add role_id to assign_users_to_project#10688

Open
fregataa wants to merge 4 commits intomainfrom
feat/BA-5509-assign-project-role
Open

feat(BA-5509): Add role_id to assign_users_to_project#10688
fregataa wants to merge 4 commits intomainfrom
feat/BA-5509-assign-project-role

Conversation

@fregataa
Copy link
Copy Markdown
Member

@fregataa fregataa commented Mar 31, 2026

Summary

  • Add required role_id parameter to assign_users_to_project across all layers (DTO → Action → Adapter → Service → Repository → DBSource)
  • Validate role exists before assignment
  • Create UserRoleRow records for each newly assigned user via BulkCreator

Test plan

  • Verify pants check/lint/fmt pass on changed files
  • Test assign users API with valid role_id
  • Test assign users API with invalid role_id returns error

Resolves BA-5509

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 31, 2026 06:30
@github-actions github-actions bot added size:M 30~100 LoC comp:manager Related to Manager component comp:common Related to Common component labels Mar 31, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id to assign_users_to_project inputs/actions and propagate it through service/repository layers.
  • Validate that the provided role exists before performing assignments.
  • Create user_roles rows 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.

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>
@fregataa fregataa force-pushed the feat/BA-5509-assign-project-role branch from f464539 to 7299c83 Compare April 1, 2026 08:41
@fregataa fregataa requested a review from a team April 1, 2026 09:50
@fregataa fregataa added this to the 26.4 milestone Apr 1, 2026
fregataa and others added 4 commits April 2, 2026 11:05
…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>
@fregataa fregataa requested review from a team and seedspirit April 2, 2026 02:08
@fregataa fregataa force-pushed the feat/BA-5509-assign-project-role branch from 5c2bc4b to b24c988 Compare April 2, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:common Related to Common component comp:manager Related to Manager component size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants