parent
7f1af5f14a
commit
c51c1649ad
|
|
@ -34,6 +34,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.authorizeRequests() // 페이지 권한 설정
|
http.authorizeRequests() // 페이지 권한 설정
|
||||||
.antMatchers("/board/**").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용
|
.antMatchers("/board/**").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용
|
||||||
|
.antMatchers("/info").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용
|
||||||
.antMatchers("/admin/**").hasRole(Role.ADMIN.name()) // ADMIN만 접근 허용
|
.antMatchers("/admin/**").hasRole(Role.ADMIN.name()) // ADMIN만 접근 허용
|
||||||
.antMatchers("/user/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용
|
.antMatchers("/user/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용
|
||||||
.and() // 로그인 설정
|
.and() // 로그인 설정
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
package com.dbnt.kcgfilemanager;
|
package com.dbnt.kcgfilemanager.controller;
|
||||||
|
|
||||||
|
import com.dbnt.kcgfilemanager.model.CategoryRole;
|
||||||
import com.dbnt.kcgfilemanager.model.UserInfo;
|
import com.dbnt.kcgfilemanager.model.UserInfo;
|
||||||
import com.dbnt.kcgfilemanager.service.BoardCategoryService;
|
import com.dbnt.kcgfilemanager.service.BoardCategoryService;
|
||||||
|
import com.dbnt.kcgfilemanager.service.CategoryRoleService;
|
||||||
import com.dbnt.kcgfilemanager.service.CommonCodeService;
|
import com.dbnt.kcgfilemanager.service.CommonCodeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
@ -19,6 +22,7 @@ public class BaseController {
|
||||||
|
|
||||||
private final CommonCodeService commonCodeService;
|
private final CommonCodeService commonCodeService;
|
||||||
private final BoardCategoryService boardCategoryService;
|
private final BoardCategoryService boardCategoryService;
|
||||||
|
private final CategoryRoleService categoryRoleService;
|
||||||
|
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public ModelAndView loginCheck(Principal principal, HttpSession session) {
|
public ModelAndView loginCheck(Principal principal, HttpSession session) {
|
||||||
|
|
@ -44,4 +48,35 @@ public class BaseController {
|
||||||
session.setAttribute("departmentList", commonCodeService.selectCommonCodeValue("DEPARTMENT"));
|
session.setAttribute("departmentList", commonCodeService.selectCommonCodeValue("DEPARTMENT"));
|
||||||
session.setAttribute("categoryList", boardCategoryService.selectBoardCategoryAll(null, 1));
|
session.setAttribute("categoryList", boardCategoryService.selectBoardCategoryAll(null, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/user/login")
|
||||||
|
public ModelAndView goLogin() {
|
||||||
|
ModelAndView mav = new ModelAndView("login");
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/login-error")
|
||||||
|
public ModelAndView loginError() {
|
||||||
|
ModelAndView mav = new ModelAndView("/login");
|
||||||
|
mav.addObject("loginError", true);
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/denied")
|
||||||
|
public ModelAndView doDenied() {
|
||||||
|
ModelAndView mav = new ModelAndView("login/denied");
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/info")
|
||||||
|
public ModelAndView goMyInfo(@AuthenticationPrincipal UserInfo loginUser) {
|
||||||
|
ModelAndView mav = new ModelAndView("user/myInfo");
|
||||||
|
mav.addObject("loginUser", loginUser);
|
||||||
|
if(!loginUser.getUserRole().contains("ADMIN")){
|
||||||
|
CategoryRole categoryRole = new CategoryRole();
|
||||||
|
categoryRole.setUserSeq(loginUser.getUserSeq());
|
||||||
|
mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole));
|
||||||
|
}
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,10 +79,7 @@ public class BoardController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/contentList")
|
@GetMapping("/contentList")
|
||||||
public ModelAndView contentList(
|
public ModelAndView contentList(Board board, @RequestParam(value = "tagName", required = false) List<String> tagNameList){
|
||||||
Board board,
|
|
||||||
@RequestParam(value = "tagName", required = false) List<String> tagNameList
|
|
||||||
){
|
|
||||||
ModelAndView mav = new ModelAndView("board/contentList");
|
ModelAndView mav = new ModelAndView("board/contentList");
|
||||||
mav.addObject("pageTitle", boardCategoryService.getDepth4PageTitle(board.getCategorySeq()));
|
mav.addObject("pageTitle", boardCategoryService.getDepth4PageTitle(board.getCategorySeq()));
|
||||||
board.setQueryInfo();
|
board.setQueryInfo();
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
package com.dbnt.kcgfilemanager.controller;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class LoginController {
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/user/login")
|
|
||||||
public ModelAndView goLogin() {
|
|
||||||
ModelAndView mav = new ModelAndView("login");
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/login-error")
|
|
||||||
public ModelAndView loginError() {
|
|
||||||
ModelAndView mav = new ModelAndView("/login");
|
|
||||||
mav.addObject("loginError", true);
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/denied")
|
|
||||||
public ModelAndView doDenied() {
|
|
||||||
ModelAndView mav = new ModelAndView("login/denied");
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/info")
|
|
||||||
public ModelAndView goMyInfo() {
|
|
||||||
ModelAndView mav = new ModelAndView("login/myinfo");
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -37,6 +37,9 @@ public class BaseModel {
|
||||||
int contentCnt = getContentCnt();
|
int contentCnt = getContentCnt();
|
||||||
int rowCnt = getRowCnt();
|
int rowCnt = getRowCnt();
|
||||||
int maxNum = (int)Math.ceil(((double)contentCnt)/rowCnt);
|
int maxNum = (int)Math.ceil(((double)contentCnt)/rowCnt);
|
||||||
|
if (maxNum==0){
|
||||||
|
maxNum = 1;
|
||||||
|
}
|
||||||
setMaxNum(maxNum);
|
setMaxNum(maxNum);
|
||||||
|
|
||||||
int pageIndex = getPageIndex();
|
int pageIndex = getPageIndex();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
$(function (){
|
||||||
|
tableSort();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('click', '#moveRightBtn', function (){
|
||||||
|
moveCategorySelectBody(1);
|
||||||
|
})
|
||||||
|
$(document).on('click', '#moveLeftBtn', function (){
|
||||||
|
moveCategorySelectBody(-1);
|
||||||
|
})
|
||||||
|
|
||||||
|
function moveCategorySelectBody(direction){
|
||||||
|
const categorySelectBody = $("#categorySelectBody");
|
||||||
|
const nowX = categorySelectBody.scrollLeft();
|
||||||
|
categorySelectBody.animate({scrollLeft:(direction*200+nowX)},200);
|
||||||
|
}
|
||||||
|
function tableSort(){
|
||||||
|
$("#categorySelectBody").find("tbody").each(function (idx, tbody){
|
||||||
|
let lastCategorySeq = 0
|
||||||
|
$(tbody).find(".depth2Td").each(function (idx, td){
|
||||||
|
lastCategorySeq = removeInnerText(td, lastCategorySeq);
|
||||||
|
})
|
||||||
|
$(tbody).find(".depth3Td").each(function (idx, td){
|
||||||
|
lastCategorySeq = removeInnerText(td, lastCategorySeq);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeInnerText(td, lastCategorySeq){
|
||||||
|
const categorySeq = Number($(td).attr("data-categoryseq"));
|
||||||
|
if(lastCategorySeq !== categorySeq){
|
||||||
|
lastCategorySeq = categorySeq;
|
||||||
|
}else{
|
||||||
|
td.innerText = ''
|
||||||
|
}
|
||||||
|
return lastCategorySeq;
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<!--<span class="fs-4">해양경찰청 파일관리 시스템</span>-->
|
<!--<span class="fs-4">해양경찰청 파일관리 시스템</span>-->
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav nav-pills" sec:authorize="isAuthenticated()">
|
<ul class="nav nav-pills" sec:authorize="isAuthenticated()">
|
||||||
<li class="nav-item"><a href="#" class="nav-link">개인정보</a></li>
|
<li class="nav-item"><a href="/info" class="nav-link">개인정보</a></li>
|
||||||
<li class="nav-item"><a href="/logout" class="nav-link">로그아웃</a></li>
|
<li class="nav-item"><a href="/logout" class="nav-link">로그아웃</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
layout:decorate="~{layout/layout}">
|
layout:decorate="~{layout/layout}">
|
||||||
<th:block layout:fragment="script">
|
<th:block layout:fragment="script">
|
||||||
<script type="text/javascript" th:src="@{/static/js/admin/userMgt.js}"></script>
|
<script type="text/javascript" th:src="@{/js/admin/userMgt.js}"></script>
|
||||||
</th:block>
|
</th:block>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
<main class="pt-3">
|
<main class="pt-3">
|
||||||
<h4>페이지 이름</h4>
|
<h4>페이지 이름</h4>
|
||||||
<div class="row mx-0">
|
<div class="row mx-0">
|
||||||
<div class="col-12 card text-center">
|
<div class="col-12 card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row justify-content-start">
|
<div class="row justify-content-start">
|
||||||
<div class="col-7">
|
<div class="col-7">
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{layout/layout}">
|
|
||||||
<div layout:fragment="content">
|
|
||||||
<h1>This is MyInfo Page.</h1>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
</html>
|
|
||||||
|
|
@ -0,0 +1,150 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
<th:block layout:fragment="script">
|
||||||
|
<script type="text/javascript" th:src="@{/js/user/info.js}"></script>
|
||||||
|
</th:block>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<main class="pt-3">
|
||||||
|
<div class="row justify-content-between">
|
||||||
|
<div class="col-auto"><h4>개인정보</h4></div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<th:block th:if="${!#strings.contains(loginUser.userRole,'ADMIN')}">
|
||||||
|
<button class="btn btn-success"> 요청 현황</button>
|
||||||
|
<button class="btn btn-warning"> 수정 요청</button>
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mx-0">
|
||||||
|
<div class="col-12 card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row justify-content-start">
|
||||||
|
<div class="col-4">
|
||||||
|
<h5 class="ps-3">계정정보</h5>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="userId" class="col-sm-3 col-form-label">아이디</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="userId" th:value="${loginUser.userId}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="name" class="col-sm-3 col-form-label">이름</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="name" th:value="${loginUser.name}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="staticEmail" class="col-sm-3 col-form-label">권한</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="staticEmail" th:value="${#strings.contains(loginUser.userRole, 'ADMIN')?'관리자':'사용자'}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="department" class="col-sm-3 col-form-label">부서</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<th:block th:each="department:${session.departmentList}">
|
||||||
|
<th:block th:if="${department.codeSq==loginUser.department}">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="department" th:value="${department.value}">
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="position" class="col-sm-3 col-form-label">직책</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<th:block th:each="position:${session.positionList}">
|
||||||
|
<th:block th:if="${position.codeSq==loginUser.position}">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="position" th:value="${position.value}">
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="createDate" class="col-sm-3 col-form-label">계정생성일</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="createDate" th:value="${#temporals.format(loginUser.createDate, 'yyyy-MM-dd')}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<th:block th:if="${!#strings.contains(loginUser.userRole,'ADMIN')}">
|
||||||
|
<div class="col-8">
|
||||||
|
<h5 class="ps-3">권한정보</h5>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="row justify-content-between">
|
||||||
|
<div class="col-auto"><button type="button" class="btn btn-warning" id="moveLeftBtn"><i class="bi bi-arrow-left"></i></button></div>
|
||||||
|
<div class="col-auto"><button type="button" class="btn btn-warning" id="moveRightBtn"><i class="bi bi-arrow-right"></i></button></div>
|
||||||
|
</div>
|
||||||
|
<div class="row overflow-auto flex-nowrap" id="categorySelectBody">
|
||||||
|
<th:block th:each="depth1:${session.categoryList}">
|
||||||
|
<div class="col-auto">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>연도</th>
|
||||||
|
<th>중분류</th>
|
||||||
|
<th>소분류</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<th:block th:each="depth2:${depth1.childCategoryList}">
|
||||||
|
<th:block th:each="depth3:${depth2.childCategoryList}">
|
||||||
|
<th:block th:each="depth4:${depth3.childCategoryList}">
|
||||||
|
<tr th:class="${#lists.contains(categorySeqList, depth4.categorySeq)}?'bg-success bg-opacity-25':''">
|
||||||
|
<td class="depth2Td" th:data-categoryseq="${depth2.categorySeq}" th:text="${depth2.categoryName}"></td>
|
||||||
|
<td class="depth3Td" th:data-categoryseq="${depth3.categorySeq}" th:text="${depth3.categoryName}"></td>
|
||||||
|
<td class="depth4Td" th:data-categoryseq="${depth4.categorySeq}" th:text="${depth4.categoryName}"></td>
|
||||||
|
</tr>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
<!--<th:block th:each="depth2:${depth1.childCategoryList}">
|
||||||
|
<tr th:classappend="${#lists.contains(categorySeqList, depth2.categorySeq)}?'bg-success bg-opacity-25':''">
|
||||||
|
<td th:text="${depth2.categoryName}"></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<th:block th:each="depth3:${depth2.childCategoryList}">
|
||||||
|
<tr th:classappend="${#lists.contains(categorySeqList, depth3.categorySeq)}?'bg-success bg-opacity-25':''">
|
||||||
|
<td></td>
|
||||||
|
<td th:text="${depth3.categoryName}"></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<th:block th:each="depth4:${depth3.childCategoryList}">
|
||||||
|
<tr th:classappend="${#lists.contains(categorySeqList, depth4.categorySeq)}?'bg-success bg-opacity-25':''">
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td th:text="${depth4.categoryName}"></td>
|
||||||
|
</tr>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</th:block>-->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue