[미들웨어 및 권한 시스템 개선] 기존 auth 미들웨어를 auth.global.ts로 통합하여 로그인 및 권한 체크 로직을 개선하고, 페이지 권한 확인 방식을 동적 라우팅 패턴으로 확장함. 불필요한 코드 제거 및 로그아웃 처리 로직 간소화.

This commit is contained in:
2025-09-25 11:28:12 +09:00
parent cb22e3904a
commit 51019d7f5f
6 changed files with 59 additions and 52 deletions

View File

@@ -72,7 +72,23 @@ export const usePermissionsStore = defineStore(
};
const hasPagePermission = (page: string): boolean => {
return getPagePaths().includes(page);
const pagePaths = getPagePaths();
// 1. 정확한 경로 매치 먼저 확인
if (pagePaths.includes(page)) {
return true;
}
// 2. 동적 라우팅 패턴 체크
for (const allowedPath of pagePaths) {
// 동적 라우팅 패턴: /[tabId]/path 형태
const dynamicPattern = new RegExp(`^/\\d+${allowedPath}$`);
if (dynamicPattern.test(page)) {
return true;
}
}
return false;
};
const hasPageGroupPermission = (pageGroup: string): boolean => {