권한 처리 정리

This commit is contained in:
KNKIM 2021-11-16 18:08:14 +09:00
parent c7e3a6809d
commit 0ed45808a4
2 changed files with 14 additions and 304 deletions

View File

@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -67,6 +68,7 @@ public class ReadController extends NlibCommonController {
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Secured("ROLE_USER")
@RequestMapping(value={"/read/confirmReadFromCart.do", "/read/confirmRead.do"}) @RequestMapping(value={"/read/confirmReadFromCart.do", "/read/confirmRead.do"})
public String confirmRent(HttpServletRequest request, CollectionVO readVO, ModelMap model) throws Exception { public String confirmRent(HttpServletRequest request, CollectionVO readVO, ModelMap model) throws Exception {
@ -107,6 +109,7 @@ public class ReadController extends NlibCommonController {
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Secured("ROLE_USER")
@RequestMapping(value={"/read/insertReadItemsFromCart.do", "/read/insertReadItems.do"}) @RequestMapping(value={"/read/insertReadItemsFromCart.do", "/read/insertReadItems.do"})
public String insertReadItems(HttpServletRequest request, CollectionVO readVO, ModelMap model) throws Exception { public String insertReadItems(HttpServletRequest request, CollectionVO readVO, ModelMap model) throws Exception {
@ -170,6 +173,7 @@ public class ReadController extends NlibCommonController {
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Secured("ROLE_USER")
@RequestMapping("/read/listReadItems.do") @RequestMapping("/read/listReadItems.do")
public String listReadItems(HttpServletRequest request, CollectionVO searchVO, ModelMap model, String message) throws Exception { public String listReadItems(HttpServletRequest request, CollectionVO searchVO, ModelMap model, String message) throws Exception {
@ -199,8 +203,9 @@ public class ReadController extends NlibCommonController {
* @param req * @param req
* @return * @return
*/ */
@Secured("ROLE_USER")
@RequestMapping(value="/read/listReadItemsAjax.do") @RequestMapping(value="/read/listReadItemsAjax.do")
public ResponseEntity<String> listRentItemsAjax( public ResponseEntity<String> listReadItemsAjax(
HttpServletRequest request, HttpServletRequest request,
@RequestBody CollectionVO searchVO) { @RequestBody CollectionVO searchVO) {
@ -253,8 +258,9 @@ public class ReadController extends NlibCommonController {
return makeResponseEntityJson(retMap); return makeResponseEntityJson(retMap);
} }
@Secured("ROLE_USER")
@RequestMapping(value="/read/cancelReadItemAjax.do") @RequestMapping(value="/read/cancelReadItemAjax.do")
public ResponseEntity<String> cancelRentItemAjax( public ResponseEntity<String> cancelReadItemAjax (
HttpServletRequest request, HttpServletRequest request,
@RequestBody CollectionVO searchVO) { @RequestBody CollectionVO searchVO) {

View File

@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
@ -81,6 +82,7 @@ public class RentController extends NlibCommonController
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Secured("ROLE_USER")
@RequestMapping("/rent/listRentItems.do") @RequestMapping("/rent/listRentItems.do")
public String listRentItems(HttpServletRequest request, CollectionVO searchVO, ModelMap model, String message) throws Exception { public String listRentItems(HttpServletRequest request, CollectionVO searchVO, ModelMap model, String message) throws Exception {
@ -110,6 +112,7 @@ public class RentController extends NlibCommonController
* @param req * @param req
* @return * @return
*/ */
@Secured("ROLE_USER")
@RequestMapping(value="/rent/listRentItemsAjax.do") @RequestMapping(value="/rent/listRentItemsAjax.do")
public ResponseEntity<String> listRentItemsAjax( public ResponseEntity<String> listRentItemsAjax(
HttpServletRequest request, HttpServletRequest request,
@ -164,7 +167,7 @@ public class RentController extends NlibCommonController
return makeResponseEntityJson(retMap); return makeResponseEntityJson(retMap);
} }
@Secured("ROLE_USER")
@RequestMapping(value="/rent/cancelRentItemAjax.do") @RequestMapping(value="/rent/cancelRentItemAjax.do")
public ResponseEntity<String> cancelRentItemAjax( public ResponseEntity<String> cancelRentItemAjax(
HttpServletRequest request, HttpServletRequest request,
@ -213,6 +216,7 @@ public class RentController extends NlibCommonController
return makeResponseEntityJson(retMap); return makeResponseEntityJson(retMap);
} }
@Secured("ROLE_USER")
@RequestMapping(value={"/rent/confirmRentFromCart.do", "/rent/confirmRent.do"}) @RequestMapping(value={"/rent/confirmRentFromCart.do", "/rent/confirmRent.do"})
public String confirmRent(HttpServletRequest request, CollectionVO rentVO, ModelMap model) throws Exception { public String confirmRent(HttpServletRequest request, CollectionVO rentVO, ModelMap model) throws Exception {
@ -241,6 +245,7 @@ public class RentController extends NlibCommonController
return "nlib/rent/confirmRent"; return "nlib/rent/confirmRent";
} }
@Secured("ROLE_USER")
@RequestMapping(value={"/rent/insertRentItemsFromCart.do", "/rent/insertRentItems.do"}) @RequestMapping(value={"/rent/insertRentItemsFromCart.do", "/rent/insertRentItems.do"})
public String insertRentItems(HttpServletRequest request, CollectionVO rentVO, ModelMap model) throws Exception { public String insertRentItems(HttpServletRequest request, CollectionVO rentVO, ModelMap model) throws Exception {
@ -277,305 +282,4 @@ public class RentController extends NlibCommonController
return retJsp; return retJsp;
} }
//
//
// /** 대출 목록 화면을 호출한다.
// * @param req
// * @return
// */
// @RequestMapping("/rent/listCanceledRentItems.do")
// public String listCanceledRentItems(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// // 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// return "nlib/rent/listCanceledRentItems";
// }
//
// /**
// * 대출 취소 목록을 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/rent/listCanceledRentItemsAjax.do")
// public ResponseEntity<String> listCanceledRentItemsAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.putInfoItem("searchKeyword", searchKeyword);
//
// // 요청
// DataApiResVO resVO = rentService.listCanceledRentItems(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
// /** 반납 연기 화면을 호출한다.
// * @param req
// * @return
// */
// @RequestMapping("/rent/listPostpones.do")
// public String listPostpones(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// // 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// return "nlib/rent/listPostpones";
// }
//
// /**
// * 반납 연기 목록을 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/rent/listPostponesAjax.do")
// public ResponseEntity<String> listPostponesAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.putInfoItem("searchKeyword", searchKeyword);
//
// // 요청
// DataApiResVO resVO = rentService.listPostpones(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
// public ModelMap listCanceledRentItems(HttpServletRequest req) {
// return null;
// }
//
// /** 대출 예약 화면을 호출한다.
// * @param req
// * @return
// */
// @RequestMapping("/rent/listReservations.do")
// public String listReservations(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// // 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// return "nlib/rent/listReservations";
// }
//
// /**
// * 대출 예약 목록을 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/rent/listReservationsAjax.do")
// public ResponseEntity<String> listReservationsAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.putInfoItem("searchKeyword", searchKeyword);
//
// // 요청
// DataApiResVO resVO = rentService.listReservations(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
// public ModelMap cancelReservations(HttpServletRequest req) {
// return null;
// }
//
// /**
// * 열람 요청 화면을 호출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/rent/listRequestsForViewingItem.do")
// public String listRequestsForViewingItem(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// // 페이징 사이즈 코드 목록 조회 (DB방식으로 변경 2021.08.06 KNKIM)
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// return "nlib/rent/listRequestsForViewingItem";
// }
//
// /**
// * 열람 요청 목록을 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/rent/listRequestsForViewingItemAjax.do")
// public ResponseEntity<String> listRequestsForViewingItemAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.putInfoItem("searchKeyword", searchKeyword);
//
// // 요청
// DataApiResVO resVO = rentService.listRequestsForViewingItem(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
// /**
// * 묻고답하기 상세 내용 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/rent/selectRequestInfoForViewingItem.do")
// public String selectRequestInfoForViewingItem(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) {
//
// // 목록 이동시 전달할 매개변수
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = paramMap.get("pageIndex");
// String pageSize = paramMap.get("pageSize");
// String message = paramMap.get("message");
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// log.debug("selectRequestInfoForViewingItem > pageIndex = " + pageIndex);
// log.debug("selectRequestInfoForViewingItem > pageSize = " + pageSize);
// log.debug("selectRequestInfoForViewingItem > searchKeyword = " + searchKeyword);
// log.debug("selectRequestInfoForViewingItem > articleNo = " + articleNo);
// log.debug("selectRequestInfoForViewingItem > message = " + message);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.putInfoItem("boardNo", "QNA"); // 게시판ID
// reqVO.putInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = rentService.selectRequestInfoForViewingItem(reqVO);
//
// // 반환 정보
// model.addAttribute("articleNo" , articleNo);
// model.addAttribute("article" , resVO.getInfo()); // 게시물 상세
// model.addAttribute("preArticle" , resVO.getList(DataApiVO.XML_EL_NAME_RECORD).get(0)); // 이전글 정보
// model.addAttribute("nextArticle" , resVO.getList(DataApiVO.XML_EL_NAME_RECORD).get(1)); // 다음글 정보
// model.addAttribute("message" , message);
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
//
// return "nlib/rent/selectRequestInfoForViewingItem";
// }
} }