Skip to content

fix: 관리자 페이지 접근 제어 추가#43

Merged
koreahghg merged 2 commits intomainfrom
fix/main
Dec 29, 2025
Merged

fix: 관리자 페이지 접근 제어 추가#43
koreahghg merged 2 commits intomainfrom
fix/main

Conversation

@koreahghg
Copy link
Collaborator

💡 배경 및 개요

PR을 하게 된 문제상황, 배경 및 개요에 대해서 작성해주세요!

퍼블리싱의 경우 스크린샷/동영상도 추가해주면 좋아요!

Resolves: #{이슈번호}

📃 작업내용

PR에서 한 작업을 작성해주세요!

🙋‍♂️ 리뷰노트

구현 시에 고민이었던 점들 혹은 특정 부분에 대한 의도가 있었다면 PR 리뷰의 이해를 돕기 위해 서술해주세요!

또한 리뷰어에게 특정 부분에 대한 집중 혹은 코멘트 혹은 질문을 요청하는 경우에 작성하면 좋아요!

e.g. 작업을 끝내야할 시간이 얼마 없어 확장성보다는 동작을 위주로 만들었어요! 감안하고 리뷰해주세요!

✅ PR 체크리스트

템플릿 체크리스트 말고도 추가적으로 필요한 체크리스트는 추가해주세요!

  • 이 작업으로 인해 변경이 필요한 문서가 변경되었나요? (e.g. .env, 노션, README)
  • 이 작업을 하고나서 공유해야할 팀원들에게 공유되었나요? (e.g. "API 개발 완료됐어요", "환경값 추가되었어요")
  • 작업한 코드가 정상적으로 동작하나요?
  • Merge 대상 브랜치가 올바른가요?
  • PR과 관련 없는 작업이 있지는 않나요?

🎸 기타

@vercel
Copy link

vercel bot commented Dec 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cklob-gami Ready Ready Preview, Comment Dec 29, 2025 5:24am

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @koreahghg, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 관리자 페이지에 대한 역할 기반 접근 제어를 도입하여 애플리케이션의 보안을 강화합니다. 기존 ProtectedRoute 컴포넌트를 확장하여 특정 역할이 필요한 경로에 대한 접근을 관리할 수 있도록 했으며, 이를 통해 'ADMIN' 역할이 없는 사용자는 관리자 페이지에 접근할 수 없게 됩니다. 이는 사용자 권한 관리를 더욱 견고하게 만듭니다.

Highlights

  • 관리자 페이지 접근 제어 추가: /admin 경로에 ProtectedRoute를 적용하여 관리자 페이지에 대한 역할 기반 접근 제어를 구현했습니다. 이제 'ADMIN' 역할을 가진 사용자만 관리자 페이지에 접근할 수 있습니다.
  • ProtectedRoute 기능 확장: ProtectedRoute 컴포넌트에 requiredRole prop이 추가되어, 특정 역할(들)이 필요한 경로에 대한 접근을 제어할 수 있게 되었습니다.
  • 역할 미달 시 404 페이지로 리디렉션: 사용자가 필요한 역할을 가지고 있지 않을 경우, ProtectedRoute는 해당 사용자를 NotFound 페이지로 리디렉션하여 무단 접근을 방지합니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 PR은 관리자 페이지에 대한 접근 제어를 추가하기 위해 ProtectedRoute 컴포넌트를 수정하고 이를 /admin 경로에 적용했습니다. 전반적으로 변경 사항은 올바르며, 역할 기반 접근 제어 로직이 잘 구현되었습니다.

ProtectedRoute 컴포넌트의 역할 확인 로직을 더 간결하고 유지보수하기 쉽게 개선할 수 있는 부분을 발견하여 코드 제안을 남겼습니다. 해당 제안을 검토해보시는 것을 추천합니다.

Comment on lines +21 to +29
const userRoles: string[] = Array.isArray(user?.role)
? (user?.role as string[])
: user?.role
? [user.role as string]
: [];

const required = Array.isArray(requiredRole)
? requiredRole
: [requiredRole];
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

역할(role)을 배열로 변환하는 로직을 더 간결하게 개선할 수 있습니다. userRolesrequired를 초기화하는 부분을 Array.prototype.flat()을 사용하여 더 간단하고 읽기 쉽게 만들 수 있습니다.

user.rolestring, string[], 또는 undefined일 수 있고, requiredRolestring 또는 string[]일 수 있습니다. flat() 메소드는 이러한 경우를 효과적으로 처리하여 코드를 단순화합니다.

    const userRoles = [user?.role].flat().filter(Boolean);
    const required = [requiredRole].flat();

@koreahghg koreahghg merged commit b75bc0f into main Dec 29, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants