fix(系统设置): 超级管理员项目列表跳转权限问题

--bug=1022460 --user=李玉号 【系统设置】超级管理员权限的用户在系统设置 - 工作空间 -
项目管理列表,点击项目名称,提示没有权限 https://www.tapd.cn/55049933/s/1331705
This commit is contained in:
shiziyuan9527 2023-02-06 15:25:51 +08:00 committed by lyh
parent e5733db8c1
commit 30260b1817
2 changed files with 26 additions and 12 deletions

View File

@ -108,3 +108,7 @@ export function updateSeleniumServer(data) {
export function modifyUserByResourceId(resourceId) { export function modifyUserByResourceId(resourceId) {
return get(`/user/update/current-by-resource/${resourceId}`); return get(`/user/update/current-by-resource/${resourceId}`);
} }
export function isSuperUser(userId) {
return get(`/user/is/super/${userId}`);
}

View File

@ -195,6 +195,7 @@ import {PROJECT_CONFIGS} from "metersphere-frontend/src/components/search/search
import MsRolesTag from "metersphere-frontend/src/components/MsRolesTag"; import MsRolesTag from "metersphere-frontend/src/components/MsRolesTag";
import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon"; import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon";
import AddMember from "../../common/AddMember"; import AddMember from "../../common/AddMember";
import {isSuperUser} from "metersphere-frontend/src/api/user.js";
import { import {
addProjectMember, addProjectMember,
delProjectMember, delProjectMember,
@ -308,10 +309,20 @@ export default {
let {listObject} = res.data; let {listObject} = res.data;
this.memberLineData = listObject; this.memberLineData = listObject;
let arr = this.memberLineData.filter(item => item.id === getCurrentUserId()); let arr = this.memberLineData.filter(item => item.id === getCurrentUserId());
if (arr <= 0) { if (arr.length > 0) {
this.doJump(row);
} else {
isSuperUser(getCurrentUserId()).then(r => {
if (r && r.data) {
this.doJump(row);
} else {
this.$warning(this.$t("commons.project_permission")); this.$warning(this.$t("commons.project_permission"));
return;
} }
});
}
});
},
doJump(row) {
// last_project_id // last_project_id
sessionStorage.setItem(PROJECT_ID, row.id); sessionStorage.setItem(PROJECT_ID, row.id);
const loading = fullScreenLoading(this); const loading = fullScreenLoading(this);
@ -321,7 +332,6 @@ export default {
stopFullScreenLoading(loading); stopFullScreenLoading(loading);
}); });
}) })
});
}, },
getMaintainerOptions() { getMaintainerOptions() {
getCurrentProjectUserList().then(res => { getCurrentProjectUserList().then(res => {