Skip to content

fix: 고객 전용 기능 역할 판별 보완 - #58

Merged
juengseulki merged 1 commit into
devfrom
fix/customer-role-guard
Aug 3, 2026
Merged

fix: 고객 전용 기능 역할 판별 보완#58
juengseulki merged 1 commit into
devfrom
fix/customer-role-guard

Conversation

@juengseulki

@juengseulki juengseulki commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

📋 작업 내용

  • 고객 전용 견적·리뷰 영역에서 API/화면 접근 조건을 !MOVER 제외 방식에서 role === "CUSTOMER" 명시 확인으로 변경했습니다.
  • ADMIN·역할 미확정 사용자가 고객으로 취급되어 고객 API를 호출할 수 있던 문제를 보완했습니다.

🔥 변경 사항

  • useCustomerAuthReady: canFetch!isPending && isAuthenticated && isCustomer로 변경하고 isCustomer를 반환합니다.
  • CustomerAuthGate: CUSTOMER가 아닌 로그인 사용자를 getRoleHomePath(user?.role)로 리다이렉트합니다. (ADMIN 홈은 기존 임시 정책 유지)
  • 변경 파일: src/hooks/useCustomerAuthReady.ts, src/components/auth/CustomerAuthGate.tsx

✅ 체크리스트

  • 로컬에서 정상 동작을 확인했습니다.
  • 기존 기능에 영향을 주지 않는지 확인했습니다.
  • 불필요한 console.log를 제거했습니다.
  • lint를 통과했습니다.
  • README 또는 문서를 수정했습니다. (필요 시)
  • API 명세와 일치하는지 확인했습니다.

📷 스크린샷 (선택)

UI 변경 없음


🔗 관련 이슈

Closes #


💬 To Reviewer

  • canFetch가 이제 CUSTOMER일 때만 true입니다. 견적/리뷰 Query enabled는 기존처럼 canFetch를 쓰므로 Hook 개별 수정은 없습니다.
  • ADMIN 리다이렉트 목적지는 getRoleHomePath의 임시 정책(기사님 찾기)을 그대로 사용했습니다. 관리자 전용 홈이 정해지면 redirect 쪽만 조정하면 됩니다.
  • AuthProvider / RoleGuard / useAuthStore는 수정하지 않았습니다.

Summary by CodeRabbit

  • 버그 수정
    • 고객 전용 화면의 접근 권한 확인을 개선했습니다.
    • 고객이 아닌 인증 사용자는 자신의 역할에 맞는 화면으로 자동 이동합니다.
    • 고객 권한이 확인된 경우에만 관련 데이터를 불러오도록 수정했습니다.
    • 관리자 및 기타 역할의 접근 경로 처리를 명확히 해 잘못된 화면 표시를 줄였습니다.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6eb2332a-4f28-40c8-8dd8-42c462e15854

📥 Commits

Reviewing files that changed from the base of the PR and between e4d18e1 and bd4734f.

📒 Files selected for processing (2)
  • src/components/auth/CustomerAuthGate.tsx
  • src/hooks/useCustomerAuthReady.ts

📝 Walkthrough

Walkthrough

인증 준비 훅은 명시적 CUSTOMER 역할을 확인합니다. 고객 인증 게이트는 고객이 아닌 인증 사용자를 실제 역할별 홈 경로로 이동합니다. isCustomer와 사용자 역할이 관련 effect 의존성에 포함됩니다.

Changes

고객 인증 흐름

Layer / File(s) Summary
CUSTOMER 역할 판별 계약
src/hooks/useCustomerAuthReady.ts
isCustomer를 추가했습니다. canFetch는 인증 준비 완료, 인증 상태, CUSTOMER 역할을 모두 요구합니다.
역할별 고객 게이트 라우팅
src/components/auth/CustomerAuthGate.tsx
인증된 사용자가 CUSTOMER가 아니면 user?.rolegetRoleHomePath에 전달합니다. effect 의존성에 isCustomer와 사용자 역할을 추가했습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: 9g-g9

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 고객 전용 기능의 역할 판별을 CUSTOMER 명시 확인 방식으로 보완하는 변경을 정확히 요약합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/customer-role-guard

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

@9g-g9 9g-g9 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.

!isMover 부분을 좀 더 명확하게 정의하여 admin 과 역할 미확정 역할까지 판단하여 처리하는 방향으로 이해했습니다!
좀 더 고객 API 호출 범위가 명확해지고 좀 더 코드 상으로 잘 보이게끔 된 것 같습니다.

제 쪽에서 useMoverAuthReady 를 추가하고 있었기 때문에 수정하신 사항 가져갈 수 있도록 해보겠습니다!

보완 수정 고생 많으셨습니다! 👍

@juengseulki
juengseulki merged commit e437107 into dev Aug 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants