권한 관리 시스템 개선

 새로운 기능:
- 사용자별 세분화된 권한 체크 (can_manage_books, can_manage_notes, can_manage_novels)
- 페이지별 권한 가드 시스템 추가 (permission-guard.js)
- 헤더 메뉴 권한별 표시/숨김 기능

🔧 백엔드 개선:
- 모든 문서 관련 API에서 can_manage_books 권한 체크 추가
- documents.py: 개별 문서 조회, PDF 조회 권한 로직 수정
- highlights.py: 하이라이트 생성/조회 권한 체크 개선
- bookmarks.py: 북마크 생성/조회 권한 체크 개선
- document_links.py: 문서 링크 관련 권한 체크 개선

🎨 프론트엔드 개선:
- header-loader.js: updateMenuPermissions 함수 추가로 권한별 메뉴 제어
- permission-guard.js: 페이지 접근 권한 체크 및 리다이렉트 처리
- 권한 없는 페이지 접근 시 메인 페이지로 안전한 리다이렉트
- 헤더 사용자 정보 상태 보존 로직 추가

🛡️ 보안 강화:
- 403 Forbidden 에러 해결
- 권한 없는 사용자의 무단 페이지 접근 차단
- 문서 관리 권한이 있는 사용자는 모든 문서 공유 가능

📱 사용자 경험 개선:
- 권한에 따른 메뉴 자동 표시/숨김
- 로그인 상태 유지 개선
- 권한 없는 기능 접근 시 친화적인 알림 및 리다이렉트
This commit is contained in:
hyungi
2025-09-05 12:36:05 +09:00
parent 6a537008db
commit aebce091a9
12 changed files with 426 additions and 38 deletions

View File

@@ -332,6 +332,22 @@ window.pdfManagerApp = () => ({
day: 'numeric'
});
},
// 로그아웃
async logout() {
try {
await window.api.logout();
} catch (error) {
console.error('Logout error:', error);
} finally {
// 로컬 스토리지 정리
localStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');
localStorage.removeItem('user_info');
console.log('✅ 로그아웃 완료');
}
},
// 알림 표시
showNotification(message, type = 'info') {