Skip to content

Fix: 어드민 - 멘토 권한 API 허용#91

Merged
minsoo0506 merged 5 commits intodevfrom
fix/mentor-admin
Mar 1, 2026
Merged

Fix: 어드민 - 멘토 권한 API 허용#91
minsoo0506 merged 5 commits intodevfrom
fix/mentor-admin

Conversation

@tember8003
Copy link
Collaborator

@tember8003 tember8003 commented Mar 1, 2026

변경사항

어드민 권한일 경우, 아래 API들을 사용할 수 있도록 validate 검증을 수정했습니다.

아래 API들을 어드민도 사용할 수 있습니다. 사실상 거의 대부분의 API를 활용할 수 있도록 열어뒀습니다

코드가 많이 바뀌지 않아, 잘 돌아갈 것이라고 생각해 테스트 코드만 작성했으며, 실제 postman을 통한 API 테스트는 진행하지 않았습니다.

GET	/api/v1/group/{groupId}/plan
GET	/api/v1/group/{groupId}/plan/{planId}
GET	/api/v1/group/{groupId}/assignment/submit/{planId}	
GET	/api/v1/group/{groupId}/assignment/submit/{planId}/submission/{submitId}
GET	/api/v1/group/{groupId}/activity-list
GET	/api/v1/group/{groupId}/member
GET	/api/v1/group/{groupId}/attendance/week/{week}
GET	/api/v1/group/{groupId}/attendance/all-weeks	
GET	/api/v1/group/{groupId}/assignment-plan
GET	/api/v1/group/{groupId}/assignment/submit/{planId}/status/{status}
GET	/api/v1/group/{groupId}/info	
POST	/api/v1/group/{groupId}/plan/{planId}/create-comment
PUT	/api/v1/group/{groupId}/plan/{planId}/comment/{commentId}
DELETE  /api/v1/group/{groupId}/plan/{planId}/comment/{commentId}
GET	/api/v1/group/{groupId}/mentee/warn	
GET	/api/v1/group/{groupId}/assignment/submit/{planId}/statistics
POST	/api/v1/group/{groupId}/assignment/submit/{planId}/submission/{submitId}/feedback	
PUT	/api/v1/group/{groupId}/assignment/submit/{planId}/submission/{submitId}/feedback	
DELETE  /api/v1/group/{groupId}/assignment/submit/{planId}/submission/{submitId}/feedback	
POST	/api/v1/group/{groupId}/attendance/{studentNumber}
POST	/api/v1/group/{groupId}/create-activity
PUT	/api/v1/group/{groupId}/activity/{activityId}
DELETE  /api/v1/group/{groupId}/activity/{activityId}
PUT	/api/v1/mentor/group/{groupId}
POST	/api/v1/mentor/group/{groupId}/create-plan
PUT	/api/v1/mentor/group/{groupId}/plan/{planId}	
DELETE  /api/v1/mentor/group/{groupId}/plan/{planId}
POST	/api/v1/mentor/warn/{groupId}/{studentNumber}
POST	/api/v1/mentor/group/{groupId}/add-member/{studentNumber}
DELETE  /api/v1/mentor/group/{groupId}/delete-member/{studentNumber}

테스트

ValidationUtilsAdminBypassTest

ValidationUtils의 권한 검증 메서드에 대한 어드민 bypass 단위 테스트

validateGroupMembership() - 그룹 멤버십 검증

  • 어드민은 group_member 테이블에 없어도 통과하는지
  • 일반 유저는 그룹 멤버이면 통과하는지
  • 일반 유저는 그룹 멤버가 아니면 STUDY_USER_NOT_FOUND 예외가 발생하는지

validateBasicAccess() - 기본 접근 검증 (복합 흐름) (기본 접근 검증 (사용자, 스터디 그룹 존재, 멤버십))

  • 어드민은 그룹 멤버가 아니어도 validateBasicAccess 전체 흐름을 통과하는지
  • 일반 유저는 그룹 멤버이면 통과하는지
  • 일반 유저는 그룹 멤버가 아니면 예외가 발생하는지

validateMentorAccess() - 멘토 접근 검증 (복합 흐름) (멘토 접근 검증 (사용자 존재, 스터디 그룹 존재, 멘토 권한))

  • 어드민은 그룹 멤버가 아니어도 validateMentorAccess 전체 흐름을 통과하는지
  • 일반 유저가 MENTOR 역할이면 통과하는지

validateMentorRole() - 멘토 역할 검증

  • 어드민은 그룹 멤버가 아니어도 멘토 역할 체크를 통과하는지
  • 일반 유저가 MENTOR 역할이면 통과하는지
  • 일반 유저가 MENTEE 역할이면 UNAUTHORIZED_MENTOR_ROLE 예외가 발생하는지
  • 일반 유저가 그룹에 속하지 않으면 STUDY_USER_NOT_FOUND 예외가 발생하는지

validateMenteeRole() - 멘티 역할 검증 (리그레션) (멘티 접근 검증 (사용자 존재, 스터디 그룹 존재, 멘티 권한))

  • 어드민도 group_member 테이블에 없으면 멘티 역할 체크에서 막히는지
    (과제 제출/수정/삭제 같은 멘티 전용 작업은 어드민도 불가함을 보장)

MentorServiceAdminBypassTest

MentorService의 creator 체크 및 쓰기 작업에 대한 어드민 bypass 단위 테스트

checkMentor() - 멘토(creator) 확인

  • 어드민은 그룹 creator가 아니어도 StudyGroup을 반환하는지
  • 일반 유저가 그룹 creator이면 StudyGroup을 반환하는지
  • 일반 유저가 그룹 creator가 아니면 MENTOR_ONLY_CAN_DELETE_MEMBER 예외가 발생하는지
  • 존재하지 않는 유저면 USER_NOT_FOUND 예외가 발생하는지
  • 존재하지 않는 그룹이면 STUDY_NOT_FOUND 예외가 발생하는지

warnMember() - 멘티 경고 부여

  • 어드민은 creator가 아니어도 멘티에게 경고를 부여할 수 있는지
  • 경고 3회 누적 시 멤버가 자동 퇴출되는지

addMember() - 멤버 추가

  • 어드민은 creator가 아니어도 멤버를 추가할 수 있는지
  • 이미 그룹에 있는 멤버를 추가하면 ALREADY_JOINED_GROUP 예외가 발생하는지

deleteMember() - 멤버 삭제

  • 어드민은 creator가 아니어도 멤버를 삭제할 수 있는지

이거 통과되면 바로 프로젝트 구조를 좀 수정하려고 합니다.
image


깃허브 액션 Security 수정

문제

  • aquasecurity/trivy-action이 내부적으로 setup-trivy를 통해 aquasecurity/trivy 레포의 main 브랜치를 클론하려다 실패 (fatal: couldn't find remote ref refs/heads/main)
  • trivy-action 버전 업그레이드(0.28.0 → 0.34.1)로도 해결되지 않음 (동일한 내부 로직)

해결

  • skip-setup-trivy: true 옵션을 추가해 setup-trivy 단계를 건너뜀
  • Aqua Security 공식 deb 레포를 통해 apt로 Trivy를 직접 설치하도록 변경 - 적용 대상: filesystem scan, image scan 모두

@tember8003
Copy link
Collaborator Author

엥 왜 실패해요

Copy link
Collaborator

@minsoo0506 minsoo0506 left a comment

Choose a reason for hiding this comment

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

확인했습니다 :) 매번 감사합니다 유찬 선생...

@minsoo0506 minsoo0506 merged commit 6a2cd65 into dev Mar 1, 2026
6 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