-
Notifications
You must be signed in to change notification settings - Fork 0
feat(Reservation): 관리자 접근 제한 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "feature/#62-\uAD00\uB9AC\uC790store\uC811\uADFC\uC81C\uD55C"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.nowait.domaincorerdb.reservation.exception; | ||
|
|
||
| import com.nowait.common.exception.ErrorMessage; | ||
|
|
||
| public class ReservationUpdateUnauthorizedException extends RuntimeException { | ||
| public ReservationUpdateUnauthorizedException() { | ||
| super(ErrorMessage.RESERVATION_UPDATE_UNAUTHORIZED.getMessage()); | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.nowait.domaincorerdb.reservation.exception; | ||
|
|
||
| import com.nowait.common.exception.ErrorMessage; | ||
|
|
||
| public class ReservationViewUnauthorizedException extends RuntimeException { | ||
| public ReservationViewUnauthorizedException() { | ||
| super(ErrorMessage.RESERVATION_VIEW_UNAUTHORIZED.getMessage()); | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ public class User { | |
| @Enumerated(EnumType.STRING) | ||
| private Role role; | ||
|
|
||
| @Column(nullable = false) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain기존 데이터와 데이터베이스 마이그레이션에 대한 검증이 필요합니다.
다음 스크립트를 실행하여 기존 데이터의 상태를 확인하고 마이그레이션 전략을 수립하세요: 🏁 Script executed: #!/bin/bash
# Description: Check for existing null storeId values and SUPER_ADMIN users in the codebase
# Check for database migration files that handle this constraint
fd -e sql -e xml | xargs grep -l "storeId" | head -5
# Check for SUPER_ADMIN role usage to understand business logic
rg "SUPER_ADMIN" --type java -A 3 -B 3
# Check for User entity creation patterns to ensure storeId is always set
ast-grep --pattern 'User.builder()$$$build()'Length of output: 13134 데이터베이스 마이그레이션 및 사용자 생성 로직 검증 필요 이번 변경으로
🤖 Prompt for AI Agents |
||
| private Long storeId; | ||
|
|
||
| @Builder | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
null 안전성 검증 추가 필요
권한 검증 로직이 올바르게 구현되었으나,
user.getStoreId()가 null인 경우 NullPointerException이 발생할 수 있습니다.public ReservationStatusSummaryDto getReservationListByStoreId(Long storeId, MemberDetails memberDetails) { User user = userRepository.findById(memberDetails.getId()).orElseThrow(UserNotFoundException::new); - if (!Role.SUPER_ADMIN.equals(user.getRole()) && !user.getStoreId().equals(storeId)) { + if (!Role.SUPER_ADMIN.equals(user.getRole()) && (user.getStoreId() == null || !user.getStoreId().equals(storeId))) { throw new ReservationViewUnauthorizedException(); }🤖 Prompt for AI Agents