feat: 권한관리-권한계층관리 반영

main
minuk926 2 years ago
parent e0c1a4da94
commit e6a3949960

@ -30,14 +30,21 @@ public interface AuthAuthorMgtMapper {
/** /**
* <pre> : </pre> * <pre> : </pre>
* *
* @param vo * @param paraMap
* @param rowBounds * @param rowBounds
* @return List<XitAuthRegMngVO> * @return List<XitAuthRegMngVO>
* @author: * @author:
* @date: 2020. 4. 16. * @date: 2020. 4. 16.
*/ */
List<XitAuthorInfoVO> selectAuthorInfos(final Map<String, Object> paraMap, final RowBounds rowBounds); <T> List<XitAuthorInfoVO> selectAuthorInfos(final Map<String,Object> paraMap, final RowBounds rowBounds);
List<XitAuthorInfoVO> selectAuthorInfos(final Map<String, Object> paraMap);
/**
*
* @param t Map VO generic (AuthHierarchy VO )
* @return
* @param <T>
*/
<T> List<XitAuthorInfoVO> selectAuthorInfos(final T t);
/** /**
* <pre> : </pre> * <pre> : </pre>

@ -25,34 +25,4 @@ public interface AuthHierarchyMgtMapper {
List<XitAuthHierarchyMngVO> selectAuthHierarchies(final Map<String, Object> paraMap, final RowBounds rowBounds); List<XitAuthHierarchyMngVO> selectAuthHierarchies(final Map<String, Object> paraMap, final RowBounds rowBounds);
/**
* <pre> : </pre>
* @param searchVO
* @return List<XitAuthHierarchyMngVO>
* @author:
* @date: 2020. 11. 2.
*/
public List<XitAuthHierarchyMngVO> findList(XitAuthHierarchyMngSearchVO searchVO) throws SQLException;
/**
* <pre> : </pre>
* @param searchVO
* @return int
* @author:
* @date: 2020. 11. 2.
*/
public int findListTotCnt(XitAuthHierarchyMngSearchVO searchVO) throws SQLException;
/**
* <pre> : </pre>
* @param vo
* @return XitAuthHierarchyMngVO
* @author:
* @date: 2020. 11. 2.
*/
public XitAuthHierarchyMngVO findView(XitAuthHierarchyMngVO vo) throws SQLException;
} }

@ -5,6 +5,7 @@ import java.util.Map;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import kr.xit.framework.biz.cmm.model.XitAuthorInfoVO;
import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngSearchVO; import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngSearchVO;
import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngVO; import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngVO;
@ -21,68 +22,7 @@ import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngVO;
public interface AuthHierarchyMgtService { public interface AuthHierarchyMgtService {
List<XitAuthHierarchyMngVO> findAuthHierarchies(final Map<String, Object> paraMap, final RowBounds pagingInfo); List<XitAuthHierarchyMngVO> findAuthHierarchies(final Map<String, Object> paraMap, final RowBounds pagingInfo);
XitAuthHierarchyMngVO findAuthHierarchyInfo(XitAuthHierarchyMngVO vo);
void saveAuthHierarchy(final XitAuthHierarchyMngVO vo);
/**
* <pre> : </pre>
* @param searchVO
* @return List<XitAuthHierarchyMngVO>
* @author:
* @date: 2020. 11. 2.
*/
public List<XitAuthHierarchyMngVO> findList(XitAuthHierarchyMngSearchVO searchVO);
/**
* <pre> : </pre>
* @param searchVO
* @return int
* @author:
* @date: 2020. 11. 2.
*/
public int findListTotCnt(XitAuthHierarchyMngSearchVO searchVO);
/**
* <pre> : </pre>
* @param vo
* @return XitAuthHierarchyMngVO
* @author:
* @date: 2020. 11. 2.
*/
public XitAuthHierarchyMngVO findAuthHierarchyInfo(XitAuthHierarchyMngVO vo);
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 11. 2.
*/
public void addProc(XitAuthHierarchyMngVO vo);
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 11. 2.
*/
public void modifyProc(XitAuthHierarchyMngVO vo);
/**
* <pre> : </pre>
* @param vo void
* @author:
* @date: 2020. 11. 2.
*/
public void removeProc(XitAuthHierarchyMngVO vo);
/**
* <pre> : </pre>
* @param ids void
* @author:
* @date: 2020. 11. 2.
*/
public void removesProc(String ids);
} }

@ -25,6 +25,8 @@ import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngSearchVO;
import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngVO; import kr.xit.framework.biz.mng.auth.model.XitAuthHierarchyMngVO;
import kr.xit.framework.biz.mng.auth.service.AuthHierarchyMgtService; import kr.xit.framework.biz.mng.auth.service.AuthHierarchyMgtService;
import kr.xit.framework.core.utils.XitCmmnUtil; import kr.xit.framework.core.utils.XitCmmnUtil;
import kr.xit.framework.support.exception.BizRuntimeException;
import kr.xit.framework.support.util.constants.MessageKey;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@ -51,7 +53,7 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService {
} }
@Override @Override
public XitAuthHierarchyMngVO findAuthHierarchyInfo(XitAuthHierarchyMngVO vo) { public XitAuthHierarchyMngVO findAuthHierarchyInfo(final XitAuthHierarchyMngVO vo) {
XitAuthHierarchyMngVO result = new XitAuthHierarchyMngVO(); XitAuthHierarchyMngVO result = new XitAuthHierarchyMngVO();
List<XitRoleSclsrtRescueVO> listRoleSclsrtRescueVO = authAuthorMgtMapper.selectRoleSclsrtRescues(new XitRoleSclsrtRescueVO()); List<XitRoleSclsrtRescueVO> listRoleSclsrtRescueVO = authAuthorMgtMapper.selectRoleSclsrtRescues(new XitRoleSclsrtRescueVO());
@ -68,51 +70,9 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService {
} }
public void saveAuthHierarchy(final XitAuthHierarchyMngVO vo) {
@Override
public List<XitAuthHierarchyMngVO> findList(XitAuthHierarchyMngSearchVO searchVO) {
List<XitAuthHierarchyMngVO> result = null;
try {
result = mapper.findList(searchVO);
//권한구조 설정
if(XitCmmnUtil.notEmpty(result)) {
for(XitAuthHierarchyMngVO item : result) {
String strAuthorRescueCode = this.getStrAuthHierarchy(item.getAuthorCode());
item.setAuthorRescueCode(strAuthorRescueCode);
item.setAuthorRescueCodeNm(this.convertKorNm(strAuthorRescueCode));
}
}
} catch (SQLException e) {
throw new RuntimeException("권한계층관리 목록 조회 FAIL::", e);
}
return result;
}
@Override
public int findListTotCnt(XitAuthHierarchyMngSearchVO searchVO) {
int result = 0;
try {
result = mapper.findListTotCnt(searchVO);
} catch (SQLException e) {
throw new RuntimeException("권한계층관리 목록 총건수 조회 FAIL::", e);
}
return result;
}
@Override
public void addProc(XitAuthHierarchyMngVO vo) {
this.modifyProc(vo);
}
@Override
public void modifyProc(XitAuthHierarchyMngVO vo) {
if(XitCmmnUtil.isEmpty(vo.getAuthorCode())) if(XitCmmnUtil.isEmpty(vo.getAuthorCode()))
throw new RuntimeException("권한코드는 필수조건 입니다."); throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "권한코드는 필수조건 입니다.");
String[] arrAuthorCodeGrp = vo.getAuthorCode().split(","); //권한코드 묶음 목록 String[] arrAuthorCodeGrp = vo.getAuthorCode().split(","); //권한코드 묶음 목록
@ -121,12 +81,11 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService {
* - . * - .
* - () . * - () .
*/ */
// 최상위 부모 갯수 확인
if(arrAuthorCodeGrp[0].split(";").length>1) if(arrAuthorCodeGrp[0].split(";").length>1)
throw new RuntimeException("최상위 부모는 한개만 설정 가능 합니다."); throw BizRuntimeException.create(MessageKey.CUSTOM_MSG,"최상위 부모는 한개만 설정 가능 합니다.");
// 최하위 자녀 갯수 확인 // 최하위 자녀 갯수 확인
if(arrAuthorCodeGrp[arrAuthorCodeGrp.length-1].split(";").length>1) if(arrAuthorCodeGrp[arrAuthorCodeGrp.length-1].split(";").length>1)
throw new RuntimeException("최하위 자녀는 한개만 설정 가능 합니다."); throw BizRuntimeException.create(MessageKey.CUSTOM_MSG,"최하위 자녀는 한개만 설정 가능 합니다.");
// 다중상속 구간 갯수 확인 // 다중상속 구간 갯수 확인
int cnt = 0; int cnt = 0;
for(String authorCodeGrp : arrAuthorCodeGrp) { for(String authorCodeGrp : arrAuthorCodeGrp) {
@ -134,7 +93,7 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService {
cnt++; cnt++;
} }
if(cnt > 1) if(cnt > 1)
throw new RuntimeException("다중상속은 하나의 구간만 설정 가능 합니다."); throw BizRuntimeException.create(MessageKey.CUSTOM_MSG,"다중상속은 하나의 구간만 설정 가능 합니다.");
//권한계층구조 일괄 제거 //권한계층구조 일괄 제거
authAuthorMgtMapper.deleteRoleSclsrtRescue(new XitRoleSclsrtRescueVO()); authAuthorMgtMapper.deleteRoleSclsrtRescue(new XitRoleSclsrtRescueVO());
@ -158,27 +117,6 @@ public class AuthHierarchyMgtServiceImpl implements AuthHierarchyMgtService {
} }
} }
} }
}
@Override
public void removeProc(XitAuthHierarchyMngVO vo) {
}
@Override
public void removesProc(String ids) {
/**
*
*/
String[] authorCodes = ids.split(";");
for (int i = 0; i < authorCodes.length; i++) {
XitAuthHierarchyMngVO vo = new XitAuthHierarchyMngVO();
vo.setAuthorCode(authorCodes[i]);
this.removeProc(vo);
}
} }

@ -45,9 +45,13 @@ import kr.xit.framework.core.message.XitMessageSource;
import kr.xit.framework.core.model.ResultResponse; import kr.xit.framework.core.model.ResultResponse;
import kr.xit.framework.core.utils.XitCmmnUtil; import kr.xit.framework.core.utils.XitCmmnUtil;
import kr.xit.framework.core.validation.XitBeanValidator; import kr.xit.framework.core.validation.XitBeanValidator;
import kr.xit.framework.support.exception.BizRuntimeException;
import kr.xit.framework.support.mybatis.MybatisUtils; import kr.xit.framework.support.mybatis.MybatisUtils;
import kr.xit.framework.support.util.AjaxMessageMapRenderer;
import kr.xit.framework.support.util.AjaxUtils; import kr.xit.framework.support.util.AjaxUtils;
import kr.xit.framework.support.util.Checks; import kr.xit.framework.support.util.Checks;
import kr.xit.framework.support.util.ValidationError;
import kr.xit.framework.support.util.constants.MessageKey;
/** /**
* *
@ -68,12 +72,6 @@ public class AuthHierarchyMgtController {
@Resource @Resource
private AuthAuthorMgtService authAuthorMgtService; private AuthAuthorMgtService authAuthorMgtService;
@Resource
private XitFrameCrudService xitFrameCrudService;
@Autowired
private XitBeanValidator beanValidator;
@Resource(name = "xitMessageSource")
XitMessageSource xitMessageSource;
@Resource @Resource
private EgovSecuredObjectService egovSecuredObjectService; private EgovSecuredObjectService egovSecuredObjectService;
@Resource(name="roleHierarchy") @Resource(name="roleHierarchy")
@ -139,364 +137,35 @@ public class AuthHierarchyMgtController {
return ResultResponse.of(service.findAuthHierarchies(paraMap, MybatisUtils.getPagingInfo(paraMap))); return ResultResponse.of(service.findAuthHierarchies(paraMap, MybatisUtils.getPagingInfo(paraMap)));
} }
@PostMapping(value = "/saveResetAuthHierarchy") @PostMapping(value = "/saveAuthHierarchy")
public ModelAndView saveResetAuthHierarchy(@RequestParam Map<String,Object> paraMap){ public ModelAndView saveAuthHierarchy(@ModelAttribute final XitAuthHierarchyMngVO vo, final BindingResult bindingResult){
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
//최하위 권한의 권한계층 조회
XitAuthHierarchyMngVO result = authAuthorMgtService.findAuthAuthors(paraMap);
//권한코드 Map 생성
List<XitAuthorInfoVO> listAuthorInfoVO = xitFrameCrudService.findXitAuthorInfos(new XitAuthorInfoVO());
Map<String, String> mAuthorInfo = new HashMap<String, String>();
for(XitAuthorInfoVO item : listAuthorInfoVO) {
mAuthorInfo.put(item.getAuthorCode(), item.getAuthorNm());
}
//권한코드 목록에서 비중복 권한만 추출
Map<String, String> mNoDuplAuthorInfo = new HashMap<String, String>();
mNoDuplAuthorInfo.putAll(mAuthorInfo);
String[] arrAuthorRescue = result.getAuthorRescueCode().split(">");
for(int i=0; i<arrAuthorRescue.length; i++) {
String[] arrAuthorCode = arrAuthorRescue[i].split(",");
for(int j=0; j<arrAuthorCode.length; j++) {
String authorCode = arrAuthorCode[j].trim();
if(mNoDuplAuthorInfo.containsKey(authorCode)) {
mNoDuplAuthorInfo.remove(authorCode);
}
}
}
//권한계층 미설정 권한 목록 설정
List<XitAuthorInfoVO> listAuthorInfo = new ArrayList<XitAuthorInfoVO>();
Iterator<String> it = mNoDuplAuthorInfo.keySet().iterator();
while(it.hasNext()) {
String authorCode = it.next();
XitAuthorInfoVO authorInfo = new XitAuthorInfoVO();
authorInfo.setAuthorCode(authorCode);
authorInfo.setAuthorNm(mNoDuplAuthorInfo.get(authorCode));
listAuthorInfo.add(authorInfo);
}
mav.addObject("authorList", listAuthorInfo); ValidationError.of("authHierarchyManage", vo, bindingResult);
mav.addObject("mAuthorInfo", mAuthorInfo); service.saveAuthHierarchy(vo);
mav.addObject("authHierarchyManage", paraMap); AjaxMessageMapRenderer.success(mav, MessageKey.CMM_SUCCESS);
mav.addObject("pageTitle", "권한 계층 설정");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/auth/mngAuthHierarchyMgtPopup.popup");
return mav; return mav;
} }
@PostMapping(value = "/reloadAuthHierarchy")
public ModelAndView reloadAuthHierarchy(){
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
/**
* <pre> : </pre>
* @return String
* @author:
* @date: 2020. 7. 30.
*/
@RequestMapping(value = "AuthHierarchyMng_list.ajax", method={RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public Map<String, Object> AuthHierarchyMng_listAjax(@ModelAttribute("searchVO") XitAuthHierarchyMngSearchVO searchVO, ModelMap model) {
/** paging */
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(searchVO.getPage()>-1?searchVO.getPage():searchVO.getPageIndex());
paginationInfo.setRecordCountPerPage(searchVO.getPerPage()>-1?searchVO.getPerPage():searchVO.getPageUnit());
paginationInfo.setPageSize(searchVO.getPageSize());
searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
/**
*
*/
int totCnt = service.findListTotCnt(searchVO);
paginationInfo.setTotalRecordCount(totCnt);
/**
*
*/
/* ***************************
* tui Grid Response Set
*************************** */
resultMap.put("result", true); //[tui Grid] result
resultMap.put("message", xitMessageSource.getMessage("success.common.select")); //[tui Grid] result message
Map<String, Object> data = new HashMap<String, Object>();
data.put("contents", service.findList(searchVO)); //[tui Grid] data-contents
Map<String, Integer> pagination = new HashMap<String, Integer>();
pagination.put("page", searchVO.getPage());
pagination.put("totalCount", totCnt);
data.put("pagination", pagination); //[tui Grid] data-paging
resultMap.put("data", data); //[tui Grid] data
/* ***************************
* //tui Grid Response Set
*************************** */
} catch (Exception e) {
/**
*
*/
//tui Grid Response Set
resultMap.put("result", false); //[tui Grid] result
resultMap.put("message", xitMessageSource.getMessage("fail.common.select")); //[tui Grid] result message
}
return resultMap;
}
/**
* <pre> : .</pre>
* @param cmd
* @param tilesDef Type(none: tiles )
* @param model
* @return String
* @author:
* @date: 2020. 11. 2.
*/
@RequestMapping(value = "AuthHierarchyMng_{cmd}", method={RequestMethod.GET, RequestMethod.POST})
public String AuthHierarchyMng_page(@PathVariable String cmd
, @RequestParam(value="tilesDef", required=false, defaultValue="") String tilesDef
//, @ModelAttribute("searchVO") XitAuthHierarchyMngSearchVO searchVO
, @ModelAttribute("vo") XitAuthHierarchyMngVO vo
, ModelMap model) {
switch (cmd) {
// case "input": //등록 페이지
// break;
case "edit": //수정 페이지
// case "view": //상세 페이지
//최하위 권한의 권한계층 조회
XitAuthHierarchyMngVO result = authAuthorMgtService.findAuthAuthorInfos(vo);
//권한코드 Map 생성
List<XitAuthorInfoVO> listAuthorInfoVO = xitFrameCrudService.findXitAuthorInfos(new XitAuthorInfoVO());
Map<String, String> mAuthorInfo = new HashMap<String, String>();
for(XitAuthorInfoVO item : listAuthorInfoVO) {
mAuthorInfo.put(item.getAuthorCode(), item.getAuthorNm());
}
//권한코드 목록에서 비중복 권한만 추출
Map<String, String> mNoDuplAuthorInfo = new HashMap<String, String>();
mNoDuplAuthorInfo.putAll(mAuthorInfo);
String[] arrAuthorRescue = result.getAuthorRescueCode().split(">");
for(int i=0; i<arrAuthorRescue.length; i++) {
String[] arrAuthorCode = arrAuthorRescue[i].split(",");
for(int j=0; j<arrAuthorCode.length; j++) {
String authorCode = arrAuthorCode[j].trim();
if(mNoDuplAuthorInfo.containsKey(authorCode)) {
mNoDuplAuthorInfo.remove(authorCode);
}
}
}
//권한계층 미설정 권한 목록 설정
List<XitAuthorInfoVO> listAuthorInfo = new ArrayList<XitAuthorInfoVO>();
Iterator<String> it = mNoDuplAuthorInfo.keySet().iterator();
while(it.hasNext()) {
String authorCode = it.next();
XitAuthorInfoVO authorInfo = new XitAuthorInfoVO();
authorInfo.setAuthorCode(authorCode);
authorInfo.setAuthorNm(mNoDuplAuthorInfo.get(authorCode));
listAuthorInfo.add(authorInfo);
}
model.addAttribute("authorList", listAuthorInfo);
model.addAttribute("mAuthorInfo", mAuthorInfo);
model.addAttribute("message", xitMessageSource.getMessage("success.common.select"));
model.addAttribute("vo", result);
break;
default:
throw new RuntimeException("유효하지 않은 요청 입니다.");
}
if(!"".equals(tilesDef))
tilesDef = "."+tilesDef;
return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/auth/XitAuthHierarchyMng_"+cmd+tilesDef;
}
/**
* <pre> : .</pre>
* @param cmd
* @param model
* @return String
* @author:
* @date: 2020. 11. 2.
*/
@RequestMapping(value = "AuthHierarchyMng_{cmd}_popup", method={RequestMethod.GET, RequestMethod.POST})
public String AuthHierarchyMng_page_popup(@PathVariable String cmd
, @RequestParam(value="tilesDef", required=false, defaultValue="") String tilesDef
, @ModelAttribute("searchVO") XitAuthHierarchyMngSearchVO searchVO
, @ModelAttribute("vo") XitAuthHierarchyMngVO vo
, ModelMap model) {
switch (cmd) {
case "": //
break;
default:
throw new RuntimeException("유효하지 않은 요청 입니다.");
}
return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/auth/XitAuthHierarchyMng_"+cmd+"_popup"+TILES_TYPE.POPUP.getVal();
}
/**
* <pre>
* : CUD
* </pre>
*
* @return String
* @author:
* @throws IOException
* @throws ServletException
* @date: 2020. 11. 2.
*/
@RequestMapping(value = "AuthHierarchyMng_{cmd}_proc", method=RequestMethod.POST)
public void AuthHierarchyMng_cmd_proc(@PathVariable String cmd
,@ModelAttribute("vo") XitAuthHierarchyMngVO vo
,@RequestParam(value="authorCodes", required=false, defaultValue="") String authorCodes
,BindingResult bindingResult
,SessionStatus status
,Model model
,HttpServletRequest request
,HttpServletResponse response
) throws ServletException, IOException {
/**
*
*/
String sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_list.do";
String message = null;
switch (cmd) {
// case "insert": //등록
// break;
// case "inserts": //다건 등록
// break;
case "update": //수정
//유효성 확인
beanValidator.validate(vo, bindingResult);
if (bindingResult.hasErrors()) {
message = xitMessageSource.getMessage("fail.common.update");
sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_edit.do";
break;
}
//처리
try {
service.modifyProc(vo);
status.setComplete();
message = xitMessageSource.getMessage("success.common.update");
} catch (RuntimeException e) {
message = e.getMessage();
sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_edit.do";
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.update");
sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_edit.do";
}
break;
case "delete": //삭제
//처리
try {
service.removeProc(vo);
status.setComplete();
message = xitMessageSource.getMessage("success.common.delete");
break;
} catch (RuntimeException e) {
message = e.getMessage();
sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_edit.do";
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.delete");
sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_edit.do";
}
break;
case "reload": //롤계층정보 재적용
//처리
/** /**
* reload * reload
* - . * - .
*/ */
String hierachicaRoles = null; String hierachicaRoles = null;
try { try {
hierachicaRoles = egovSecuredObjectService.getHierarchicalRoles(); hierachicaRoles = egovSecuredObjectService.getHierarchicalRoles();
} catch (Exception e) {
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, e.getMessage());
}
roleHierarchyImpl.setHierarchy(hierachicaRoles); roleHierarchyImpl.setHierarchy(hierachicaRoles);
RoleHierarchy roleHierarchy = roleHierarchyImpl; RoleHierarchy roleHierarchy = roleHierarchyImpl;
egovJdbcUserDetailsManager.setRoleHierarchy(roleHierarchy); egovJdbcUserDetailsManager.setRoleHierarchy(roleHierarchy);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_SUCCESS);
// List<XitUserInfoVO> listUserInfo = xitFrameCrudService.findXitUserInfos(new XitUserInfoVO()); return mav;
// for(XitUserInfoVO userInfo : listUserInfo) {
// egovJdbcUserDetailsManager.loadUserByUsername(userInfo.getUser_id());
// }
message = xitMessageSource.getMessage("success.request.msg");
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.request.msg");
sLocationUrl = "forward:/framework/biz/mng/auth/AuthHierarchyMng_edit.do";
}
break;
default:
new RuntimeException("유효하지 않은 요청 입니다.");
}
/**
*
*/
/* ============================
* 2020.09.10
*
* - ajax json
* [AS-IS] String, return url "forward"
* [TO-BE] void, DispatchServlet forward , ajax json forward
============================ */
//2020.09.10 주석처리
// model.addAttribute("message", message);
// return sLocationUrl;
model.addAttribute("message", message);
if(AjaxUtils.isAjaxRequest(request)){ //ajax 요청시
//반환 데이터 설정
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("message", message);
XitCmmnUtil.forwardForAjaxRequest(request, response, resultMap);
}else { //submit 요청 시
XitCmmnUtil.forwardForSubmitRequest(request, response, sLocationUrl, model.asMap());
}
} }
} }

