feat: 관리자 권한 대상 전화번호 추가 및 권한 토글 활성화
Some checks failed
ITAM Code Check / build-and-config-check (push) Failing after 10s
ITAM Docker Build Check / docker-build-check (push) Failing after 15s

This commit is contained in:
이태훈
2026-07-02 15:47:10 +09:00
parent fd0bd126d1
commit 0e88be4755
2 changed files with 25 additions and 7 deletions

View File

@@ -23,7 +23,9 @@ import { createIcons, Plus, X, LayoutDashboard, Monitor, Server, Database, Lapto
interface AuthSessionResponse {
authenticated: boolean;
user: unknown;
user: {
loginId: string;
} | null;
}
let phoneLoginPollTimer: number | undefined;
@@ -247,14 +249,24 @@ function initRoleSwitcher() {
/**
* 앱 초기화 (로그인 과정 없이 즉시 시작)
*/
function initializeAppDirectly() {
function initializeAppDirectly(userMobile: string) {
const loginContainer = document.getElementById('login-container');
const appLayout = document.getElementById('app-layout');
// 기본 권한 설정: 실무자 (User)
state.currentUserRole = 'user';
state.currentUserMobile = userMobile;
// 허용할 관리자 특정 전화번호 목록
const allowedAdminMobiles = ['01086270921', '01045278434', '01042470144', '01041585840'];
if (allowedAdminMobiles.includes(userMobile)) {
state.currentUserRole = 'admin';
state.activeSubTab = '대시보드';
} else {
state.currentUserRole = 'user';
state.activeSubTab = '서버'; // 실무자 기본 탭
}
state.activeCategory = 'hw';
state.activeSubTab = '서버'; // 실무자 기본 탭
// 화면 전환
if (loginContainer) loginContainer.style.display = 'none';
@@ -321,7 +333,7 @@ function showLoginScreen(errorMessage?: string) {
if (payload.status === 'authenticated') {
clearPhonePollTimer();
initializeAppDirectly();
initializeAppDirectly(payload.user?.loginId || '');
return;
}
@@ -401,7 +413,7 @@ async function bootstrapApp() {
const response = await fetch('/api/auth/session');
const sessionInfo = await response.json() as AuthSessionResponse;
if (response.ok && sessionInfo.authenticated) {
initializeAppDirectly();
initializeAppDirectly(sessionInfo.user?.loginId || '');
return;
}
} catch (error) {