From 305ed922ac055b816a6096d8fb1370f2071b0872 Mon Sep 17 00:00:00 2001 From: NEWSPRINGISGOOD Date: Tue, 16 Jan 2024 16:03:28 +0900 Subject: [PATCH] merge --- .../StudyFlexBE/controller/CategoryController.java | 2 -- .../StudyFlexBE/controller/MemberController.java | 2 -- .../StudyFlexBE/controller/NaverController.java | 8 +------- .../StudyFlexBE/controller/SearchController.java | 2 -- .../StudyFlexBE/controller/StudyController.java | 14 +++++++++++++- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/umc/StudyFlexBE/controller/CategoryController.java b/src/main/java/com/umc/StudyFlexBE/controller/CategoryController.java index 0eee030..bf44ac3 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/CategoryController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/CategoryController.java @@ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -19,7 +18,6 @@ import java.util.Map; @RestController -@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')") @RequestMapping("/app/category") public class CategoryController { private final CategoryService categoryService; diff --git a/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java b/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java index 62af5bc..c812043 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java @@ -19,7 +19,6 @@ import java.util.Map; @RestController -@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')") @RequestMapping("app/member") @RequiredArgsConstructor @Slf4j @@ -182,7 +181,6 @@ public BaseResponse test() { log.info(email); return new BaseResponse<>(BaseResponseStatus.SUCCESS, "굿"); } - @PostMapping("clear") public BaseResponse clearing() throws IOException { univCert.list(mail_api_key); diff --git a/src/main/java/com/umc/StudyFlexBE/controller/NaverController.java b/src/main/java/com/umc/StudyFlexBE/controller/NaverController.java index e6489e2..5964256 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/NaverController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/NaverController.java @@ -2,11 +2,7 @@ import com.umc.StudyFlexBE.config.jwt.JwtTokenProvider; import com.umc.StudyFlexBE.dto.request.NaverDto; -import com.umc.StudyFlexBE.dto.response.APICallException; -import com.umc.StudyFlexBE.dto.response.BaseResponse; -import com.umc.StudyFlexBE.dto.response.BaseResponseStatus; -import com.umc.StudyFlexBE.dto.response.InvalidAuthorizationCodeException; -import com.umc.StudyFlexBE.dto.response.LoginRes; +import com.umc.StudyFlexBE.dto.response.*; import com.umc.StudyFlexBE.entity.Member; import com.umc.StudyFlexBE.entity.MsgEntity; import com.umc.StudyFlexBE.service.NaverService; @@ -14,7 +10,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; @@ -28,7 +23,6 @@ @RequiredArgsConstructor @RestController -@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')") @RequestMapping("/app/naver") public class NaverController { diff --git a/src/main/java/com/umc/StudyFlexBE/controller/SearchController.java b/src/main/java/com/umc/StudyFlexBE/controller/SearchController.java index 6620e31..d395b12 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/SearchController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/SearchController.java @@ -7,7 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -17,7 +16,6 @@ import java.util.Map; @RestController -@PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_CERTIFIED','ROLE_USER')") @RequestMapping("/app/search") public class SearchController { private final SearchService searchService; diff --git a/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java b/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java index cd4d995..00ee496 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/StudyController.java @@ -15,7 +15,6 @@ import java.util.Map; @RestController -@PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") @RequestMapping("/app/studies") public class StudyController { private final StudyService studyService; @@ -27,6 +26,7 @@ public StudyController(StudyService studyService) { } @PostMapping + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse createStudy(@ModelAttribute StudyReq study){ try { StudyRes studyRes = studyService.createStudy(study, getEmail()); @@ -37,6 +37,7 @@ public BaseResponse createStudy(@ModelAttribute StudyReq study){ } @GetMapping("/checkName") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse checkDuplicateStudyName(@RequestParam String study_name){ try { studyService.checkDuplicateStudyName(study_name); @@ -47,6 +48,7 @@ public BaseResponse checkDuplicateStudyName(@RequestParam String study_name){ } @GetMapping("/{study_id}/checkAuthority") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse checkAuthority(@PathVariable Long study_id){ try{ StudyAuthorityType studyAuthorityType = studyService.checkAuthority(study_id, getEmail()); @@ -57,6 +59,7 @@ public BaseResponse checkAuthority(@PathVariable Long study_id){ } @PostMapping("/{study_id}/participation") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse participation(@PathVariable Long study_id){ try { StudyParticipationRes res = StudyParticipationRes.builder() @@ -67,6 +70,8 @@ public BaseResponse participation(@PathVariable Long study_id){ return new BaseResponse<>(e.getStatus()); } } + + // 아래 3개는 메인 페이지에 위치하기 때문에 회원가입 안 한 사람도 볼 수 있도록 @GetMapping("/latest") public BaseResponse getLatestStudies() { try { @@ -98,6 +103,7 @@ public BaseResponse getStudyRanking() { } @PostMapping("/{study_id}/postNotice") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse postStudyNotice( @PathVariable Long study_id, @RequestBody @Valid StudyNoticeReq studyNoticeReq){ @@ -110,6 +116,7 @@ public BaseResponse postStudyNotice( } @GetMapping("/{study_id}/notice/{notice_id}") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse getStudyNotice(@PathVariable Long study_id, @PathVariable Long notice_id){ try { StudyNoticeRes studyNotice = studyService.getStudyNotice(study_id, notice_id, getEmail()); @@ -120,6 +127,7 @@ public BaseResponse getStudyNotice(@PathVariable Long study_id, @PathVariable } @DeleteMapping("/{study_id}/notice/{notice_id}") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse deleteStudyNotice(@PathVariable Long study_id, @PathVariable Long notice_id){ try { studyService.deleteStudyNotice(study_id, notice_id, getEmail()); @@ -130,6 +138,7 @@ public BaseResponse deleteStudyNotice(@PathVariable Long study_id, @PathVaria } @GetMapping("/{study_id}/notice") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse getStudyNotices(@PathVariable Long study_id){ try { StudyNoticesInfoRes studyNotices = studyService.getStudyNotices(study_id, getEmail()); @@ -140,6 +149,7 @@ public BaseResponse getStudyNotices(@PathVariable Long study_id){ } @GetMapping("/{study_id}/completed") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse checkCompletedStudyWeek(@PathVariable Long study_id, @RequestParam int week){ try { ProgressRes progressReq = studyService.checkCompletedStudyWeek(study_id, week, getEmail()); @@ -150,6 +160,7 @@ public BaseResponse checkCompletedStudyWeek(@PathVariable Long study_id, @Req } @GetMapping("/{study_id}/progress") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse getStudyProgressList(@PathVariable Long study_id){ try { Map studyProgressList = studyService.getStudyProgressList(study_id, getEmail()); @@ -160,6 +171,7 @@ public BaseResponse getStudyProgressList(@PathVariable Long study_id){ } @GetMapping("/{study_id}/details") + @PreAuthorize("hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_CERTIFIED')") public BaseResponse getStudyDetail(@PathVariable Long study_id){ try { StudyDetailRes studyDetail = studyService.getStudyDetail(study_id);