@ -5,7 +5,7 @@
<!-- ************************************************************************************************************* <!-- *************************************************************************************************************
* xit_author_info : 권한 정보 * xit_author_info : 권한 정보
************************************************************************************************************** --> ************************************************************************************************************** -->
<select id="selectAuthorInfos" parameterType="map" resultType="kr.xit.framework.biz.cmm.model.XitAuthorInfoVO"> <select id="selectAuthorInfos" resultType="kr.xit.framework.biz.cmm.model.XitAuthorInfoVO">
/* auth-author-mysql-mapper|selectAuthorInfos-권한 목록 조회|julim */ /* auth-author-mysql-mapper|selectAuthorInfos-권한 목록 조회|julim */
SELECT author_code SELECT author_code
, author_nm , author_nm

@ -44,6 +44,9 @@
/************************************************************************** /**************************************************************************
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
var callbackSearch = () => {
if(GRID) fnBiz.search();
}
let GRID = null; let GRID = null;
/* ******************************* /* *******************************
@ -79,10 +82,10 @@
}) })
} }
} }
,onClickGrid: function(props){ // ,onClickGrid: function(props){
const rowData = props.grid.getRow(props.rowKey); // const rowData = props.grid.getRow(props.rowKey);
fnBiz.pagePopup('add', rowData); // fnBiz.pagePopup('add', rowData);
} // }
,pagePopup: function(flag, params){ ,pagePopup: function(flag, params){
let url = '<c:url value="/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.do"/>'; let url = '<c:url value="/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.do"/>';
let popTitle; let popTitle;
@ -121,7 +124,8 @@
width: 200, width: 200,
sortable: true, sortable: true,
sortingType: 'desc', sortingType: 'desc',
align: 'left', align: 'left'
/*
renderer: { renderer: {
type: CustomButtonRenderer, type: CustomButtonRenderer,
options: { options: {
@ -136,6 +140,7 @@
,eventType : "click" ,eventType : "click"
} }
} }
*/
}, },
{ {
header: '권한 명', header: '권한 명',
@ -170,7 +175,6 @@
}; };
GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => { GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => {
console.log('~~~~~~~~~~')
}); });
} }
@ -178,7 +182,6 @@
* initialize * initialize
**************************************************************************/ **************************************************************************/
$(document).ready(function(){ $(document).ready(function(){
console.log('~~~~~~~~~~~>>>>>>>>>')
initGrid(); initGrid();
}); });
</script> </script>

