-
Notifications
You must be signed in to change notification settings - Fork 13
[core] (step-5) 게시글 권한 부여 [게시글 열람, 수정, 삭제 권한] #118
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
base: core
Are you sure you want to change the base?
Conversation
qan/form.html 파일에서 작성자 입력 필드 삭제
askQuestion() 메소드 생성한 후 Session을 가지고 와서 null인 경우 로그인 페이지로 리다이렉트 실행
일치하지 않을 경우 '글 작성자만 수정할 수 있습니다' 오류페이지로 이동
로그인한 계정의 게시글을 삭제 시도할 경우 실패 페이지가 나옴
값이 null일 경우 EmptyResultDataAccessException이 발생하도록 수정함
| public String login(Member member, HttpSession httpSession) { | ||
| Member loginMember = memberService.findOneMemberByEmail(member.getEmail()).orElse(null); | ||
| Member loginMember = memberService.findOneMemberByEmail(member.getEmail()).orElseThrow(() -> new EmptyResultDataAccessException(1)); | ||
| if (loginMember != null && memberService.checkMember(loginMember, member)) { |
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.
loginMember != null 코드는 의미가 없기 때문에 제거해 주는 게 좋습니다. 왜 그런지 생각해 보세요.
| @GetMapping("/qna/article") | ||
| public String askQuestion(HttpSession httpSession) { |
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.
| @GetMapping("/qna/article") | |
| public String askQuestion(HttpSession httpSession) { | |
| @GetMapping("/qna/articleForm") | |
| public String askQuestionForm(HttpSession httpSession) { |
form 을 리턴해 주는 경우 명시적으로 URL 등에 form 이 들어가는 게 좋을 것 같아요.
| @PostMapping("/qna/ask") | ||
| public String registerArticle(Article article) { | ||
| public String registerArticle(Article article, HttpSession httpSession) { | ||
| Member loginMember = (Member) httpSession.getAttribute("sessionedUser"); |
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.
여기도 로그인이 안 되었을 경우 처리가 필요합니다.
honux77
left a comment
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.
지금 보면 글쓰기나 업데이트 요청 등에 권한 검증이 제대로 안 되어 있는 것 같아요.
추후 다음 단계에서 수정해 보세요.
honux77
left a comment
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.
마지막이라 approve 했다가 아무래도 아니라서 변경 요청 보냈습니다. 추후 업데이트해주세요.
1. 피드백 반영
2. Have Done
3. 느낀 점
4. 궁금한 점