Skip to content

feat: Booth와 Event API에 권한 체크 추가#110

Merged
jhssong merged 4 commits intomainfrom
feat/101-booth-event-auth
Mar 15, 2026
Merged

feat: Booth와 Event API에 권한 체크 추가#110
jhssong merged 4 commits intomainfrom
feat/101-booth-event-auth

Conversation

@jhssong
Copy link
Contributor

@jhssong jhssong commented Mar 15, 2026

✨ 구현한 기능

  • Booth와 Event 관리자 API에 권한 체크를 추가하였습니다.
  • Booth 정보 수정과 이미지 수정의 경우 ADMIN 혹은 해당 부스의 소유자이면 수정 가능하도록 validateRole 메서드 작성하였습니다.

📢 논의하고 싶은 내용

🎸 기타

Summary by CodeRabbit

릴리스 노트

  • 보안 개선

    • 부스 정보 및 이미지 수정 기능에 회원 인증 및 역할 기반 접근 제어 추가
    • 부스 소유자 및 관리자만 수정 권한 부여
  • API 변경

    • 공개 부스 수정 엔드포인트 제거 (관리자 API로만 제공)
    • 이벤트 관리 API에 관리자 역할 기반 접근 제어 추가

@jhssong jhssong self-assigned this Mar 15, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4f17cb77-cd76-4005-8090-0ac604f7ca38

📥 Commits

Reviewing files that changed from the base of the PR and between c17b9ba and b34d696.

📒 Files selected for processing (6)
  • src/main/java/kr/co/knuserver/application/booth/BoothCommandService.java
  • src/main/java/kr/co/knuserver/presentation/booth/AdminBoothApiController.java
  • src/main/java/kr/co/knuserver/presentation/booth/BoothApiController.java
  • src/main/java/kr/co/knuserver/presentation/booth/docs/AdminBoothApiControllerDocs.java
  • src/main/java/kr/co/knuserver/presentation/booth/docs/BoothApiControllerDocs.java
  • src/main/java/kr/co/knuserver/presentation/event/AdminEventApiController.java
💤 Files with no reviewable changes (2)
  • src/main/java/kr/co/knuserver/presentation/booth/BoothApiController.java
  • src/main/java/kr/co/knuserver/presentation/booth/docs/BoothApiControllerDocs.java

📝 Walkthrough

Walkthrough

부스 업데이트 작업에 회원 ID 기반 인증/인가 로직을 추가하고, 관리자 API와 공개 API 엔드포인트를 분리했습니다. 커맨드 서비스에 역할 검증 메서드를 도입하고, 컨트롤러의 메서드 시그니처를 업데이트하여 권한 확인을 강화했습니다.

Changes

Cohort / File(s) Summary
부스 커맨드 서비스
src/main/java/kr/co/knuserver/application/booth/BoothCommandService.java
회원 ID 파라미터 추가 및 역할 검증 로직 구현. validateRole 메서드로 관리자 또는 소유권을 확인하고 미인가 요청 시 ACCESS_DENIED 발생.
관리자 부스 API 컨트롤러
src/main/java/kr/co/knuserver/presentation/booth/AdminBoothApiController.java
@memberid 파라미터 추가하여 updateBooth, updateBoothImages에 전달. 메서드 레벨 @RequireRole(Role.ADMIN) 적용으로 세분화된 권한 제어 구현.
공개 부스 API 컨트롤러
src/main/java/kr/co/knuserver/presentation/booth/BoothApiController.java
updateBooth, updateBoothImages 공개 엔드포인트 제거. 부스 수정 기능을 관리자 API로 이관.
API 문서화 인터페이스
src/main/java/kr/co/knuserver/presentation/booth/docs/AdminBoothApiControllerDocs.java, src/main/java/kr/co/knuserver/presentation/booth/docs/BoothApiControllerDocs.java
AdminBoothApiControllerDocs에 @MemberId 파라미터 추가. BoothApiControllerDocs에서 updateBooth, updateBoothImages 메서드 제거.
관리자 이벤트 API 컨트롤러
src/main/java/kr/co/knuserver/presentation/event/AdminEventApiController.java
클래스 레벨 @RequireRole(Role.ADMIN) 어노테이션 추가하여 모든 이벤트 관리 작업에 대한 관리자 권한 강제.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AdminBoothAPI as AdminBoothApiController
    participant BoothCmdService as BoothCommandService
    participant MemberRepo as MemberRepository
    participant BoothRepo as BoothRepository
    
    Client->>AdminBoothAPI: PATCH /admin/booths/{id}<br/>(memberId, boothId, request)
    activate AdminBoothAPI
    AdminBoothAPI->>BoothCmdService: updateBooth(boothId, request, memberId)
    activate BoothCmdService
    
    BoothCmdService->>BoothRepo: findById(boothId)
    activate BoothRepo
    BoothRepo-->>BoothCmdService: Booth
    deactivate BoothRepo
    
    BoothCmdService->>BoothCmdService: validateRole(booth, memberId)
    activate BoothCmdService
    BoothCmdService->>MemberRepo: findById(memberId)
    activate MemberRepo
    MemberRepo-->>BoothCmdService: Member
    deactivate MemberRepo
    
    alt isAdmin or isOwner
        BoothCmdService->>BoothCmdService: validation passed
    else not authorized
        BoothCmdService-->>BoothCmdService: throw ACCESS_DENIED
    end
    deactivate BoothCmdService
    
    BoothCmdService->>BoothRepo: save(updatedBooth)
    activate BoothRepo
    BoothRepo-->>BoothCmdService: Booth
    deactivate BoothRepo
    
    BoothCmdService-->>AdminBoothAPI: BoothInfoResponseDto
    deactivate BoothCmdService
    AdminBoothAPI-->>Client: 200 OK
    deactivate AdminBoothAPI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

authentication, authorization, refactoring

Suggested reviewers

  • wlgns12370

Poem

🐰 부스의 문을 잠갔네요,
권한 확인하는 마법으로,
관리자만 수정할 수 있고,
주인도 자신의 부스를 지켜요,
안전한 변경의 시간이에요! 🔐✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 PR의 주요 변경사항을 명확하게 요약하고 있습니다: Booth와 Event API에 권한 체크 추가라는 핵심 변경을 정확히 전달합니다.
Description check ✅ Passed PR 설명이 템플릿을 준수하고 있으며, 구현한 기능을 구체적으로 설명하고 있습니다: 권한 체크 추가와 validateRole 메서드 작성이 명시되어 있습니다.
Linked Issues check ✅ Passed PR의 변경사항이 이슈 #101의 목표인 '부스와 이벤트 도메인에 인증/인가 로직 추가'를 충족합니다. Booth 수정에 ADMIN 권한 또는 소유자 확인, Event API 권한 체크 추가가 모두 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 이슈 #101의 범위 내에 있습니다. 권한 체크 추가, validateRole 메서드 작성, 인증 필요 API 정리 등이 모두 인증/인가 로직 추가 목표와 직접 관련됩니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/101-booth-event-auth
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jhssong jhssong added the Show PR은 만들지만 머지를 바로 하는 경우 (리뷰의 여지는 남겨둠) label Mar 15, 2026
@jhssong jhssong merged commit 0bcb0ef into main Mar 15, 2026
2 checks passed
@jhssong jhssong deleted the feat/101-booth-event-auth branch March 15, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Show PR은 만들지만 머지를 바로 하는 경우 (리뷰의 여지는 남겨둠)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🛠 리팩토링] 부스와 이벤트 도메인에 인증/인가 로직 추가

1 participant