feat(BA-5778): wire BulkActionRBACValidator to bulk permission check#11240
feat(BA-5778): wire BulkActionRBACValidator to bulk permission check#11240
Conversation
Implement validate() to call check_bulk_permission_with_scope_chain() and split entity_ids into allowed/denied entries for the Bulk Processor's partial-success reporting. Superadmins bypass the DB check; missing user context raises UserNotFound consistent with single-entity validators. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR completes the RBAC enforcement path for bulk actions by implementing BulkActionRBACValidator.validate() using the permission controller’s bulk scope-chain check, enabling per-entity allow/deny results for partial-success bulk processing.
Changes:
- Implement
BulkActionRBACValidator.validate()to callPermissionControllerRepository.check_bulk_permission_with_scope_chain()and returnallowed_entity_idsplusDeniedEntityentries. - Add superadmin bypass and missing-user (
current_user() is None) handling consistent with existing RBAC validators. - Add unit tests covering superadmin bypass, missing user context, partial allow/deny, full deny, and empty-batch behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/ai/backend/manager/actions/validators/rbac/bulk.py |
Implements bulk RBAC validation using the repository bulk scope-chain permission check and returns per-entity decisions. |
tests/unit/manager/actions/validators/test_rbac_validators.py |
Adds test action/fixtures and a new TestBulkActionRBACValidator suite validating expected allow/deny splitting and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
seedspirit
left a comment
There was a problem hiding this comment.
Does "Bulk Validation" mean that permission checks for multiple operations performed by a single user are carried out in bulk? Could you please confirm whether this refers to validating operations performed by a single user rather than multiple users?
bulk validation means validating multiple entities in a single user, single entity type, single operation type |
|
CI is broken |
Summary
BulkActionRBACValidator.validate()to callcheck_bulk_permission_with_scope_chain()and splitentity_idsinto allowed/denied entries for the Bulk Processor's partial-success reporting (BA-5777).UserNotFound, mirroringSingleEntityActionRBACValidator.TestBulkActionRBACValidatorcovering superadmin bypass, missing user, partial allow/deny split via self-scope permission, full-deny, and empty-batch cases.Test plan
pants fmt / fix / linton changed filespants check tests/unit/manager/actions/validators/test_rbac_validators.py src/ai/backend/manager/actions/validators/rbac/bulk.pypants test tests/unit/manager/actions/validators/test_rbac_validators.pypants test tests/unit/manager/actions/test_bulk_processor.py(no regression)Resolves BA-5778