@ -45,10 +45,9 @@
</style> </style>
<!-- 검색 필드 박스 시작 --> <!-- 검색 필드 박스 시작 -->
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
<validator:javascript formName="authHierarchyManage" staticJavascript="false" xhtml="true" cdata="false"/> <validator:javascript formName="authHierarchyManage" staticJavascript="false" xhtml="true" cdata="false"/>
<%--@elvariable id="authHierarchyManage" type=""--%> <%--@elvariable id="authHierarchyManage" type=""--%>
<form:form commandName="authHierarchyManage" name="authHierarchyManage" method="post" > <form:form commandName="authHierarchyManage" name="authHierarchyManage">
<div class="popup"> <div class="popup">
<div class="popup_inner"> <div class="popup_inner">
@ -134,8 +133,8 @@
<span class="flr"> <span class="flr">
<a href="#" class="btn blue" id="btnRegist">저장</a> <a href="#" class="btn blue" id="btnRegist">저장</a>
<a href="#" class="btn gray" id="btnInit">원래대로</a> <a href="#" class="btn gray" id="btnInit">원래대로</a>
<a href="#" class="btn red" id="reload_btn">설정정보적용</a> <a href="#" class="btn red" id="btnReload">설정정보적용</a>
<a href="#" class="btn lightgray" onclick="window.close()">닫기</a> <a href="#" class="btn lightgray" id="btnClose">닫기</a>
</span> </span>
</div> <!-- //등록버튼 --> </div> <!-- //등록버튼 -->
@ -147,128 +146,79 @@
<script type="text/javaScript"> <script type="text/javaScript">
$(document).ready(function(){ /**************************************************************************
XitAuthHierarchyMng_edit.init(); * Global Variable
}); **************************************************************************/
/* ******************************* let initArrAuthorCode;
* 권한계층관리 수정화면 Functions
/* *******************************
* Biz function
******************************* */ ******************************* */
var XitAuthHierarchyMng_edit = { const fnBiz = {
init : function(){ save: () => {
//닫기 버튼 Event // if(!fnBiz.validate()) return;
$("#btnClose").click(function() { //if(!validateAuthHierarchyManage(document.authHierarchyManage)) return;
window.close(); console.log($(document.authHierarchyManage).serialize());
}); console.log($(document.authHierarchyManage));
//저장 버튼 Event 설정
$('#btnSave').on({ let data = $(document.authHierarchyManage).serialize();
click: function(){ if(initArrAuthorCode === data){
XitAuthHierarchyMng_edit.modifyData(); alert('변경된 내역이 없습니다.');
} return false;
});
$('#init_btn').on({
click: function(){
document.authHierarchyManage.action = '<c:url value="/framework/biz/mng/auth/AuthHierarchyMng_edit.do"/>';
document.authHierarchyManage.submit();
}
});
$('#reload_btn').on({
click: function(){
XitAuthHierarchyMng_edit.modifyData('reload');
} }
}); data = $(document.authHierarchyManage).serialize();
//부모&자녀 param Set if(data.indexOf('%2C') > 0){
XitAuthHierarchyMng_edit.setParam(); data = decodeURIComponent(data);
data = data.split(',').join('&authorCode=')
//sortable 적용
$('.connectWith').sortable({
connectWith: '.connectWith'
,stop : function(){
//구분자 생성
$('#authorList li.separator').remove();
$('#authorList').prepend('<li class="separator"><span style="font-weight: bold">&nbsp;>&nbsp;</span></li>');
//param 설정
XitAuthHierarchyMng_edit.setParam();
}
});
},
/* ========================
* 데이터 등록
======================== */
addData : function(){
} }
/* ========================
* 데이터 수정
======================== */
,modifyData : function(flag){
var varFrom = document.authHierarchyManage;
if(flag=='reload'){
var msg = [];
msg.push('설정하신 정보를 적용 하시겠습니까?');
msg.push('적용된 설정은 사이트를 재접속 하셔야 동작 합니다.');
msg.push('※"설정정보 적용"을 하지 않을 시 저장하신 정보는 서버가 재기동 되기전까진 반영되지 않습니다.');
if(confirm(msg.join('\n'))){
var param = $(varFrom).serialize();
$.ajax({
url : "/framework/biz/mng/auth/AuthHierarchyMng_reload_proc.do",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
},
error: function(){
if(confirm("저장 하시겠습니까?")) {
cmmAjax({
url: '<c:url value="/framework/biz/mng/auth/saveAuthHierarchy.do"/>'
, data: $(document.authHierarchyManage).serialize()
,success: () => {
//$('#btnReload').css('display', 'inline-block');
}
})
} }
});
} }
}else{
if(confirm("저장 하시겠습니까?")){
var param = $(varFrom).serialize();
$.ajax({
url : "/framework/biz/mng/auth/AuthHierarchyMng_update_proc.do",
data : param,
type : "post",
dataType : "json",
success : function(data) {
alert(data.resp.message);
window.opener.XitAuthHierarchyMng_list.findData();
// window.close();
},
error: function(){
,init: () => {
window.location = '<c:url value="/framework/biz/mng/auth/mngAuthHierarchyMgtPopup.do"/>'
} }
, reload: () => {
const msg = [];
msg.push('설정하신 정보를 적용 하시겠습니까?');
msg.push('적용된 설정은 사이트를 재접속 하셔야 동작 합니다.');
msg.push('※"설정정보 적용"을 하지 않을 시 저장하신 정보는 서버가 재기동 되기전까진 반영되지 않습니다.');
if(confirm(msg.join('\n'))) {
cmmAjax({
url: '<c:url value="/framework/biz/mng/auth/reloadAuthHierarchy.do"/>'
}); });
} }
} }
}
/* ======================== ,setParam : function(){
* 데이터 삭제 let i = 0;
======================== */ const totCnt = $('#authorRescue li').length;
,removeData : function(){ let sb = [];
}, const arrAuthorCode = [];
/* ========================
* 파라미터 설정
======================== */
setParam : function(){
var i = 0;
var totCnt = $('#authorRescue li').length;
var sb = [];
var arrAuthorCode = [];
$('#authorRescue li').each(function(){ $('#authorRescue li').each(function(){
if($(this).hasClass('separator')){ //구분자 일때 if($(this).hasClass('separator')){ //구분자 일때
//배열에 담기 //배열에 담기
if(sb.length>0) if(sb.length>0)
arrAuthorCode.push(sb.join(';')); arrAuthorCode.push(sb);
//StringBuffer 초기화 //StringBuffer 초기화
sb = []; sb = [];
console.log(arrAuthorCode)
}else{ //구분자가 아닐때 }else{ //구분자가 아닐때
//StringBuffer에 담기 const authorCode = $(this).find('#authorCode').val();
console.log(arrAuthorCode, arrAuthorCode.length)
sb.push($(this).find('#authorCode').val()); sb.push($(this).find('#authorCode').val());
} }
@ -276,20 +226,17 @@ $(document).ready(function(){
if(i == totCnt-1){ if(i == totCnt-1){
//배열에 담기 //배열에 담기
if(sb.length>0) if(sb.length>0)
arrAuthorCode.push(sb.join(';')); arrAuthorCode.push(sb);
} }
i++; i++;
}); });
//if(arrAuthorCode.)
const frm = document.authHierarchyManage;
var frm = document.authHierarchyManage;
//Elements 삭제 //Elements 삭제
$(frm).find('input[name="authorCode"]').remove(); $(frm).find('input[name="authorCode"]').remove();
//Elements 생성 //Elements 생성
for(var i=0; i<arrAuthorCode.length; i++){ for(let i = 0; i<arrAuthorCode.length; i++){
var param = document.createElement('input'); const param = document.createElement('input');
param.setAttribute('type', 'hidden'); param.setAttribute('type', 'hidden');
param.setAttribute('name', 'authorCode'); param.setAttribute('name', 'authorCode');
param.setAttribute('value', arrAuthorCode[i]); param.setAttribute('value', arrAuthorCode[i]);
@ -297,5 +244,57 @@ $(document).ready(function(){
} }
} }
} ,validate: () => {
if($('#groupId').val() === ''){
alert('[권한그룹 ID]는 필수 입니다.');
$('#authorCode').focus();
return false;
}
if($('#groupNm').val() === ''){
alert('[권한그룹 명]은 필수 입니다.');
$('#authorNm').focus();
return false;
}
return true;
}
};
/**************************************************************************
* event
**************************************************************************/
$(() => {
$('#btnClose').on('click', () => {
window.opener.callbackSearch();
window.close();
});
$('#btnRegist').on('click', () => fnBiz.save());
$('#btnInit').on('click', () => fnBiz.init());
$('#btnReload').on('click', () => fnBiz.reload());
//sortable 적용
$('.connectWith').sortable({
connectWith: '.connectWith'
,stop : function(){
//구분자 생성
$('#authorList li.separator').remove();
$('#authorList').prepend('<li class="separator"><span style="font-weight: bold">&nbsp;>&nbsp;</span></li>');
//param 설정
fnBiz.setParam();
}
});
});
/**************************************************************************
* initialize
**************************************************************************/
$(document).ready(function(){
fnBiz.setParam();
initArrAuthorCode = $(document.authHierarchyManage).serialize();
//$('#btnReload').css('display', 'none');
});
</script> </script>

Loading…
Cancel
Save