OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2022-01-13 ebfd37816a332308519b30af5bfb017c5052be69
src/main/java/kr/wisestone/owl/service/impl/UserWorkspaceServiceImpl.java
@@ -79,7 +79,7 @@
    public List<UserWorkspaceVo> findUserWorkspace(Map<String, Object> resJsonData,
                                                   UserWorkspaceCondition condition, Pageable pageable) {
        UserWorkspace userWorkspace = this.findMyWorkspace(this.webAppUtil.getLoginId());
        UserWorkspace userWorkspace = this.findWorkspaceManager(this.webAppUtil.getLoginId());
        Workspace myWorkspace = userWorkspace.getWorkspace();
        condition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        condition.setPageSize(pageable.getPageSize());
@@ -126,6 +126,12 @@
            UserLevel userLevel = this.userLevelService.getUserLevel(userWorkspaceForm.getLevelId());
            user.setUserLevel(userLevel);
            userWorkspace.setUser(user);
            //  등급 변경 된 유저 로그아웃 시키기
            this.simpMessagingTemplate.convertAndSendToUser(user.getAccount(), "/notification/changeUserLevel", this.messageAccessor.getMessage(MsgConstants.USER_LEVEL_CHANGE));
            //  세션 업데이트
            //SecurityUtils.setUserToSession(user);
        }
        // 부서 변경
@@ -172,10 +178,10 @@
    public void disabledUserWorkspace(User user, Workspace workspace) {
        UserWorkspace userWorkspace = this.userWorkspaceRepository.findByUserIdAndWorkspaceId(user.getId(), workspace.getId());
        if (userWorkspace.getManagerYn()) {
        /*if (userWorkspace.getManagerYn()) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.WORKSPACE_MANAGER_NOT_CHANGE_USE_YN));
        }
        }*/
        userWorkspace.setUseYn(false);
        this.userWorkspaceRepository.saveAndFlush(userWorkspace);
@@ -216,6 +222,13 @@
        return this.userWorkspaceRepository.findByUserIdAndManagerYn(userId, true);
    }
    //  워크스페이스 관리자 조회
    @Override
    @Transactional(readOnly = true)
    public UserWorkspace findWorkspaceManager(Long userId) {
        return this.userWorkspaceRepository.findByUserId(userId);
    }
    //  업무 공간 사용자 연결 아이디로 업무 공간 사용자 연결 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
@@ -238,15 +251,14 @@
    //  업무 공간 담당자 여부를 확인한다.
    @Override
    @Transactional(readOnly = true)
    public boolean checkWorkspaceManager() {
    public boolean checkWorkspaceManager(User user) {
        boolean bIsManager = false;
        User loginUser = this.userService.getUser(this.webAppUtil.getLoginId());
        try
        {
            Workspace workspace = this.workspaceService.getWorkspace(loginUser.getLastWorkspaceId());   //  현재 접속한 업무 공간
            Workspace workspace = this.workspaceService.getWorkspace(user.getLastWorkspaceId());   //  현재 접속한 업무 공간
            //  로그인한 사용자가 관리하는 업무 공간을 찾는다.
            UserWorkspace userWorkspace = this.findMyWorkspace(this.webAppUtil.getLoginId());
            UserWorkspace userWorkspace = this.findMyWorkspace(user.getId());
            bIsManager = workspace.getId().equals(userWorkspace.getWorkspace().getId());
        }