| | |
| | | @Override |
| | | @Transactional |
| | | public void checkUseWorkspace() { |
| | | Workspace workspace = this.getWorkspace(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); |
| | | User user = this.webAppUtil.getLoginUserObject(); |
| | | Workspace workspace = this.getWorkspace(user.getLastWorkspaceId()); |
| | | |
| | | this.checkUseWorkspace(user, workspace.getId()); |
| | | } |
| | | |
| | | // 사용하고 있는 업무 공간이 활성 상태인지 확인한다. 사용 공간에서 로그인한 사용자가 비활성인지 확인한다. |
| | | @Override |
| | | @Transactional |
| | | public Workspace checkUseWorkspace(User user, Long workspaceId) { |
| | | if (user == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.USER_NOT_EXIST)); |
| | | } |
| | | |
| | | if (workspaceId == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.WORKSPACE_NOT_EXIST)); |
| | | } |
| | | |
| | | Workspace workspace = this.getWorkspace(workspaceId); |
| | | |
| | | if (workspace.getServiceType().equals(ServiceType.UNUSED)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.WORKSPACE_USE_PERIOD_EXCESS)); |
| | | } |
| | | |
| | | UserWorkspace userWorkspace = this.userWorkspaceService.findByUserIdAndWorkspaceId(this.webAppUtil.getLoginId(), workspace.getId()); |
| | | UserWorkspace userWorkspace = this.userWorkspaceService.findByUserIdAndWorkspaceId(user.getId(), workspace.getId()); |
| | | |
| | | if (!userWorkspace.getUseYn()) { |
| | | // 해당 사용자가 관리하는 업무 공간를 마지막 접근 업무 공간로 변경한다. |
| | | this.userService.updateLastMyWorkspace(userWorkspace.getUser()); |
| | | |
| | | // 비활성 사용자는 더이상 해당 업무 공간에 있으면 안된다. |
| | | this.simpMessagingTemplate.convertAndSendToUser(this.webAppUtil.getLoginUser().getAccount(), "/notification/workspace-remove", this.messageAccessor.getMessage(MsgConstants.WORKSPACE_OUT, workspace.getName())); |
| | | this.simpMessagingTemplate.convertAndSendToUser(user.getAccount(), "/notification/workspace-remove", this.messageAccessor.getMessage(MsgConstants.WORKSPACE_OUT, workspace.getName())); |
| | | |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.WORKSPACE_INCLUDE_DISABLED)); |
| | | } |
| | | |
| | | return workspace; |
| | | } |
| | | |
| | | // 사용 공간에서 로그인한 사용자가 비활성인지 확인하고 비활성일 경우 엑셀 다운로드를 금지한다. |