From ecd42372091713a9501383f2addc1f1fb7908ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Thu, 1 Dec 2022 18:33:01 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=91=EC=86=8D=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80,=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dbnt/faisp/config/BaseController.java | 7 + .../com/dbnt/faisp/config/SecurityConfig.java | 3 +- .../main/userInfo/UserMgtController.java | 31 +- .../mybatisMapper/UserInfoMapper.xml | 24 +- .../resources/static/js/equip/cellPhone.js | 290 +++++++++--------- .../static/js/userMgt/accessChange.js | 26 ++ .../adminPage/userMgt/accessChange.html | 143 +++++++++ .../crackdownStatus/crackdownStatus.html | 16 +- .../resources/templates/fragments/header.html | 2 +- 9 files changed, 379 insertions(+), 163 deletions(-) create mode 100644 src/main/resources/static/js/userMgt/accessChange.js create mode 100644 src/main/resources/templates/adminPage/userMgt/accessChange.html diff --git a/src/main/java/com/dbnt/faisp/config/BaseController.java b/src/main/java/com/dbnt/faisp/config/BaseController.java index 7a309464..a3b4b113 100644 --- a/src/main/java/com/dbnt/faisp/config/BaseController.java +++ b/src/main/java/com/dbnt/faisp/config/BaseController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.List; import java.util.Map; @@ -69,6 +70,12 @@ public class BaseController { return mav; } + @GetMapping("/resetSession") + public ModelAndView resetSession(@AuthenticationPrincipal UserInfo loginUser, HttpServletRequest request){ + setSession(loginUser, request.getSession()); + return new ModelAndView("redirect:/dashboard"); + } + public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){ loginUser.setDownOrganCdList(organConfigService.selectDownOrganListWhereUserOgCd(loginUser.getOgCd())); loginUser.setUpOrganCdList(organConfigService.selectUpOrganListWhereUserOgCd(loginUser.getOgCd())); diff --git a/src/main/java/com/dbnt/faisp/config/SecurityConfig.java b/src/main/java/com/dbnt/faisp/config/SecurityConfig.java index cfbfc673..f342114b 100644 --- a/src/main/java/com/dbnt/faisp/config/SecurityConfig.java +++ b/src/main/java/com/dbnt/faisp/config/SecurityConfig.java @@ -127,7 +127,8 @@ public class SecurityConfig{ "/faStatistics/**", "/translator/**", "/police/**", - "/sri/**" + "/sri/**", + "/resetSession" ).hasRole(Role.USER.name()) // USER 접근 허용 .antMatchers( "/authMgt/**", diff --git a/src/main/java/com/dbnt/faisp/main/userInfo/UserMgtController.java b/src/main/java/com/dbnt/faisp/main/userInfo/UserMgtController.java index d4cfb773..cfadcb95 100644 --- a/src/main/java/com/dbnt/faisp/main/userInfo/UserMgtController.java +++ b/src/main/java/com/dbnt/faisp/main/userInfo/UserMgtController.java @@ -1,5 +1,7 @@ package com.dbnt.faisp.main.userInfo; +import com.dbnt.faisp.config.BaseController; +import com.dbnt.faisp.config.SecurityConfig; import com.dbnt.faisp.kwms.service.KwmsService; import com.dbnt.faisp.main.codeMgt.service.CodeMgtService; import com.dbnt.faisp.main.userInfo.model.UserInoutLog; @@ -9,9 +11,14 @@ import com.dbnt.faisp.main.userInfo.model.UserInfo; import com.dbnt.faisp.main.userInfo.service.UserLogService; import lombok.RequiredArgsConstructor; +import java.security.Principal; import java.util.List; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -27,12 +34,13 @@ public class UserMgtController { private final KwmsService kwmsService; @GetMapping("/userMgtPage") - public ModelAndView codeMgtPage(UserInfo userInfo) { + public ModelAndView userMgtPage(@AuthenticationPrincipal UserInfo loginUser, UserInfo userInfo) { ModelAndView mav = new ModelAndView("adminPage/userMgt/userMgt"); userInfo.setQueryInfo(); if(userInfo.getUserStatus() == null || userInfo.getUserStatus().equals("")) { userInfo.setUserStatus("USC003"); } + userInfo.setDownOrganCdList(loginUser.getDownOrganCdList()); mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo)); userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo)); userInfo.setPaginationInfo(); @@ -41,7 +49,7 @@ public class UserMgtController { } @GetMapping("/userEditModal") - public ModelAndView menuEditModal(UserInfo userInfo){ + public ModelAndView userEditModal(UserInfo userInfo){ ModelAndView mav = new ModelAndView("adminPage/userMgt/userEditModal"); mav.addObject("ogList", codeMgtService.selectCodeMgtList("OG")); mav.addObject("ofcList", codeMgtService.selectCodeMgtList("OFC")); @@ -120,4 +128,23 @@ public class UserMgtController { mav.addObject("searchParams", inoutLog); return mav; } + @GetMapping("/accessChangePage") + public ModelAndView accessChangePage(@AuthenticationPrincipal UserInfo loginUser, UserInfo userInfo){ + ModelAndView mav = new ModelAndView("adminPage/userMgt/accessChange"); + userInfo.setQueryInfo(); + userInfo.setUserStatus("USC003"); + userInfo.setUserRole(loginUser.getUserRole()); + userInfo.setDownOrganCdList(loginUser.getDownOrganCdList()); + mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo)); + userInfo.setContentCnt(userInfoService.selectUserInfoListCnt(userInfo)); + userInfo.setPaginationInfo(); + mav.addObject("searchParams", userInfo); + return mav; + } + @PostMapping("/changeAccessUser") + public void changeAccessUser(UserInfo userInfo){ + UserDetails user = userInfoService.loadUserByUsername(userInfo.getUserId()); + Authentication authentication = new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); + } } diff --git a/src/main/resources/mybatisMapper/UserInfoMapper.xml b/src/main/resources/mybatisMapper/UserInfoMapper.xml index 33eada68..d2ad3d97 100644 --- a/src/main/resources/mybatisMapper/UserInfoMapper.xml +++ b/src/main/resources/mybatisMapper/UserInfoMapper.xml @@ -7,28 +7,40 @@ - + user_status = #{userStatus} user_status != 'D' - + and user_id like '%'||#{userId}||'%' - + and user_nm like '%'||#{userNm}||'%' - + and og_cd = #{ogCd} - + and ofc_cd = #{ofcCd} - + and title_cd = #{titleCd} + + and user_role like '%ROLE_USER' + + + and (user_role = 'ROLE_SUB_ADMIN,ROLE_USER' or user_role = 'ROLE_USER') + + + and og_cd in + + #{organCd} + + + +

접속 설정

+
+
+
+ + +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
소속부서계급성명아이디식별번호등록일
+ + + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/templates/faStatistics/crackdownStatus/crackdownStatus.html b/src/main/resources/templates/faStatistics/crackdownStatus/crackdownStatus.html index ddcb5840..bfc7eb04 100644 --- a/src/main/resources/templates/faStatistics/crackdownStatus/crackdownStatus.html +++ b/src/main/resources/templates/faStatistics/crackdownStatus/crackdownStatus.html @@ -146,13 +146,6 @@ -
- -
-
+
+
+ +
diff --git a/src/main/resources/templates/fragments/header.html b/src/main/resources/templates/fragments/header.html index 66e4aece..88a58bbe 100644 --- a/src/main/resources/templates/fragments/header.html +++ b/src/main/resources/templates/fragments/header.html @@ -29,7 +29,7 @@
  • 외사경찰관리
  • 권한설정
  • 사용자로그
  • -
  • 접속설정
  • +
  • 접속설정