대시보드 구성

강석 최 2022-08-19 14:30:04 +09:00
parent f6ed78269b
commit d84c7f3ea4
11 changed files with 125 additions and 214 deletions

View File

@ -59,7 +59,7 @@ public class SecurityConfig{
@Bean @Bean
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception { protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests() // 페이지 권한 설정 http.authorizeRequests() // 페이지 권한 설정
.antMatchers("/file/**", "/board/**", "/info/**").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용 .antMatchers("/dashboard").hasRole(Role.USER.name()) // USER, ADMIN 접근 허용
.antMatchers("/admin/**").hasRole(Role.ADMIN.name()) // ADMIN만 접근 허용 .antMatchers("/admin/**").hasRole(Role.ADMIN.name()) // ADMIN만 접근 허용
.antMatchers("/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용 .antMatchers("/login").permitAll() // 로그인 페이지는 권한 없이 접근 허용
.and() // 로그인 설정 .and() // 로그인 설정

View File

@ -23,11 +23,7 @@ public class BaseController {
if(loginUser == null){ if(loginUser == null){
mav = new ModelAndView("redirect:/login"); mav = new ModelAndView("redirect:/login");
}else{ }else{
if(loginUser.getUserRole().indexOf("ADMIN")>0){ mav = new ModelAndView("redirect:/dashboard");
mav = new ModelAndView("redirect:/admin/main");
}else{
mav = new ModelAndView("redirect:/board/main");
}
} }
return mav; return mav;
} }
@ -56,4 +52,10 @@ public class BaseController {
ModelAndView mav = new ModelAndView("login/denied"); ModelAndView mav = new ModelAndView("login/denied");
return mav; return mav;
} }
@GetMapping("/dashboard")
public ModelAndView dashboard() {
ModelAndView mav = new ModelAndView("login/dashboard");
return mav;
}
} }

View File

@ -76,6 +76,6 @@ public class UserInfo extends BaseModel implements UserDetails{
@Override @Override
public boolean isEnabled() { public boolean isEnabled() {
return userStatus.equals("ST002"); return userStatus.equals("ST003");
} }
} }

View File

@ -27,7 +27,7 @@ public class UserInfoService implements UserDetailsService {
return "userIdDuplication"; return "userIdDuplication";
} }
userInfo.setUserRole(Role.USER.getValue()); userInfo.setUserRole(Role.USER.getValue());
userInfo.setUserStatus("ST001"); userInfo.setUserStatus("ST002");
userInfo.setPassword(convertPassword(userInfo.getPassword())); userInfo.setPassword(convertPassword(userInfo.getPassword()));
return userInfoRepository.save(userInfo).getUserId(); return userInfoRepository.save(userInfo).getUserId();
} }

View File

@ -1,31 +1,3 @@
.centerDiv{
max-height: fit-content;
}
/*스크롤기능 있지만 안보이게*/
body::-webkit-scrollbar {
display: none;
}
/*사이드바 카테고리 트리*/
.btn-toggle:hover, .btn-toggle:focus {
color: rgba(0, 0, 0, .85);
background-color: #d2f4ea;
}
.btn-toggle::before {
width: 1.25em;
line-height: 0;
content: url("/img/bootstrap-icons-1.7.1/caret-right-fill.svg");
transition: transform .35s ease;
transform-origin: 0.5em 50%;
}
.btn-toggle[aria-expanded="true"]::before {
content: url("/img/bootstrap-icons-1.7.1/caret-down-fill.svg");
/*왜 안돌까?*/
/*transform: rotate(90deg);*/
}
#fadeDiv{ #fadeDiv{
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -42,13 +14,4 @@ body::-webkit-scrollbar {
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
background-color: #ffffff; background-color: #ffffff;
} }
#list-group-line{
padding-bottom: 52vh;
}
/*@media (max-width:1199px)*/
/* .sidebar {*/
/* left: -300px;*/
/* }*/

View File

