feat(BA-2476): apply RBAC validator for Project actions#10029
Conversation
There was a problem hiding this comment.
Pull request overview
Applies RBAC validators to the Group(Project) service action processors, aligning enforcement with the existing scoped vs single-entity action processor pattern used elsewhere in the codebase.
Changes:
- Added
ProjectScopeAction/ProjectSingleEntityAction(and result base types) to represent project-scoped actions in the group service. - Updated project search/get actions to inherit from the new Project* base classes (entity type now
EntityType.PROJECT). - Updated
GroupProcessorsto attach RBAC scope/single-entity validators to relevant processors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/ai/backend/manager/services/group/processors.py |
Wires RBAC validators into scope and single-entity action processors for group/project operations. |
src/ai/backend/manager/services/group/actions/search_projects.py |
Switches domain/user project search and project get actions/results to Project* base action types. |
src/ai/backend/manager/services/group/actions/base.py |
Introduces ProjectScopeAction/ProjectSingleEntityAction base classes for project-typed actions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from ai.backend.manager.services.user.service import UserService | ||
|
|
||
|
|
||
| def _create_mock_validators() -> ActionValidators: |
There was a problem hiding this comment.
Same method exist in the tests/component/resource_preset/conftest.py
|
Is it intentional that both GroupSingleEntityAction and ProjectSingleEntityAction coexist? @fregataa |
|
Please rebase this PR. @fregataa |
HyeockJinKim
left a comment
There was a problem hiding this comment.
Please proceed with the follow-up tasks after the cleanup is complete. @fregataa
…ase classes Add project-specific RBAC action base classes that return EntityType.PROJECT: - ProjectScopeAction / ProjectScopeActionResult - ProjectSingleEntityAction / ProjectSingleEntityActionResult These will be used by project-related actions to properly implement RBAC validation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… ProjectSingleEntityAction bases Classify and refactor project-related actions in search_projects.py: - SearchProjectsByDomainAction → ProjectScopeAction - SearchProjectsByUserAction → ProjectScopeAction - GetProjectAction → ProjectSingleEntityAction - SearchProjectsAction remains as GroupAction (admin/internal) All RBAC methods (scope_type, scope_id, target_entity_id, target_element) already implemented correctly. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add RBAC validators to ScopeActionProcessor and SingleEntityActionProcessor for project-related actions in the group service. Changes: - Pass validators.rbac.scope to ScopeActionProcessor for: - create_group, search_projects_by_domain, search_projects_by_user - Pass validators.rbac.single_entity to SingleEntityActionProcessor for: - modify_group, delete_group, purge_group, get_project - Internal/admin actions (usage_per_month, usage_per_period, search_projects) remain on plain ActionProcessor without RBAC validators Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Search actions are excluded from RBAC validator scope per BA-2946. Search results are already filtered by scope through the existing SearchScope mechanism. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Summary
Applied RBAC validators to project (group) action processors following the established pattern from VFolder and Session services.
Changes:
ProjectScopeActionandProjectSingleEntityActionbase classes inservices/group/actions/base.pyentity_type(),permission_operation_type(),scope_type(),target_entity_id())ScopeActionProcessorandSingleEntityActionProcessorwith RBAC validatorsvalidators.rbac.scopevalidators.rbac.single_entityActionProcessorwithout validatorsAffected actions:
create_group,search_projects_by_domain,search_projects_by_userget_project,modify_group,delete_group,purge_groupusage_per_month,usage_per_period,search_projectsTest plan
pants fmtpassespants fixpassespants lintpassesResolves BA-2476