Skip to content

feat(BA-4526): Unify ScopeType/EntityType to RBACElementType in domain repos#10336

Merged
HyeockJinKim merged 3 commits into
mainfrom
feat/BA-4526-rbac-domain-repos-unified-enum
Mar 23, 2026
Merged

feat(BA-4526): Unify ScopeType/EntityType to RBACElementType in domain repos#10336
HyeockJinKim merged 3 commits into
mainfrom
feat/BA-4526-rbac-domain-repos-unified-enum

Conversation

@fregataa
Copy link
Copy Markdown
Member

@fregataa fregataa commented Mar 19, 2026

Summary

  • Replace EntityType with RBACElementType in entity_operations() return types for DomainData, GroupData, and UserData
  • Update ScopeSystemRoleData Protocol, RBACGranter, and RBACRevoker to accept RBACElementType at interfaces, bridging to legacy types at DB boundaries
  • Change ScopeType.VFOLDER to RBACElementType.VFOLDER at vfolder grant/revoke call sites

Test plan

  • pants check passes with no new type errors
  • pants lint passes on all changed files

Resolves BA-4526

…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>
Copilot AI review requested due to automatic review settings March 19, 2026 17:07
@github-actions github-actions Bot added size:M 30~100 LoC comp:manager Related to Manager component labels Mar 19, 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

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 RBACElementType mappings.
  • Adjusted RBACGranter/RBACRevoker to accept RBACElementType and convert to legacy ScopeType in SQL writes/filters.
  • Switched vfolder grant/revoke call sites from ScopeType.VFOLDER to RBACElementType.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.

Comment thread src/ai/backend/manager/repositories/base/rbac/revoker.py
Comment thread src/ai/backend/manager/repositories/base/rbac/revoker.py
Comment thread src/ai/backend/manager/data/user/types.py
@fregataa fregataa added this to the 26.4 milestone Mar 19, 2026
@fregataa fregataa requested a review from a team March 19, 2026 17:15
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 HyeockJinKim merged commit f4d759e into main Mar 23, 2026
33 checks passed
@HyeockJinKim HyeockJinKim deleted the feat/BA-4526-rbac-domain-repos-unified-enum branch March 23, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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