Repository navigation
refactor: 트랙 콘텐츠 관리 권한 검사를 TrackAccessGuard로 모은다 - #148
Merged
Merged
Conversation
게임·트랙 페이지·커리큘럼 서비스 7곳이 "회원 조회 -> Member.canManage 확인"을 각자 복사해 갖고 있었고, 게임 쪽 3곳은 "GAME" 트랙 코드 상수까지 따로 두었다. - TrackAccessGuard.requireManager / requireGameManager 하나로 모은다. - 도메인마다 응답 메시지가 달라 예외 생성자와 "회원 없음"·"권한 없음" 타입은 AccessErrors로 넘긴다. 응답(상태 코드·메시지)과 예외 클래스는 그대로다. - GAME 트랙 행이 없을 때 관리자만 통과하는 기존 동작을 유지한다(canManage(null)).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 44 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 18, 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.
요약
동작을 바꾸지 않는 리팩토링. 게임(3)·트랙 페이지(2)·커리큘럼(2) 서비스 7곳이 "회원 조회 →
Member.canManage(트랙)확인 → 도메인 예외"를 각자 복사해 갖고 있었고, 게임 3곳은"GAME"트랙 코드 상수도 따로 두었다.변경
track/service/TrackAccessGuardrequireManager(memberId, track, errors): 회원이 없으면errors.memberNotFound,canManage가 거짓이면errors.accessDenied.requireGameManager(memberId, errors):Track.GAME트랙으로 위와 같다. GAME 트랙 행이 없으면 관리자만 통과(기존 동작 — 기존 코드는 관리자면 트랙 조회 없이 통과, 아니면 트랙이 없을 때 거부).AccessErrors(예외 생성자, 회원 없음 타입, 권한 없음 타입): 도메인마다 메시지가 달라(GAME_ACCESS_DENIED/TRACK_ACCESS_DENIED/CURRICULUM_ACCESS_DENIED,MEMBER_NOT_FOUND3종) 응답을 그대로 두려고 호출 쪽이 정한다.requireXxxAccess는 가드 호출 한 줄이 되고, 더 이상 쓰지 않는MemberRepository/TrackMasterRepository의존을 뺐다.하지 않은 것
MEMBER_NOT_FOUND메시지 통일 — 응답 문구가 바뀌어 별도로 다룬다.테스트
TrackAccessGuardTest(단위): 회원 없음, GAME 트랙 행이 없을 때 관리자만 통과../gradlew test: 534건 중 533 통과, 1 스킵.