fo bo 머지작업
This commit is contained in:
@@ -40,19 +40,22 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
||||
|
||||
|
||||
//쿠키 쇼핑몰 코드 없을 경우 쿠키 생성 및 쇼핑몰코드 변수저장
|
||||
if(!StringUtils.hasText(cookieAuthSopmalCd)){
|
||||
if (!StringUtils.hasText(cookieAuthSopmalCd)) {
|
||||
//통합관리자인경우
|
||||
if("ADMIN".equals(RealmContextHolder.getSopmalCdRealm())){
|
||||
CookieUtils.createCookie("authSopmalCd", "SYS", "/admin", true, request, response);
|
||||
if ("ADMIN".equals(RealmContextHolder.getSopmalCdRealm())) {
|
||||
CookieUtils.createCookie("authSopmalCd", "SYS", "/", true, request, response);
|
||||
cookieAuthSopmalCd = "SYS";
|
||||
|
||||
}else{
|
||||
CookieUtils.createCookie("authSopmalCd", RealmContextHolder.getSopmalCdRealm(), "/mngr", true, request, response);
|
||||
cookieAuthSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||
} else {
|
||||
/*쿠키에 authSopmalCd가 없으면 초기화*/
|
||||
if(StringUtil.isEmpty(cookieAuthSopmalCd)){
|
||||
CookieUtils.createCookie("authSopmalCd", RealmContextHolder.getSopmalCdRealm(), "/", true, request, response);
|
||||
cookieAuthSopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
|
||||
//관리자 권한 조회
|
||||
@@ -60,7 +63,7 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
||||
|
||||
//해당 페이지에 접근권한이 없으면 alert
|
||||
boolean result = false;
|
||||
if(authChk){
|
||||
if (authChk) {
|
||||
AuthVO authVO = new AuthVO();
|
||||
authVO.setMngrInnb(user.getUserInnb());
|
||||
authVO.setSopmalCd(cookieAuthSopmalCd);
|
||||
@@ -68,21 +71,19 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
||||
String url = request.getRequestURI();
|
||||
authVO.setFnctUri(url.equals("/") ? url + RealmContextHolder.getRealm().toLowerCase() : url);
|
||||
|
||||
// if("itrnt".equalsIgnoreCase(cookieAuthSopmalCd)){ //인트라넷 일 경우
|
||||
// authVO.setStrOperDv(user.getStrOperDv());
|
||||
// authVO.setTentGroup(user.getTentGroup());
|
||||
// authVO.setReprsntBrand(user.getReprsntBrand());
|
||||
//
|
||||
// result = authService.selectItrntAuthorSiteAt(authVO);
|
||||
// }else{
|
||||
//관리자 + 통합관리자 일 경우
|
||||
if ("itrnt".equalsIgnoreCase(cookieAuthSopmalCd)) { //인트라넷 일 경우
|
||||
authVO.setStrOperDv(user.getStrOperDv());
|
||||
authVO.setTentGroup(user.getTentGroup());
|
||||
authVO.setReprsntBrand(user.getReprsntBrand());
|
||||
|
||||
result = authService.selectItrntAuthorSiteAt(authVO);
|
||||
} else {
|
||||
//관리자 + 통합관리자 일 경우
|
||||
result = authService.selectAuthorSiteAt(authVO);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!result){
|
||||
|
||||
if (!result) {
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
response.getWriter().write("<script>alert('해당페이지에 접근 권한이 없습니다. 관리자에게 문의하세요.'); window.history.back();</script>");
|
||||
@@ -91,45 +92,43 @@ public class MngrAuthInterceptor implements HandlerInterceptor{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 업무관리자 쇼핑몰 권한 조회
|
||||
* @param request req
|
||||
* @param response res
|
||||
* @param user 유저정보
|
||||
*/
|
||||
private boolean mngrAuthChk(HttpServletRequest request, HttpServletResponse response, AnonymousUser user){
|
||||
//권한 리스트 조회
|
||||
AuthVO authVO = new AuthVO();
|
||||
authVO.setMngrInnb(user.getUserInnb());
|
||||
List<String> sopmalList = authService.selectAuthorSopmalList(authVO);
|
||||
logger.debug("sopmalList {}", sopmalList);
|
||||
//로그인 요청 쇼핑몰 param 조회
|
||||
String queryString = request.getParameter("authSopmalCd");
|
||||
logger.debug("authSopmalCd param :: {}", queryString);
|
||||
//권한 리스트에 로그인 요청 쇼핑몰 param이 포함되면
|
||||
/**
|
||||
* 업무관리자 쇼핑몰 권한 조회
|
||||
* @param request req
|
||||
* @param response res
|
||||
* @param user 유저정보
|
||||
*/
|
||||
private boolean mngrAuthChk (HttpServletRequest request, HttpServletResponse response, AnonymousUser user){
|
||||
//권한 리스트 조회
|
||||
AuthVO authVO = new AuthVO();
|
||||
authVO.setMngrInnb(user.getUserInnb());
|
||||
List<String> sopmalList = authService.selectAuthorSopmalList(authVO);
|
||||
logger.debug("sopmalList {}", sopmalList);
|
||||
//로그인 요청 쇼핑몰 param 조회
|
||||
String queryString = request.getParameter("authSopmalCd");
|
||||
logger.debug("authSopmalCd param :: {}", queryString);
|
||||
//권한 리스트에 로그인 요청 쇼핑몰 param이 포함되면
|
||||
|
||||
String authSopmalCd = "";
|
||||
if (!StringUtil.isEmpty(queryString) && sopmalList.contains(queryString)) {
|
||||
// 로그인 요청 쇼핑몰 param 저장
|
||||
authSopmalCd = queryString;
|
||||
String authSopmalCd = "";
|
||||
if (!StringUtil.isEmpty(queryString) && sopmalList.contains(queryString)) {
|
||||
// 로그인 요청 쇼핑몰 param 저장
|
||||
authSopmalCd = queryString;
|
||||
|
||||
} else {
|
||||
//쿠키에 권한 리스트중 첫번째 쇼핑몰 param 저장
|
||||
if (!sopmalList.isEmpty()) {
|
||||
authSopmalCd = sopmalList.get(0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
//쿠키에 권한 리스트중 첫번째 쇼핑몰 param 저장
|
||||
if(!sopmalList.isEmpty()){
|
||||
authSopmalCd = sopmalList.get(0);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
CookieUtils.createCookie("authSopmalCd", authSopmalCd, "/", true, request, response);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CookieUtils.createCookie("authSopmalCd", authSopmalCd, "/mngr", true, request, response);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user