lablup / lablup/backend.ai

Remove unused permission-check methods and their input DTOs from PermissionController

Open
#11,452 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Background

While reviewing the permission controller after BA-5843 landed (PR #11356), three repository methods on PermissionControllerRepository and their underlying PermissionDBSource helpers were found to have no callers in src/. They are referenced only by tests/component/rbac/test_rbac_permission.py.

## Dead chain

- repository.check_permission_of_entity

-> db_source.get_user_roles

- repository.check_permission_in_scope

-> db_source.check_scope_permission_exist

- repository.check_permission_of_entities

-> db_source.check_batch_object_permission_exist

-> db_source._make_query_statement_for_object_permissions

Input dataclasses in data/permission/role.py used only by these methods:

- ScopePermissionCheckInput

- SingleEntityPermissionCheckInput

- BatchEntityPermissionCheckInput

## Scope

1. Confirm tests/component/rbac/test_rbac_permission.py is not the only RBAC permission integration test. If it covers behaviour that should still be exercised, migrate the affected cases to use check_bulk_permission_with_scope_chain / resolve_effective_permissions.

2. Delete the three repository methods.

3. Delete the four db_source methods.

4. Delete the three input dataclasses and their imports.

5. pants fmt / fix / lint / check clean.

## Acceptance Criteria

- All listed methods and dataclasses removed.

- No remaining import of the removed symbols.

- Test suite green.

## References

- Predecessor: BA-5843

JIRA Issue: BA-5933

Contributor guide

Open the contributing guide

Research direction

Search src/ for the three PermissionControllerRepository methods, four PermissionDBSource helpers, and the three input dataclasses in data/permission/role.py. Read tests/component/rbac/test_rbac_permission.py and check for other RBAC permission integration tests before deciding whether cases need migration. Remove the listed symbols, verify no imports remain, run the relevant tests, then run pants fmt, fix, lint, and check.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authorization, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.