Skip to content

[feature/#724] 게임판 접근 권한 검증 및 기본 코트 정책 반영 - #731

Merged
kanghana1 merged 8 commits into
developfrom
feature/#724
Aug 24, 2026
Merged

kanghana1 merged 8 commits into
developfrom
feature/#724

Conversation

@kanghana1

Copy link
Copy Markdown
Contributor

❤️ 기능 설명

게임판 권한 작업 및 코트 정책을 반영합니다.

1. 조회 권한 완화 + 게임 진행자 여부(isGameHost) 응답 추가

  • 명단/코트보드 조회를 인증된 회원이면 누구나 가능하도록 완화
  • 코트보드 조회 응답에 isGameHost 필드 추가 → 프론트가 조작 UI 노출 여부를 판단
  • GameBoardAccessValidator.validateViewer 및 관련 에러코드(GAME_BOARD_VIEW_ACCESS_DENIED) 제거, isGameHost() 판별 메서드 추가

2. 게임 진행 API에 게임 진행자 권한 검증 추가

  • createGame/startGame/completeGame/deleteGame/moveGameToWaiting에 validateGameHost 배선
  • 서비스 레이어에 검증을 두어 REST와 웹소켓(GameRealtimeDomainHandler) 경로 모두 커버

3. 코트 관리 권한 검증 + 기본 코트 정책 반영

  • 코트 관리/이동(manageCourts/moveCourt)에 진행자 검증 배선
  • 게임판 생성 시 기본 코트 2개 자동 부여
  • 코트 개수 최소 1개 / 최대 10개 검증 추가
  • 기존 게임판(코트 0개) 정합성을 위한 backfill 마이그레이션 추가

연결된 issue

연결된 issue를 자동으로 닫기 위해 아래 {이슈넘버}를 입력해주세요.

close #724



🩷 Approve 하기 전 확인해주세요!

  • 리뷰어가 확인해줬으면 하는 사항 적어주세요.
  • [ ]

✅ 체크리스트

  • PR 제목 규칙 잘 지켰는가?
  • 추가/수정사항을 설명하였는가?
  • 테스트 결과 사진을 넣었는가?
  • 이슈넘버를 적었는가?

@kanghana1
kanghana1 requested a review from Dimo-2562 August 24, 2026 07:45
@kanghana1 kanghana1 self-assigned this Aug 24, 2026
@kanghana1 kanghana1 added the 🛠️ FEAT This issue or pull request already exists label Aug 24, 2026

@Dimo-2562 Dimo-2562 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

브로드캐스트 로직쪽 수정 부탁드려요~!

* @param memberId 요청자(추후 게임판 접근 권한 검증에 사용 예정)
* @param memberId 요청자
*/
public GameBoardResult getBoard(Long memberId, Long gameBoardId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 메서드를 통해 DTO를 만들고 이를 기반으로 전체에게 브로드캐스트를 GameReadtimeDomainHandler에서 148-150, 184-187, 200-211에서 진행합니다.

이때 isGameHost가 true인채로 모두에게 전파되므로 이는 수정되어야 할 필요성이 있어 보입니다!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 그렇네요! 해당 부분 수정하였습니다!

private static final int MIN_COURT_COUNT = 1;
private static final int MAX_COURT_COUNT = 10;

public GameCourtManageCommand {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 Command를 생성하는 GameCourtMapper에서 item.courtId()를 호출하다 NPE가 발생할 수 있습니다.

Request 객체에서 배열뿐만 아니라 배열 원소도 NotNull 검증이 필요해보입니다!

Long gameBoardId,
List<CourtCommand> courts
) {
private static final int MIN_COURT_COUNT = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뿐만 아니라 해당 DTO에서 NotNull 내부 메세지로 전체 삭제 시 빈 배열이라고 문구가 적혀있지만 실제로 기획상 0개는 될 수 없으므로 해당 문구 수정이 필요합니다.

isGameHost는 요청자 본인의 진행자 여부를 뜻하는 개인 값이나, 변경을 일으킨 요청자 기준으로 조회한 보드 DTO를 그대로 전체 구독자에게 브로드캐스트하여 다른 구독자에게 isGameHost=true가 새어나갔다.

브로드캐스트 본문에서는 항상 false로 내리는 toBroadcastBoard를 추가해 create/delete/board-update 3개 지점에 적용한다. 요청자 본인은 직접 응답으로 올바른 값을 받으므로 영향이 없다.
courts 배열에 null 원소({"courts":[null]})가 들어오면 GameCourtMapper에서 item.courtId() 호출 시 NPE(500)가 발생했다. 리스트 원소에 컨테이너 요소 제약 @NotNull을 걸어 경계에서 400으로 걸러지도록 한다.
기획상 코트는 최소 1개(빈 배열 불가)이나 안내 문구가 '전체 삭제 시 빈 배열'로 되어 있어 0개가 허용되는 것처럼 오해를 주었다. 실제 제약에 맞게 문구를 정정한다.
@kanghana1
kanghana1 merged commit e6e6db7 into develop Aug 24, 2026
1 check passed
@kanghana1 kanghana1 mentioned this pull request Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ FEAT This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 게임판 권한 검증 추가 및 코트 정책 정비

2 participants