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.
멀티테넌시 RBAC
관련 이슈
#176
핵심 설계 원칙
(user, tenant, role, resource)스코프에서 판단tenant_id를 가져야 함(tenantId, workerId)기반으로 수행주요 흐름
1. 로그인 흐름
특징:
2. 테넌트 컨텍스트 선택 흐름
특징:
3. 권한 체크 흐름
RBAC 관련 DB 스키마 설계
각 테이블의 역할:
Kubernetes RBAC 와 차이점:
요구사항 정의
시나리오 개요
시나리오: User ↔ Worker (1:N), Worker → Tenant (N:1)
핵심 원칙
전제 조건
시퀀스 다이어그램
역할 및 권한 체크 시퀀스
클라우드 리소스 접근 시퀀스
권한 체크 흐름 요약
resource.tenantId == tenantIdWorkerRoleAssignment)RolePermission)resourceType과action에 대한 권한 확인권한 체크 함수:
PermissionService.can(workerId, tenantId, action, resource)레퍼런스
핵심 컴포넌트
1. TenantContextInterceptor
X-Tenant-Id헤더에서 테넌트 ID 추출TenantContextService로 사용자의 테넌트 접근 권한 검증TenantContextHolder에 Context 설정2. TenantContextService
validateTenantAccess(Long userId, Long tenantId): 접근 권한 검증getAvailableTenantsForUser(Long userId): 사용자가 접근 가능한 모든 테넌트 조회3. TenantContextHolder
4. PermissionService
can(Long workerId, Long tenantId, String action, Object resource): 권한 체크