refactor: 切换工作空间权限修改
This commit is contained in:
parent
7ad79057ac
commit
61be97d3c5
|
@ -92,15 +92,9 @@ public class WorkspaceController {
|
|||
return workspaceService.getWorkspaceListByUserId(userId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/orgworkspace/")
|
||||
public List<Workspace> getWorkspaceListByOrgIdAndUserId() {
|
||||
String currentOrganizationId = SessionUtils.getCurrentOrganizationId();
|
||||
return workspaceService.getWorkspaceListByOrgIdAndUserId(currentOrganizationId);
|
||||
}
|
||||
|
||||
@GetMapping("/list/orgworkspace/{orgId}")
|
||||
public List<WorkspaceDTO> getWorkspaceListByOrgId(@PathVariable String orgId) {
|
||||
return workspaceService.getWorkspaceIdsByOrgId(orgId);
|
||||
@GetMapping("/list/orgworkspace/{userId}/{orgId}")
|
||||
public List<Workspace> getWorkspaceListByOrgId(@PathVariable String userId, @PathVariable String orgId) {
|
||||
return workspaceService.getWorkspaceListByOrgIdAndUserId(userId, orgId);
|
||||
}
|
||||
|
||||
@PostMapping("/member/update")
|
||||
|
|
|
@ -467,7 +467,7 @@ public class UserService {
|
|||
|
||||
if (StringUtils.equals("organization", sign)) {
|
||||
user.setLastOrganizationId(sourceId);
|
||||
List<Workspace> workspaces = workspaceService.getWorkspaceListByOrgIdAndUserId(sourceId);
|
||||
List<Workspace> workspaces = workspaceService.getWorkspaceListByOrgIdAndUserId(user.getId(), sourceId);
|
||||
if (workspaces.size() > 0) {
|
||||
user.setLastWorkspaceId(workspaces.get(0).getId());
|
||||
List<Project> projects = getProjectListByWsAndUserId(workspaces.get(0).getId());
|
||||
|
|
|
@ -202,9 +202,8 @@ public class WorkspaceService {
|
|||
return workspaceMapper.selectByExample(workspaceExample);
|
||||
}
|
||||
|
||||
public List<Workspace> getWorkspaceListByOrgIdAndUserId(String orgId) {
|
||||
String useId = SessionUtils.getUser().getId();
|
||||
List<RelatedSource> relatedSource = extUserGroupMapper.getRelatedSource(useId);
|
||||
public List<Workspace> getWorkspaceListByOrgIdAndUserId(String userId, String orgId) {
|
||||
List<RelatedSource> relatedSource = extUserGroupMapper.getRelatedSource(userId);
|
||||
List<String> wsIds = relatedSource
|
||||
.stream()
|
||||
.filter(r -> StringUtils.equals(r.getOrganizationId(), orgId))
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue