Skip to content

feat(BA-5076): Apply RBAC Creator pattern to ProjectFairShare#10022

Draft
fregataa wants to merge 7 commits intomainfrom
BA-5076
Draft

feat(BA-5076): Apply RBAC Creator pattern to ProjectFairShare#10022
fregataa wants to merge 7 commits intomainfrom
BA-5076

Conversation

@fregataa
Copy link
Member

Summary

  • Added PROJECT_FAIR_SHARE to RBACElementType enum as an auto sub-entity type
  • Registered PROJECT_FAIR_SHARE under RESOURCE_GROUP scope in scope entity combinations
  • Updated FairShareDBSource and FairShareRepository to use RBACEntityCreator instead of Creator
  • Modified create_project_fair_share() to call execute_rbac_entity_creator() for automatic RBAC scope-entity association creation

Test plan

  • pants fmt passes
  • pants fix passes
  • pants lint passes
  • CI checks pass (type checking and tests)

Resolves BA-5076

fregataa and others added 4 commits March 13, 2026 02:43
Add PROJECT_FAIR_SHARE element type in the Auto-only entities section
to enable RBAC Creator pattern for ProjectFairShare auto sub-entity.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…combinations

Add RBACElementType.PROJECT_FAIR_SHARE to the VALID_SCOPE_ENTITY_COMBINATIONS
under RESOURCE_GROUP scope. This allows ProjectFairShare to be properly
registered as an auto sub-entity of ResourceGroup in the RBAC system.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…use RBAC Creator

Change parameter type from Creator[ProjectFairShareRow] to RBACEntityCreator[ProjectFairShareRow]
and replace execute_creator() with execute_rbac_entity_creator() for proper RBAC scope association.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…sitory

- Import RBACEntityCreator and execute_rbac_entity_creator from .rbac.entity_creator submodule
- Add missing imports for RBACElementType and RBACElementRef in db_source.py

This fixes mypy errors that prevented the RBAC Creator pattern from working correctly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 12, 2026 17:53
@github-actions github-actions bot added size:S 10~30 LoC comp:manager Related to Manager component comp:common Related to Common component labels Mar 12, 2026
Copy link
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

Applies the RBAC Creator pattern to ProjectFairShare, replacing the generic Creator with RBACEntityCreator to automatically create RBAC scope-entity associations.

Changes:

  • Added PROJECT_FAIR_SHARE to RBACElementType enum and registered it under RESOURCE_GROUP scope
  • Updated FairShareDBSource and FairShareRepository to use RBACEntityCreator and execute_rbac_entity_creator

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ai/backend/common/data/permission/types.py Added PROJECT_FAIR_SHARE enum value
src/ai/backend/common/data/permission/scope_entity_combinations.py Registered under RESOURCE_GROUP scope
src/ai/backend/manager/repositories/fair_share/db_source/db_source.py Switched to RBACEntityCreator and execute_rbac_entity_creator
src/ai/backend/manager/repositories/fair_share/repository.py Updated parameter type to RBACEntityCreator
changes/10022.feature.md Changelog entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…Creator

Add PROJECT_FAIR_SHARE to RBACElementTypeGQL enum to stay in sync with
RBACElementType. Update test_scope_entity_combinations expected set and
migrate test Creator calls to RBACEntityCreator for project fair share.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added size:M 30~100 LoC and removed size:S 10~30 LoC labels Mar 12, 2026
Co-authored-by: octodog <mu001@lablup.com>
@github-actions github-actions bot added the area:docs Documentations label Mar 12, 2026
@fregataa fregataa requested a review from a team March 12, 2026 19:07
@fregataa fregataa marked this pull request as draft March 12, 2026 19:08
@fregataa fregataa removed the request for review from a team March 12, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations 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.

2 participants