-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(host) : 호스트 권한 검증 aop #250
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
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.
AOP 구현 잘봤습니다
public Long getEventId(String[] parameterNames, Object[] args, String paramName) { | ||
for (int i = 0; i < parameterNames.length; i++) { | ||
if (parameterNames[i].equals(paramName)) { | ||
// 롱타입이라 가정. 안되면 classCastException 터트림 | ||
return (Long) args[i]; | ||
} | ||
} | ||
throw new IllegalArgumentException(); | ||
} |
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.
메소드 파라미터에 eventId 가 없는 경우에도 검증이 되나요?
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.
네넹 IllegalArgumentException 입니당
@Transactional(readOnly = true) | ||
public Object proceed(Long eventId, HostQualification role, final ProceedingJoinPoint joinPoint) | ||
throws Throwable { | ||
Long currentUserId = userUtils.getCurrentUserId(); | ||
Event event = eventAdaptor.findById(eventId); | ||
Host host = hostAdaptor.findById(event.getHostId()); | ||
role.validQualification(currentUserId, host); | ||
return joinPoint.proceed(); | ||
} |
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.
요기서 되는건가
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.
잘써먹겠습니다 굿굿😸
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.
좋네요 적용해서 리팩 하겠습니다
개요
작업사항
제일 중요한 부분은 아래 부분입니다,
사용방법
위 세가지 값을 명시적으로 적어주시면 됩니다.
변경로직