
Merge branch 'master' of http://210.180.118.83/jhpark/cms_frontend
@44075d812c5f68ee1b2e22d206623ce923b607b4
--- client/resources/api/index.js
+++ client/resources/api/index.js
... | ... | @@ -69,8 +69,6 @@ |
69 | 69 |
sessionStorage.setItem("redirect", redirect); |
70 | 70 |
alert('세션이 종료 되었습니다.\n로그인을 새로 해주세요.'); |
71 | 71 |
store.commit("setStoreReset"); |
72 |
- //refresh 쿠키 삭제 |
|
73 |
- document.cookie = "refresh=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; |
|
74 | 72 |
window.location = '/login.page'; |
75 | 73 |
return Promise.reject(refreshError); |
76 | 74 |
} |
+++ client/views/common/pageAuthMixin.js
... | ... | @@ -0,0 +1,17 @@ |
1 | + | |
2 | +export default { | |
3 | + computed: { | |
4 | + pageAuth() { | |
5 | + const vuex = JSON.parse(localStorage.getItem("vuex") || "{}"); | |
6 | + return vuex?.pageAuth || { | |
7 | + inqAuthrt: 'N', | |
8 | + regAuthrt: 'N', | |
9 | + mdfcnAuthrt: 'N', | |
10 | + delAuthrt: 'N', | |
11 | + fileDwnldAuthrt: 'N', | |
12 | + regAuthrt: 'N', | |
13 | + }; | |
14 | + } | |
15 | + } | |
16 | + }; | |
17 | + (파일 끝에 줄바꿈 문자 없음) |
--- client/views/component/userInfo/UserInfoView.vue
+++ client/views/component/userInfo/UserInfoView.vue
... | ... | @@ -236,7 +236,7 @@ |
236 | 236 |
<button class="btn sm tertiary" @click="fnList">목록</button> |
237 | 237 |
</template> |
238 | 238 |
<button |
239 |
- v-if="pageAuth.mdfcnAuthrt == 'Y'" |
|
239 |
+ v-if="pageAuth.mdfcnAuthrt === 'Y'" |
|
240 | 240 |
:class="{ |
241 | 241 |
'btn sm main': true, |
242 | 242 |
}" |
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 |
|
260 | 260 |
// COMPONENT |
261 | 261 |
import UserAuthorList from "./UserAuthorList.vue"; |
262 |
- |
|
262 |
+import pageAuthMixin from "../../common/pageAuthMixin.js"; |
|
263 | 263 |
|
264 | 264 |
// API |
265 | 265 |
import { mbrDetailProc } from "../../../resources/api/mbrInfo"; |
... | ... | @@ -267,6 +267,7 @@ |
267 | 267 |
|
268 | 268 |
export default { |
269 | 269 |
components: { UserAuthorList }, |
270 |
+ mixins: [pageAuthMixin], |
|
270 | 271 |
props: { |
271 | 272 |
pageId: { |
272 | 273 |
type: String, |
... | ... | @@ -283,7 +284,7 @@ |
283 | 284 |
data() { |
284 | 285 |
return { |
285 | 286 |
pageRole: this.$store.state.userType, // 유저 권한 |
286 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
287 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
287 | 288 |
|
288 | 289 |
mbrVO: {}, |
289 | 290 |
showOpt: { ...defaultUserInfoParams }, // 유저정보 표시 여부 객체 |
--- client/views/index.js
+++ client/views/index.js
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 |
async function initVueApp() { |
23 | 23 |
const savedLoginMode = localStorage.getItem("loginMode"); |
24 | 24 |
if (savedLoginMode) { |
25 |
- store.commit("setLoginMode", savedLoginMode); |
|
25 |
+ Store.commit("setLoginMode", savedLoginMode); |
|
26 | 26 |
} |
27 | 27 |
|
28 | 28 |
const router = await createAppRouter() |
--- client/views/pages/App.vue
+++ client/views/pages/App.vue
... | ... | @@ -32,11 +32,6 @@ |
32 | 32 |
path: "", |
33 | 33 |
}; |
34 | 34 |
}, |
35 |
- created() { |
|
36 |
- const loginMode = localStorage.getItem("loginMode"); |
|
37 |
- if (loginMode) { |
|
38 |
- this.$store.commit("setLoginMode", loginMode); |
|
39 |
- }}, |
|
40 | 35 |
methods: {}, |
41 | 36 |
watch: { |
42 | 37 |
$route(to, from) { |
--- client/views/pages/AppRouter.js
+++ client/views/pages/AppRouter.js
... | ... | @@ -104,10 +104,12 @@ |
104 | 104 |
mdfcnAuthrt: 'N', // 수정 권한 |
105 | 105 |
delAuthrt: 'N', // 삭제 권한 |
106 | 106 |
fileDwnldAuthrt: 'N', // 파일 다운로드 권한 |
107 |
- } |
|
107 |
+ }; |
|
108 |
+ |
|
108 | 109 |
if (!routeMeta || !routeMeta.authrt || routeMeta.authrt.length === 0) { |
109 | 110 |
return result; |
110 | 111 |
} |
112 |
+ |
|
111 | 113 |
routeMeta.authrt.forEach(auth => { |
112 | 114 |
if (userRoles.includes(auth.authrtCd)) { |
113 | 115 |
if (auth.inqAuthrt === 'Y') result.inqAuthrt = 'Y'; |
... | ... | @@ -175,20 +177,13 @@ |
175 | 177 |
// 로그인 상태 확인 (JWT 또는 SESSION) |
176 | 178 |
const isLogin = loginMode === 'J' ? store.state.authorization : store.state.mbrId; |
177 | 179 |
if (!isLogin && to.path !== filters.ctxPath('/login.page')) { |
180 |
+ sessionStorage.setItem('redirect', to.fullPath); |
|
178 | 181 |
next({ path: filters.ctxPath("/login.page") }); |
179 |
- return; |
|
182 |
+ return; |
|
180 | 183 |
} |
181 | 184 |
|
182 | 185 |
// 접근 제어 확인 |
183 |
- let accesCheck = false; |
|
184 |
- if (loginMode === 'J') { |
|
185 |
- // JWT 방식 접근 제어 |
|
186 |
- accesCheck = await accessUrl(to.path); |
|
187 |
- } else if (loginMode === 'S') { |
|
188 |
- // 세션 방식 접근 제어 (세션이 유효한지 확인) |
|
189 |
- accesCheck = store.state.mbrId != null; |
|
190 |
- } |
|
191 |
- console.log('accesCheck', accesCheck); |
|
186 |
+ const accesCheck = await accessUrl(to.path); |
|
192 | 187 |
const roleCheck = isValidRole(); |
193 | 188 |
if (!accesCheck || !roleCheck) { |
194 | 189 |
alert('접근이 불가합니다.\n관리자에게 문의하세요.'); |
... | ... | @@ -208,6 +203,7 @@ |
208 | 203 |
} |
209 | 204 |
const mbrAuth = store.state.roles.map(auth => auth.authority); // 사용자 권한 정보 |
210 | 205 |
const pageAuth = mergeAuth(mbrAuth, to.meta); |
206 |
+ console.log("권한확인", to.meta); |
|
211 | 207 |
sessionStorage.setItem("redirect", to.fullPath); |
212 | 208 |
|
213 | 209 |
// 메인 페이지 or 로그인 페이지 |
--- client/views/pages/AppStore.js
+++ client/views/pages/AppStore.js
... | ... | @@ -3,10 +3,13 @@ |
3 | 3 |
import { logOutProc } from "../../resources/api/logOut" |
4 | 4 |
|
5 | 5 |
export default createStore({ |
6 |
- plugins: [createPersistedState()], |
|
6 |
+ plugins: [createPersistedState({ |
|
7 |
+ paths: ['loginMode', 'authorization', 'mbrId', 'mbrNm', 'roles', 'contextPath'] |
|
8 |
+ })], |
|
7 | 9 |
state: { |
8 | 10 |
authorization: null, |
9 | 11 |
// refresh: null, |
12 |
+ loginMode: 'J', |
|
10 | 13 |
userType: "portal", |
11 | 14 |
menu: null, |
12 | 15 |
path: null, |
... | ... | @@ -19,6 +22,7 @@ |
19 | 22 |
// getRefresh: function () {}, |
20 | 23 |
getMbrNm: function () {}, |
21 | 24 |
getRoles: function () {}, |
25 |
+ getLoginMode: state => state.loginMode, |
|
22 | 26 |
}, |
23 | 27 |
mutations: { |
24 | 28 |
setAuthorization(state, newValue) { |
... | ... | @@ -48,6 +52,7 @@ |
48 | 52 |
setStoreReset(state) { |
49 | 53 |
state.authorization = null; |
50 | 54 |
// state.refresh = null; |
55 |
+ state.loginMode = 'J'; |
|
51 | 56 |
state.mbrNm = null; |
52 | 57 |
state.mbrId = null; |
53 | 58 |
state.roles = [{authority: "ROLE_NONE"}]; |
... | ... | @@ -63,7 +68,10 @@ |
63 | 68 |
}, |
64 | 69 |
setContextPath(state, ctx) { |
65 | 70 |
state.contextPath = ctx; |
66 |
- } |
|
71 |
+ }, |
|
72 |
+ setLoginMode(state, value) { |
|
73 |
+ state.loginMode = value; |
|
74 |
+ }, |
|
67 | 75 |
}, |
68 | 76 |
actions: { |
69 | 77 |
async logout({ commit }) { |
--- client/views/pages/adm/departmentManagement/DepartmentManagement.vue
+++ client/views/pages/adm/departmentManagement/DepartmentManagement.vue
... | ... | @@ -202,6 +202,7 @@ |
202 | 202 |
updateListProc, |
203 | 203 |
} from "../../../../resources/api/dept"; |
204 | 204 |
import Modal from "../../../component/modal/Modal.vue"; |
205 |
+import pageAuthMixin from "../../../common/pageAuthMixin.js"; |
|
205 | 206 |
export default { |
206 | 207 |
components: { |
207 | 208 |
draggable: draggable, |
... | ... | @@ -210,10 +211,11 @@ |
210 | 211 |
PaginationButton: PaginationButton, |
211 | 212 |
Modal: Modal, |
212 | 213 |
}, |
214 |
+ mixins: [pageAuthMixin], |
|
213 | 215 |
data() { |
214 | 216 |
return { |
215 | 217 |
// 페이지 권한 객체 |
216 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
218 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
217 | 219 |
|
218 | 220 |
colgroup: ["5%", "15%", "20%", "20%", "20%"], // 부서관련 등록된 사용자 테이블 생성 |
219 | 221 |
thead: ["선택", "아이디", "이름", "연락처", "이메일"], // 부서관련 등록된 사용자 테이블 생성 |
--- client/views/pages/adm/member/adminManagement/AdminManagementInsert.vue
+++ client/views/pages/adm/member/adminManagement/AdminManagementInsert.vue
... | ... | @@ -5,15 +5,16 @@ |
5 | 5 |
<script> |
6 | 6 |
// COMPONENETS |
7 | 7 |
import UserInfoInsert from "../../../../component/userInfo/UserInfoInsert.vue"; |
8 |
- |
|
8 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
9 | 9 |
export default { |
10 | 10 |
components: { |
11 | 11 |
UserInfoInsert, |
12 | 12 |
}, |
13 |
+ mixins: [pageAuthMixin], |
|
13 | 14 |
data() { |
14 | 15 |
return { |
15 | 16 |
pageId: this.$route.query.pageId, // 페이지 아이디 |
16 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
17 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
17 | 18 |
}; |
18 | 19 |
}, |
19 | 20 |
}; |
--- client/views/pages/adm/member/adminManagement/AdminManagementSelectList.vue
+++ client/views/pages/adm/member/adminManagement/AdminManagementSelectList.vue
... | ... | @@ -79,9 +79,9 @@ |
79 | 79 |
// API |
80 | 80 |
import { mbrListProc } from "../../../../../resources/api/mbrInfo"; |
81 | 81 |
import { pswdResetProc } from "../../../../../resources/api/mbrInfo"; |
82 |
- |
|
82 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
83 | 83 |
export default { |
84 |
- mixins: [queryParams], |
|
84 |
+ mixins: [queryParams, pageAuthMixin], |
|
85 | 85 |
components: { |
86 | 86 |
ListTable: ListTable, |
87 | 87 |
PaginationButton: PaginationButton, |
... | ... | @@ -89,7 +89,7 @@ |
89 | 89 |
}, |
90 | 90 |
data() { |
91 | 91 |
return { |
92 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
92 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
93 | 93 |
|
94 | 94 |
colgroup: ["5%", "19%", "19%", "15%", "10%", "8%"], |
95 | 95 |
thead: [ |
--- client/views/pages/adm/member/termsManagement/TermsManagementSelectList.vue
+++ client/views/pages/adm/member/termsManagement/TermsManagementSelectList.vue
... | ... | @@ -47,11 +47,13 @@ |
47 | 47 |
<script> |
48 | 48 |
import ListTable from "../../../../component/table/ListTable.vue"; |
49 | 49 |
import PaginationButton from "../../../../component/pagination/PaginationButton.vue"; |
50 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
50 | 51 |
export default { |
52 |
+ mixins: [pageAuthMixin], |
|
51 | 53 |
data() { |
52 | 54 |
return { |
53 | 55 |
// 페이지 권한 객체 |
54 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
56 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
55 | 57 |
|
56 | 58 |
colgroup: ["5%", "19%", "19%", "15%", "10%", "8%"], |
57 | 59 |
thead: ["NO", "제목", "순서", "사용유무", "작성자", "작성일"], |
--- client/views/pages/adm/member/termsManagement/TermsManagementSelectListOne.vue
+++ client/views/pages/adm/member/termsManagement/TermsManagementSelectListOne.vue
... | ... | @@ -57,11 +57,13 @@ |
57 | 57 |
</template> |
58 | 58 |
|
59 | 59 |
<script> |
60 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
60 | 61 |
export default { |
62 |
+ mixins: [pageAuthMixin], |
|
61 | 63 |
data() { |
62 | 64 |
return { |
63 | 65 |
// 페이지 권한 객체 |
64 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
66 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
65 | 67 |
|
66 | 68 |
colgroup: ["5%", "50%", "15%", "15%", "15%"], |
67 | 69 |
thead: ["NO", "기업명", "대표자", "기업상태", "입주의향"], |
--- client/views/pages/adm/member/userManagement/UserManagementInsert.vue
+++ client/views/pages/adm/member/userManagement/UserManagementInsert.vue
... | ... | @@ -5,15 +5,17 @@ |
5 | 5 |
<script> |
6 | 6 |
// COMPONENETS |
7 | 7 |
import UserInfoInsert from "../../../../component/userInfo/UserInfoInsert.vue"; |
8 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
8 | 9 |
|
9 | 10 |
export default { |
10 | 11 |
components: { |
11 | 12 |
UserInfoInsert, |
12 | 13 |
}, |
14 |
+ mixins: [pageAuthMixin], |
|
13 | 15 |
data() { |
14 | 16 |
return { |
15 | 17 |
pageId: this.$route.query.pageId, // 페이지 아이디 |
16 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
18 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
17 | 19 |
}; |
18 | 20 |
}, |
19 | 21 |
}; |
--- client/views/pages/adm/member/userManagement/UserManagementSelectList.vue
+++ client/views/pages/adm/member/userManagement/UserManagementSelectList.vue
... | ... | @@ -101,12 +101,12 @@ |
101 | 101 |
import queryParams from "../../../../../resources/js/queryParams"; |
102 | 102 |
import { insertProc } from "../../../../../resources/api/prvcInqHstry"; |
103 | 103 |
import { defaultSearchParams } from "../../../../../resources/js/defaultSearchParams"; |
104 |
- |
|
104 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
105 | 105 |
// API |
106 | 106 |
import { mbrListProc, pswdResetProc } from "../../../../../resources/api/mbrInfo"; |
107 | 107 |
|
108 | 108 |
export default { |
109 |
- mixins: [queryParams], |
|
109 |
+ mixins: [queryParams, pageAuthMixin], |
|
110 | 110 |
components: { |
111 | 111 |
Modal: Modal, |
112 | 112 |
ListTable: ListTable, |
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 |
}, |
116 | 116 |
data() { |
117 | 117 |
return { |
118 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
118 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
119 | 119 |
|
120 | 120 |
isOpen: false, |
121 | 121 |
|
--- client/views/pages/adm/popup/PopupManagementSelectListOne.vue
+++ client/views/pages/adm/popup/PopupManagementSelectListOne.vue
... | ... | @@ -254,15 +254,18 @@ |
254 | 254 |
|
255 | 255 |
<script> |
256 | 256 |
import { mdiClose, mdiTrayArrowDown } from "@mdi/js"; |
257 |
+import pageAuthMixin from "../../../common/pageAuthMixin.js"; |
|
257 | 258 |
|
258 | 259 |
// API |
259 | 260 |
import { detailProc, deleteProc } from "../../../../resources/api/popup"; |
260 | 261 |
|
261 | 262 |
export default { |
263 |
+ |
|
264 |
+ mixins: [pageAuthMixin], |
|
262 | 265 |
data() { |
263 | 266 |
return { |
264 | 267 |
// 페이지 권한 객체 |
265 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
268 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
266 | 269 |
|
267 | 270 |
path: mdiClose, |
268 | 271 |
downPath: mdiTrayArrowDown, |
--- client/views/pages/adm/preferences/contentTypeManagement/ContentTypeManagementSelectList.vue
+++ client/views/pages/adm/preferences/contentTypeManagement/ContentTypeManagementSelectList.vue
... | ... | @@ -53,20 +53,20 @@ |
53 | 53 |
import { toRaw } from "vue"; |
54 | 54 |
import queryParams from "../../../../../resources/js/queryParams"; |
55 | 55 |
import { defaultSearchParams } from "../../../../../resources/js/defaultSearchParams"; |
56 |
- |
|
56 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
57 | 57 |
|
58 | 58 |
// API |
59 | 59 |
import { findAll } from "../../../../../resources/api/contsType"; |
60 | 60 |
|
61 | 61 |
export default { |
62 |
- mixins: [queryParams], |
|
62 |
+ mixins: [queryParams, pageAuthMixin], |
|
63 | 63 |
components: { |
64 | 64 |
ListTable: ListTable, |
65 | 65 |
PaginationButton: PaginationButton, |
66 | 66 |
}, |
67 | 67 |
data() { |
68 | 68 |
return { |
69 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
69 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
70 | 70 |
|
71 | 71 |
colgroup: ["5%", "40%", "40%", "15%"], |
72 | 72 |
thead: ["번호", "콘텐츠 한글명", "콘텐츠 영문명", "메뉴노출"], |
--- client/views/pages/adm/preferences/contentTypeManagement/ContentTypeManagementSelectListOne.vue
+++ client/views/pages/adm/preferences/contentTypeManagement/ContentTypeManagementSelectListOne.vue
... | ... | @@ -116,12 +116,16 @@ |
116 | 116 |
deleteProc, |
117 | 117 |
} from "../../../../../resources/api/contsType"; |
118 | 118 |
|
119 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
120 |
+ |
|
119 | 121 |
|
120 | 122 |
export default { |
123 |
+ |
|
124 |
+ mixins: [pageAuthMixin], |
|
121 | 125 |
data() { |
122 | 126 |
return { |
123 | 127 |
pageId: this.$route.query.pageId, // 페이지 아이디 |
124 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
128 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한 |
|
125 | 129 |
|
126 | 130 |
contsTypeVO: {}, |
127 | 131 |
}; |
--- client/views/pages/adm/statistics/BbsStatistics.vue
+++ client/views/pages/adm/statistics/BbsStatistics.vue
... | ... | @@ -109,16 +109,16 @@ |
109 | 109 |
|
110 | 110 |
// API |
111 | 111 |
import { selectBbsCntnStatsProc } from "../../../../resources/api/cntnStats"; |
112 |
- |
|
112 |
+import pageAuthMixin from "../../../common/pageAuthMixin.js"; |
|
113 | 113 |
export default { |
114 |
- mixins: [statisticsDate], |
|
114 |
+ mixins: [statisticsDate, pageAuthMixin], |
|
115 | 115 |
components: { |
116 | 116 |
ClusteredBarChart: ClusteredBarChart, |
117 | 117 |
}, |
118 | 118 |
data() { |
119 | 119 |
return { |
120 | 120 |
// 페이지 권한 객체 |
121 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
121 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
122 | 122 |
// 차트 데이터 |
123 | 123 |
chartData: [], |
124 | 124 |
// 전체 수 |
--- client/views/pages/adm/statistics/MenuStatistics.vue
+++ client/views/pages/adm/statistics/MenuStatistics.vue
... | ... | @@ -109,16 +109,17 @@ |
109 | 109 |
|
110 | 110 |
// API |
111 | 111 |
import { selectMenuCntnStatsProc } from "../../../../resources/api/cntnStats"; |
112 |
+import pageAuthMixin from "../../../common/pageAuthMixin.js"; |
|
112 | 113 |
|
113 | 114 |
export default { |
114 |
- mixins: [statisticsDate], |
|
115 |
+ mixins: [statisticsDate, pageAuthMixin], |
|
115 | 116 |
components: { |
116 | 117 |
ClusteredBarChart: ClusteredBarChart, |
117 | 118 |
}, |
118 | 119 |
data() { |
119 | 120 |
return { |
120 | 121 |
// 페이지 권한 객체 |
121 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
122 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
122 | 123 |
// 차트 데이터 |
123 | 124 |
chartData: [], |
124 | 125 |
// 전체 수 |
--- client/views/pages/adm/statistics/UserStatistics.vue
+++ client/views/pages/adm/statistics/UserStatistics.vue
... | ... | @@ -108,16 +108,17 @@ |
108 | 108 |
|
109 | 109 |
// API |
110 | 110 |
import { selectUserCntnStatsProc } from "../../../../resources/api/cntnStats"; |
111 |
+import pageAuthMixin from "../../../common/pageAuthMixin.js"; |
|
111 | 112 |
|
112 | 113 |
export default { |
113 |
- mixins: [statisticsDate], |
|
114 |
+ mixins: [statisticsDate, pageAuthMixin], |
|
114 | 115 |
components: { |
115 | 116 |
ClusteredColumnChart: ClusteredColumnChart, |
116 | 117 |
}, |
117 | 118 |
data() { |
118 | 119 |
return { |
119 | 120 |
// 페이지 권한 객체 |
120 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
121 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
121 | 122 |
// 차트 데이터 |
122 | 123 |
chartData: [], |
123 | 124 |
// 전체 수 |
--- client/views/pages/adm/system/networkAccessControl/NetworkAccessControlSelectList.vue
+++ client/views/pages/adm/system/networkAccessControl/NetworkAccessControlSelectList.vue
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 |
<button |
56 | 56 |
class="btn sm main" |
57 | 57 |
@click="fnAdd" |
58 |
- v-if="pageAuth.regAuthrt == 'Y'" |
|
58 |
+ v-if="pageAuth.regAuthrt === 'Y'" |
|
59 | 59 |
> |
60 | 60 |
등록 |
61 | 61 |
</button> |
... | ... | @@ -69,10 +69,10 @@ |
69 | 69 |
import { toRaw } from "vue"; |
70 | 70 |
import queryParams from "../../../../../resources/js/queryParams"; |
71 | 71 |
import { defaultSearchParams } from "../../../../../resources/js/defaultSearchParams"; |
72 |
- |
|
72 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
73 | 73 |
|
74 | 74 |
export default { |
75 |
- mixins: [queryParams], |
|
75 |
+ mixins: [queryParams, pageAuthMixin], |
|
76 | 76 |
components: { |
77 | 77 |
ListTable: ListTable, |
78 | 78 |
PaginationButton: PaginationButton, |
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 |
data() { |
81 | 81 |
return { |
82 | 82 |
// 페이지 권한 객체 |
83 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
83 |
+// pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
84 | 84 |
|
85 | 85 |
colgroup: ["5%", "50%", "15%", "15%", "15%"], |
86 | 86 |
thead: ["NO", "경로", "제어IP", "유형", "등록일"], |
--- client/views/pages/adm/system/networkAccessControl/NetworkAccessControlSelectListOne.vue
+++ client/views/pages/adm/system/networkAccessControl/NetworkAccessControlSelectListOne.vue
... | ... | @@ -47,15 +47,16 @@ |
47 | 47 |
<script> |
48 | 48 |
import { findByAcces, del } from "../../../../../resources/api/accesCtrl"; |
49 | 49 |
import queryParams from "../../../../../resources/js/queryParams"; |
50 |
+import pageAuthMixin from "../../../../common/pageAuthMixin.js"; |
|
50 | 51 |
|
51 | 52 |
export default { |
52 |
- mixins: [queryParams], |
|
53 |
+ mixins: [queryParams, pageAuthMixin], |
|
53 | 54 |
components: { |
54 | 55 |
}, |
55 | 56 |
data() { |
56 | 57 |
return { |
57 | 58 |
// 페이지 권한 객체 |
58 |
- pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
59 |
+ // pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, |
|
59 | 60 |
|
60 | 61 |
accesCtrl: {}, |
61 | 62 |
pageId: "", |
--- client/views/pages/login/Login.vue
+++ client/views/pages/login/Login.vue
... | ... | @@ -108,6 +108,7 @@ |
108 | 108 |
// JWT 방식 |
109 | 109 |
store.commit("setAuthorization", res.headers.authorization); |
110 | 110 |
store.commit("setLoginMode", "J"); |
111 |
+ localStorage.setItem("loginMode", "J"); |
|
111 | 112 |
const base64String = store.state.authorization.split(".")[1]; |
112 | 113 |
const base64 = base64String.replace(/-/g, "+").replace(/_/g, "/"); |
113 | 114 |
const jsonPayload = decodeURIComponent( |
... | ... | @@ -120,18 +121,19 @@ |
120 | 121 |
store.commit("setMbrNm", mbr.mbrNm); |
121 | 122 |
store.commit("setRoles", mbr.roles); |
122 | 123 |
} else if (loginType === 'S') { |
123 |
- // 세션 방식 (서버에서 따로 body에 사용자 정보 내려줘야 함) |
|
124 | 124 |
store.commit("setLoginMode", "S"); |
125 |
+ localStorage.setItem("loginMode", "S"); |
|
125 | 126 |
const mbr = res.data; |
126 | 127 |
store.commit("setAuthorization", null); |
127 | 128 |
store.commit("setMbrId", mbr.mbrId); |
128 | 129 |
store.commit("setMbrNm", mbr.mbrNm); |
129 |
- store.commit("setRoles", mbr.roles); |
|
130 |
+ const roles = mbr.roles.map(r => ({ authority: r.authrtCd })); |
|
131 |
+ store.commit("setRoles", roles); |
|
130 | 132 |
} else { |
131 | 133 |
alert("알 수 없는 로그인 방식입니다."); |
132 | 134 |
return; |
133 | 135 |
} |
134 |
- |
|
136 |
+ const isAdmin = store.state.roles.some(role => role.authority === "ROLE_ADMIN"); |
|
135 | 137 |
let url = this.restoreRedirect("redirect"); |
136 | 138 |
if (url != null && url != "") { |
137 | 139 |
const ctx = store.state.contextPath; |
... | ... | @@ -142,14 +144,21 @@ |
142 | 144 |
// redirect 값에서 기존 Context Path 제거 |
143 | 145 |
url = url.replace(/^\/[^\/]+/, ""); // 첫 번째 '/' 이후의 경로만 남김 |
144 | 146 |
} |
147 |
+ const routeExists = this.$router.getRoutes().some(route => route.path === url); |
|
145 | 148 |
|
146 | 149 |
if (url == this.$filters.ctxPath("/searchId.page") || url == this.$filters.ctxPath("/resetPswd.page")) { |
147 |
- this.$router.push({ path: this.$filters.ctxPath("/main.page") }); |
|
148 |
- } else { |
|
149 |
- this.$router.push({ path: url }); |
|
150 |
- } |
|
150 |
+ this.$router.push({ path: this.$filters.ctxPath("/main.page") }); |
|
151 |
+ } else if (routeExists) { |
|
152 |
+ this.$router.push({ path: url }); |
|
153 |
+ } else { |
|
154 |
+ this.$router.push({ |
|
155 |
+ path: isAdmin ? this.$filters.ctxPath("/adm/main.page") : this.$filters.ctxPath("/") |
|
156 |
+ }); |
|
157 |
+ } |
|
151 | 158 |
} else { |
152 |
- this.$router.push({ path: this.$filters.ctxPath("/") }); |
|
159 |
+ this.$router.push({ |
|
160 |
+ path: isAdmin ? this.$filters.ctxPath("/adm/main.page") : this.$filters.ctxPath("/") |
|
161 |
+ }); |
|
153 | 162 |
} |
154 | 163 |
|
155 | 164 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?