@ -1,48 +1,3 @@
let categorySeq;
$(document).on('click', '#moveRightBtn', function (){
moveCategorySelectBody(1);
})
$(document).on('click', '#moveLeftBtn', function (){
moveCategorySelectBody(-1);
})
$(document).on('click', '.contentWriteBtn', function (){
location.href="/board/contentWrite"+(categorySeq!==undefined?("?categorySeq="+categorySeq):"");
})
function sessionReload(){
$.ajax({
url: '/refreshSession',
type: 'GET',
success: function(){location.reload();},
error:function(){}
});
}
function moveCategorySelectBody(direction){
const categorySelectBody = $("#categorySelectBody");
const nowX = categorySelectBody.scrollLeft();
categorySelectBody.animate({scrollLeft:(direction*200+nowX)},200);
}
function setMenu(){
const categorySeq = getParam("categorySeq");
openMenu($("[data-categoryseq='"+categorySeq+"']").attr("data-parentseq"));
}
function getParam(sname) {
const paramAry = location.search.substr(1).split("&");
for (let i = 0; i < paramAry.length; i++) {
const param = paramAry[i].split("=");
if (param[0] === sname) { return param[1]; }
}
}
function openMenu(parentSeq){
if(parentSeq){
const target = $("[data-categoryseq='"+parentSeq+"']")
target.click();
openMenu(target.attr("data-parentseq"));
}
}
function contentFade(action){ function contentFade(action){
if(action === "in"){ if(action === "in"){
$("#fadeDiv").show() $("#fadeDiv").show()

View File

@ -2,14 +2,33 @@
<html lang="ko" <html lang="ko"
xmlns:th="http://www.thymeleaf.org" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"> xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<header th:fragment="headerFragment" class="d-flex flex-wrap justify-content-center py-1 px-3 border-bottom"> <header th:fragment="headerFragment" class="d-flex flex-wrap justify-content-between py-1 px-3 border-bottom">
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none"> <div sec:authorize="isAnonymous()">
<img id="logo" th:src="@{/img/logo.png}" alt="logo" title="logo"> <a href="/" class="d-flex">
<!--<span class="fs-4">해양경찰청 파일관리 시스템</span>--> <img id="logo" th:src="@{/img/logo.png}" alt="logo" title="logo">
</a> <!--<span class="fs-4">해양경찰청 파일관리 시스템</span>-->
<ul class="nav nav-pills" sec:authorize="isAuthenticated()"> </a>
<li class="nav-item"><a href="/info/myInfo" class="nav-link">개인정보</a></li> </div>
<li class="nav-item"><a href="/logout" class="nav-link">로그아웃</a></li> <div>
</ul> <ul class="nav nav-pills" sec:authorize="hasRole('ROLE_ADMIN')">
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">코드관리</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">메뉴관리</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">외사경찰관리</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">권한설정</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">사용자로그</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">접속설정</a></li>
</ul>
</div>
<div sec:authorize="isAuthenticated()">
<ul class="nav nav-pills">
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark"><i class="bi bi-bell-fill"></i></a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">공지사항</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">게시판</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">자료실</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">Q&A</a></li>
<li class="nav-item"><a href="#" class="nav-link p-1 link-dark">마이페이지</a></li>
<li class="nav-item"><a href="/logout" class="nav-link p-1 link-dark">로그아웃</a></li>
</ul>
</div>
</header> </header>
</html> </html>

View File

@ -2,92 +2,24 @@
<html lang="ko" <html lang="ko"
xmlns:th="http://www.thymeleaf.org" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5" xmlns="http://www.w3.org/1999/html"> xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5" xmlns="http://www.w3.org/1999/html">
<div id="list-group-line" class="mx-3 pt-3" th:fragment="leftMenuFragment"> <div class="mx-3 pt-3" th:fragment="leftMenuFragment">
<div sec:authorize="hasRole('ROLE_ADMIN')"> <a href="/" class="d-flex">
<div class="list-group py-2"> <img id="logo" th:src="@{/img/logo.png}" alt="logo" title="logo">
<!--<a href="/admin/categoryMgt" class="list-group-item list-group-item-action">게시판 분류 관리</a>--> <!--<span class="fs-4">해양경찰청 파일관리 시스템</span>-->
<a href="/admin/categoryMgt2" class="list-group-item list-group-item-action">게시판 분류 관리</a> </a>
<a href="/admin/userMgt" class="list-group-item list-group-item-action">사용자 관리</a> <ul class="nav nav-pills flex-column my-3" sec:authorize="isAuthenticated()">
<a href="/info/modifyRequestList" class="list-group-item list-group-item-action">수정 요청</a> <li><a href="#" class="nav-link link-dark">외사정보관리</a></li>
<a href="#" class="list-group-item list-group-item-action disabled">통계</a> <li><a href="#" class="nav-link link-dark">외사수사관리</a></li>
<a href="/admin/codeMgt" class="list-group-item list-group-item-action">코드관리</a> <li><a href="#" class="nav-link link-dark">외사방첩관리</a></li>
</div> <li><a href="#" class="nav-link link-dark">외사대상목표</a></li>
</div> <li><a href="#" class="nav-link link-dark">정보예산관리</a></li>
<div class="d-grid gap-2"> <li><a href="#" class="nav-link link-dark">외사장비</a></li>
<a class="btn btn-primary" href="/board/contentSearch"><i class="bi bi-search"></i> 통합 검색</a> <li><a href="#" class="nav-link link-dark">첩보수집활동</a></li>
</div> <li><a href="#" class="nav-link link-dark">외사첩보망</a></li>
<div class="d-grid gap-2 pt-1"> <li><a href="#" class="nav-link link-dark">외사모니터링</a></li>
<a class="btn btn-success contentWriteBtn"><i class="bi bi-file-earmark-plus "></i> 자료 등록</a> <li><a href="#" class="nav-link link-dark">외사통계</a></li>
</div> <li><a href="#" class="nav-link link-dark">외사경찰</a></li>
<div sec:authorize="isAuthenticated()"> <li><a href="#" class="nav-link link-dark">민간통역인</a></li>
<div class="flex-shrink-0 pe-3 py-3 bg-transparent"> </ul>
<ul class="list-unstyled ps-0">
<th:block th:each="depth1:${session.categoryList}">
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed"
data-bs-toggle="collapse" aria-expanded="false"
th:data-categoryseq="${depth1.categorySeq}"
th:data-bs-target="'#collapse'+${depth1.categorySeq}" th:text="${depth1.categoryName}">
</button>
<div class="collapse ps-3" th:id="|collapse${depth1.categorySeq}|">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
<th:block th:each="depth2:${depth1.childCategoryList}">
<li>
<ul class="list-unstyled ps-0">
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed"
data-bs-toggle="collapse" aria-expanded="false"
th:data-categoryseq="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}"
th:data-bs-target="'#collapse'+${depth2.categorySeq}" th:text="${depth2.categoryName}">
</button>
<div class="collapse ps-3" th:id="|collapse${depth2.categorySeq}|">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
<th:block th:each="depth3:${depth2.childCategoryList}">
<li>
<ul class="list-unstyled ps-0">
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed"
data-bs-toggle="collapse" aria-expanded="false"
th:data-categoryseq="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}"
th:data-bs-target="'#collapse'+${depth3.categorySeq}" th:text="${depth3.categoryName}">
</button>
<div class="collapse ps-3" th:id="|collapse${depth3.categorySeq}|">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1">
<th:block th:each="depth4:${depth3.childCategoryList}">
<li><a th:href="|@{/board/contentList}?categorySeq=${depth4.categorySeq}|"
th:data-categoryseq="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
class="bi bi-dash link-dark rounded ps-3 text-decoration-none"
th:text="${depth4.categoryName}"></a></li>
</th:block>
<th:block th:if="${depth3.childCategoryList.size==0}">
<li>등록된 소분류가 없습니다.</li>
</th:block>
</ul>
</div>
</li>
</ul>
</li>
</th:block>
<th:block th:if="${depth2.childCategoryList.size==0}">
<li>등록된 중분류가 없습니다.</li>
</th:block>
</ul>
</div>
</li>
</ul>
</li>
</th:block>
<th:block th:if="${depth1.childCategoryList.size==0}">
<li>등록된 연도가 없습니다.</li>
</th:block>
<!--<li><a href="#" class="link-dark rounded">Shipped</a></li>
<li><a href="#" class="link-dark rounded">Returned</a></li>-->
</ul>
</div>
</li>
</th:block>
</ul>
</div>
</div>
</div> </div>
</html> </html>

View File

@ -35,25 +35,17 @@
<th:block layout:fragment="script"></th:block> <th:block layout:fragment="script"></th:block>
<th:block sec:authorize="isAuthenticated()"> <th:block sec:authorize="isAuthenticated()">
<script type="text/javascript"> <script type="text/javascript">
$(function (){
/*세션 체크*/
const positionList = '[[${session.positionList}]]';
const departmentList = '[[${session.departmentList}]]';
if(!positionList && !departmentList) {
sessionReload()
}
})
</script> </script>
</th:block> </th:block>
</head> </head>
<body class="d-flex flex-column h-100"> <body class="d-flex flex-column h-100">
<header th:replace="fragments/header :: headerFragment"></header> <header th:replace="fragments/header :: headerFragment"></header>
<div class="h-100" sec:authorize="isAnonymous()" layout:fragment="content"></div> <div sec:authorize="isAnonymous()" layout:fragment="content"></div>
<div sec:authorize="isAuthenticated()" class="row mx-0"> <div sec:authorize="isAuthenticated()" class="row h-100 mx-0">
<div class="sidebar col-2 d-lg-block d-none centerDiv border-end"> <div class="col-2 border-end">
<div th:replace="fragments/leftMenu :: leftMenuFragment"></div> <div th:replace="fragments/leftMenu :: leftMenuFragment"></div>
</div> </div>
<div class="col-12 col-lg-10 centerDiv"> <div class="col-10">
<div layout:fragment="content"></div> <div layout:fragment="content"></div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,63 @@
<!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/admin/userMgt.js}"></script>
</th:block>
<div layout:fragment="content">
<main class="pt-3">
<h4>대시보드</h4>
<div class="row mx-0">
<div class="col-12 card">
<div class="card-body">
<div class="row">
<div class="col-4">
<div class="card">
<div class="card-body">
목록1
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
목록2
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
목록3
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
목록4
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
목록5
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
목록6
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</html>

View File

@ -1,15 +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">
<form th:action="@{/signup}" method="post">
<input type="text" name="userId" placeholder="이메일 입력해주세요" />
<input type="password" name="password" placeholder="비밀번호" />
<input type="radio" name="userRole" value="ROLE_ADMIN,ROLE_USER" /> admin
<input type="radio" name="userRole" value="ROLE_USER" checked="checked" />
member <br />
<button type="submit">가입하기</button>
</form>
</div>
</html>