feat(BA-4526): Unify ScopeType/EntityType to RBACElementType in domain repos#10336
Merged
Merged
Conversation
…n data types and repositories Replace EntityType with RBACElementType in entity_operations() return types for DomainData, GroupData, and UserData. Update ScopeSystemRoleData Protocol and RBACGranter/RBACRevoker to accept RBACElementType. Bridge to legacy types at DB row construction boundaries. Data layer: - domain/types.py, group/types.py, user/types.py: entity_operations() returns Mapping[RBACElementType, ...], bridges via EntityType.to_element() Repository layer: - role_manager.py: ScopeSystemRoleData Protocol updated, bridge in _create_permissions - granter.py: granted_entity_scope_type accepts RBACElementType, bridges to ScopeType - revoker.py: entity_scope_type accepts RBACElementType, bridges to ScopeType - vfolder/repository.py: ScopeType.VFOLDER → RBACElementType.VFOLDER at grant/revoke sites Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Unifies permission “type” usage across domain/group/user role data and RBAC grant/revoke paths by moving interface-level APIs to RBACElementType while converting back to legacy DB enums at persistence boundaries.
Changes:
- Updated domain/group/user “entity_operations” contracts to return
RBACElementTypemappings. - Adjusted
RBACGranter/RBACRevokerto acceptRBACElementTypeand convert to legacyScopeTypein SQL writes/filters. - Switched vfolder grant/revoke call sites from
ScopeType.VFOLDERtoRBACElementType.VFOLDER.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ai/backend/manager/repositories/vfolder/repository.py | Updates vfolder grant/revoke call sites to pass RBACElementType.VFOLDER. |
| src/ai/backend/manager/repositories/permission_controller/role_manager.py | Updates role data protocol to return RBACElementType and bridges to legacy EntityType for DB inserts. |
| src/ai/backend/manager/repositories/base/rbac/revoker.py | Changes revoker input type to RBACElementType and converts to legacy ScopeType for DB filtering. |
| src/ai/backend/manager/repositories/base/rbac/granter.py | Changes granter input type to RBACElementType and converts to legacy ScopeType for DB inserts. |
| src/ai/backend/manager/data/user/types.py | Updates user role permission mapping keys to RBACElementType. |
| src/ai/backend/manager/data/group/types.py | Updates project/group admin permission mapping keys to RBACElementType. |
| src/ai/backend/manager/data/domain/types.py | Updates domain admin permission mapping keys to RBACElementType. |
| changes/10336.enhance.md | Adds changelog entry describing the unification work. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Update test fixtures and context dataclasses to use RBACElementType instead of ScopeType for entity_scope_type fields, matching the interface changes in RBACGranter and RBACRevoker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
HyeockJinKim
approved these changes
Mar 23, 2026
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
EntityTypewithRBACElementTypeinentity_operations()return types forDomainData,GroupData, andUserDataScopeSystemRoleDataProtocol,RBACGranter, andRBACRevokerto acceptRBACElementTypeat interfaces, bridging to legacy types at DB boundariesScopeType.VFOLDERtoRBACElementType.VFOLDERat vfolder grant/revoke call sitesTest plan
pants checkpasses with no new type errorspants lintpasses on all changed filesResolves BA-4526