Package com.easydesk.web.controller
Class AdminController
java.lang.Object
com.easydesk.web.controller.AdminController
EasyDesk SecurityService의 ModelManager(grant/revokeAll)를 웹에서 조작해보는 간단한 관리자
화면.
User/Group/Role은 실제 DB를 임의 조회하는 대신 UserEnum/GroupEnum/RoleEnum (seed 데이터에 매핑된
고정 enum)을 그대로 드롭다운으로 노출한다. ModelManager API가 (user, group) 조합 단위로만
grant/revokeAll을 지원하기 때문에 화면도 그 단위로만 조작하도록 맞췄다 - 개별 role revoke나 permission
직접 관리는 API에 없어서 이 화면에서는 지원하지 않는다.
로그인 여부만 확인한다 (LoginController#SESSION_USER 세션 속성). authenticate()가 아직 스텁이라
role 기반 접근 제어까지는 걸지 않았다.
-
Constructor Summary
ConstructorsConstructorDescriptionAdminController(SecurityService moduleSecurityService, String dbBackupPath, org.springframework.beans.factory.ObjectProvider<OmReindexer> reindexer) -
Method Summary
Modifier and TypeMethodDescriptionadminHome(HttpSession session, org.springframework.ui.Model model) dbBackup(HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 관리 화면에서 명시적으로 누르는 DB 백업 버튼.grant(Long userId, Long groupId, String roleName, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) luceneReindex(boolean clear, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 관리 화면의 "검색 index 재생성" 버튼.revokeAll(Long userId, Long groupId, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) roles(Long userId, Long groupId, HttpSession session, org.springframework.ui.Model model)
-
Constructor Details
-
AdminController
public AdminController(@Qualifier("moduleSecurityService") SecurityService moduleSecurityService, @Value("${app.db-backup.path:db_backup}") String dbBackupPath, org.springframework.beans.factory.ObjectProvider<OmReindexer> reindexer)
-
-
Method Details
-
adminHome
@GetMapping("/admin") public String adminHome(HttpSession session, org.springframework.ui.Model model) -
luceneReindex
@PostMapping("/admin/lucene-reindex") public String luceneReindex(@RequestParam(name="clear",defaultValue="false") boolean clear, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 관리 화면의 "검색 index 재생성" 버튼. DB 의 모든 AttributeValue/Attachment/Query 를 Lucene 에 다시 index 한다. 오래 걸리므로 background 로 시작하고 바로 돌아온다. 진행 상황은 관리 화면(새로고침)에서 확인한다. 이미 실행 중이면 다시 시작하지 않는다.- Parameters:
clear- true 이면 기존 index 를 모두 지우고 시작한다. (삭제된 데이터의 document 까지 정리)
-
dbBackup
@PostMapping("/admin/db-backup") public String dbBackup(HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 관리 화면에서 명시적으로 누르는 DB 백업 버튼. 예전엔 앱 종료 시 @PreDestroy로 자동 백업했었는데, mvn package 중 bean-graph 플러그인이 앱을 잠깐 띄웠다 내리는 것도 "정상 종료"로 인식되어 매번 백업이 돌아버리는 문제와, kill -9 등 비정상 종료 시엔 아예 실행되지 않는 문제가 있어서 스프링 생명주기에 얹는 대신 이렇게 명시적인 버튼 트리거로 바꿨다. -
roles
@Screen("AdminRoles") @GetMapping("/admin/roles") public String roles(@RequestParam("user") Long userId, @RequestParam("group") Long groupId, HttpSession session, org.springframework.ui.Model model) -
grant
-
revokeAll
@Screen("AdminRoles") @PostMapping("/admin/revoke-all") public String revokeAll(@RequestParam("user") Long userId, @RequestParam("group") Long groupId, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
-