diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index 41ee06d3c6..e82621fb2d 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -92,15 +92,9 @@ public class WorkspaceController { return workspaceService.getWorkspaceListByUserId(userId); } - @GetMapping("/list/orgworkspace/") - public List getWorkspaceListByOrgIdAndUserId() { - String currentOrganizationId = SessionUtils.getCurrentOrganizationId(); - return workspaceService.getWorkspaceListByOrgIdAndUserId(currentOrganizationId); - } - - @GetMapping("/list/orgworkspace/{orgId}") - public List getWorkspaceListByOrgId(@PathVariable String orgId) { - return workspaceService.getWorkspaceIdsByOrgId(orgId); + @GetMapping("/list/orgworkspace/{userId}/{orgId}") + public List getWorkspaceListByOrgId(@PathVariable String userId, @PathVariable String orgId) { + return workspaceService.getWorkspaceListByOrgIdAndUserId(userId, orgId); } @PostMapping("/member/update") diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index c95ac2eca7..8429351dd1 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -467,7 +467,7 @@ public class UserService { if (StringUtils.equals("organization", sign)) { user.setLastOrganizationId(sourceId); - List workspaces = workspaceService.getWorkspaceListByOrgIdAndUserId(sourceId); + List workspaces = workspaceService.getWorkspaceListByOrgIdAndUserId(user.getId(), sourceId); if (workspaces.size() > 0) { user.setLastWorkspaceId(workspaces.get(0).getId()); List projects = getProjectListByWsAndUserId(workspaces.get(0).getId()); diff --git a/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/backend/src/main/java/io/metersphere/service/WorkspaceService.java index f6b91e8bfc..c4548592a6 100644 --- a/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -202,9 +202,8 @@ public class WorkspaceService { return workspaceMapper.selectByExample(workspaceExample); } - public List getWorkspaceListByOrgIdAndUserId(String orgId) { - String useId = SessionUtils.getUser().getId(); - List relatedSource = extUserGroupMapper.getRelatedSource(useId); + public List getWorkspaceListByOrgIdAndUserId(String userId, String orgId) { + List relatedSource = extUserGroupMapper.getRelatedSource(userId); List wsIds = relatedSource .stream() .filter(r -> StringUtils.equals(r.getOrganizationId(), orgId)) diff --git a/frontend/src/business/components/common/head/HeaderOrgWs.vue b/frontend/src/business/components/common/head/HeaderOrgWs.vue index 8a302dbbdd..5a745412a2 100644 --- a/frontend/src/business/components/common/head/HeaderOrgWs.vue +++ b/frontend/src/business/components/common/head/HeaderOrgWs.vue @@ -60,7 +60,6 @@ export default { name: "MsHeaderOrgWs", created() { this.initMenuData(); - this.getCurrentUserInfo(); }, inject: [ 'reloadTopMenus', @@ -73,7 +72,6 @@ export default { workspaceList: [ {name: this.$t('workspace.none')}, ], - currentUserInfo: {}, currentUserId: getCurrentUser().id, workspaceIds: [], currentOrganizationName: '', @@ -113,7 +111,7 @@ export default { this.currentOrganizationName = org[0].name; } this.organizationList.forEach(org => { - this.$get("/workspace/list/orgworkspace/" + org.id, response => { + this.$get("/workspace/list/orgworkspace/" + encodeURIComponent(this.currentUserId) + "/" + org.id, response => { let d = response.data; if (d.length === 0) { // org.workspaceList = [{name: this.$t('workspace.none')}]; @@ -147,11 +145,6 @@ export default { } });*/ }, - getCurrentUserInfo() { - this.$get("/user/info/" + encodeURIComponent(this.currentUserId), response => { - this.currentUserInfo = response.data; - }); - }, changeOrg(data) { let orgId = data.id; if (!orgId) {