fix(项目设置): 根据权限判断操作日志是否可跳转
--bug=1018761 --user=李玉号 【系统设置】没有响应权限操作日志处一就可以进行跳转 https://www.tapd.cn/55049933/s/1283508
This commit is contained in:
parent
8c94e79ba3
commit
c6d6d97d6d
|
@ -131,7 +131,7 @@ import MsTablePagination from "metersphere-frontend/src/components/pagination/Ta
|
||||||
import MsTableOperator from "metersphere-frontend/src/components/MsTableOperator";
|
import MsTableOperator from "metersphere-frontend/src/components/MsTableOperator";
|
||||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||||
import {
|
import {
|
||||||
getUrl,
|
getPermissionUrl,
|
||||||
LOG_MODULE_MAP,
|
LOG_MODULE_MAP,
|
||||||
LOG_TYPE,
|
LOG_TYPE,
|
||||||
LOG_TYPE_MAP,
|
LOG_TYPE_MAP,
|
||||||
|
@ -144,7 +144,7 @@ import {getCurrentWsMembers} from "../../../api/user";
|
||||||
import {modifyUserByResourceId} from "metersphere-frontend/src/api/user";
|
import {modifyUserByResourceId} from "metersphere-frontend/src/api/user";
|
||||||
import {getOperatingLogPages} from "../../../api/log";
|
import {getOperatingLogPages} from "../../../api/log";
|
||||||
import {getProject} from "../../../api/project";
|
import {getProject} from "../../../api/project";
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense, hasPermissions} from "metersphere-frontend/src/utils/permission";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Log",
|
name: "Log",
|
||||||
|
@ -205,14 +205,24 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isLink(row) {
|
isLink(row) {
|
||||||
let uri = getUrl(row, this);
|
let res = getPermissionUrl(row, this);
|
||||||
|
let permissions = undefined;
|
||||||
|
let uri = "/#";
|
||||||
|
if (res && res instanceof Array) {
|
||||||
|
uri = res[0];
|
||||||
|
permissions = res[1];
|
||||||
|
}
|
||||||
if ((row.operType === 'UPDATE' || row.operType === 'CREATE' || row.operType === 'EXECUTE' || row.operType === 'DEBUG') && uri !== "/#") {
|
if ((row.operType === 'UPDATE' || row.operType === 'CREATE' || row.operType === 'EXECUTE' || row.operType === 'DEBUG') && uri !== "/#") {
|
||||||
|
if (permissions && permissions instanceof Array) {
|
||||||
|
return hasPermissions(...permissions);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
clickResource(resource) {
|
clickResource(resource) {
|
||||||
let uri = getUrl(resource, this);
|
let res = getPermissionUrl(resource, this);
|
||||||
|
let uri = res[0];
|
||||||
if (!resource.sourceId) {
|
if (!resource.sourceId) {
|
||||||
this.toPage(uri);
|
this.toPage(uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ export function PROJECTSYSLIST() {
|
||||||
return projectsysList;
|
return projectsysList;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUrl(d, _this) {
|
export function getPermissionUrl(d, _this) {
|
||||||
let url = "/#";
|
let url = "/#";
|
||||||
let resourceId = d.sourceId;
|
let resourceId = d.sourceId;
|
||||||
if (resourceId && (resourceId.startsWith("\"") || resourceId.startsWith("["))) {
|
if (resourceId && (resourceId.startsWith("\"") || resourceId.startsWith("["))) {
|
||||||
|
@ -248,132 +248,134 @@ export function getUrl(d, _this) {
|
||||||
if (resourceId.length === 1) {
|
if (resourceId.length === 1) {
|
||||||
resourceId = resourceId[0];
|
resourceId = resourceId[0];
|
||||||
} else {
|
} else {
|
||||||
return url;
|
return [url, []];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let moduleMap = LOG_MODULE_MAP(_this);
|
let moduleMap = LOG_MODULE_MAP(_this);
|
||||||
let module = moduleMap.get(d.operModule) ? moduleMap.get(d.operModule) : d.operModule;
|
let module = moduleMap.get(d.operModule) ? moduleMap.get(d.operModule) : d.operModule;
|
||||||
|
let res;
|
||||||
switch (module) {
|
switch (module) {
|
||||||
case "接口自动化" :
|
case "接口自动化" :
|
||||||
case "Api automation" :
|
case "Api automation" :
|
||||||
case"接口自動化":
|
case"接口自動化":
|
||||||
url += "/api/automation?resourceId=" + resourceId;
|
res = [url + "/api/automation?resourceId=" + resourceId, ["PROJECT_API_SCENARIO:READ"]];
|
||||||
break;
|
break;
|
||||||
case "测试计划" :
|
case "测试计划" :
|
||||||
case "測試計劃" :
|
case "測試計劃" :
|
||||||
case "Test plan":
|
case "Test plan":
|
||||||
url += "/track/plan/view/" + resourceId;
|
res = [url + "/track/plan/view/" + resourceId, ["PROJECT_TRACK_PLAN:READ"]];
|
||||||
break;
|
break;
|
||||||
case "用例评审" :
|
case "用例评审" :
|
||||||
case "Case review" :
|
case "Case review" :
|
||||||
case "用例評審":
|
case "用例評審":
|
||||||
url += "/track/review/view/" + resourceId;
|
res = [url + "/track/review/view/" + resourceId, ["PROJECT_TRACK_REVIEW:READ"]];
|
||||||
break;
|
break;
|
||||||
case "缺陷管理" :
|
case "缺陷管理" :
|
||||||
case "Defect management":
|
case "Defect management":
|
||||||
url += "/track/issue";
|
res = [url + "/track/issue/", ["PROJECT_TRACK_ISSUE:READ"]];
|
||||||
break;
|
break;
|
||||||
case "SWAGGER_TASK" :
|
case "SWAGGER_TASK" :
|
||||||
url += "/api/definition";
|
res = [url + "/api/definition", ["PROJECT_API_DEFINITION:READ"]];
|
||||||
break;
|
break;
|
||||||
case "接口定义" :
|
case "接口定义" :
|
||||||
case "接口定義" :
|
case "接口定義" :
|
||||||
case "Api definition":
|
case "Api definition":
|
||||||
url += "/api/definition?resourceId=" + resourceId;
|
res = [url + "/api/definition?resourceId=" + resourceId, ["PROJECT_API_DEFINITION:READ"]];
|
||||||
break;
|
break;
|
||||||
case "接口定义用例" :
|
case "接口定义用例" :
|
||||||
case "接口定義用例":
|
case "接口定義用例":
|
||||||
case "Api definition case":
|
case "Api definition case":
|
||||||
url += "/api/definition?caseId=" + resourceId;
|
res = [url + "/api/definition?caseId=" + resourceId, ["PROJECT_API_DEFINITION:READ"]];
|
||||||
break;
|
break;
|
||||||
case "测试报告" :
|
case "测试报告" :
|
||||||
case "測試報告" :
|
case "測試報告" :
|
||||||
case "Test Report":
|
case "Test Report":
|
||||||
url += "/api/automation/report";
|
res = [url + "/api/automation/report", ["PROJECT_API_REPORT:READ"]];
|
||||||
break;
|
break;
|
||||||
case "性能测试报告" :
|
case "性能测试报告" :
|
||||||
case "性能測試報告" :
|
case "性能測試報告" :
|
||||||
case "Performance test report" :
|
case "Performance test report" :
|
||||||
url += "/performance/report/all";
|
res = [url + "/performance/report/all", ["PROJECT_PERFORMANCE_REPORT:READ"]];
|
||||||
break;
|
break;
|
||||||
case "性能测试" :
|
case "性能测试" :
|
||||||
case "性能測試" :
|
case "性能測試" :
|
||||||
case "Performance test" :
|
case "Performance test" :
|
||||||
url += "/performance/test/edit/" + resourceId;
|
res = [url + "/performance/test/edit/" + resourceId, ["PROJECT_PERFORMANCE_TEST:READ+EDIT"]];
|
||||||
break;
|
break;
|
||||||
case "测试用例" :
|
case "测试用例" :
|
||||||
case "測試用例" :
|
case "測試用例" :
|
||||||
case "Test case":
|
case "Test case":
|
||||||
url += "/track/case/all?resourceId=" + resourceId;
|
res = [url + "/track/case/all?resourceId=" + resourceId, ["PROJECT_TRACK_CASE:READ+EDIT"]];
|
||||||
break;
|
break;
|
||||||
case "系统-用户":
|
case "系统-用户":
|
||||||
case "System user":
|
case "System user":
|
||||||
url += "/setting/user";
|
res = [url + "/setting/user", ["SYSTEM_USER:READ"]];
|
||||||
break;
|
break;
|
||||||
case "系统-组织" :
|
case "系统-组织" :
|
||||||
case "系統-組織" :
|
case "系統-組織" :
|
||||||
case "System organization":
|
case "System organization":
|
||||||
url += "/setting/organization";
|
res = [url + "/setting/organization", ["SYSTEM_ORGANIZATION:READ"]];
|
||||||
break;
|
break;
|
||||||
case "工作空间" :
|
case "工作空间" :
|
||||||
case "系统-工作空间" :
|
case "系统-工作空间" :
|
||||||
case "workspace" :
|
case "workspace" :
|
||||||
url += "/setting/systemworkspace";
|
res = [url + "/setting/systemworkspace", ["SYSTEM_WORKSPACE:READ"]];
|
||||||
break;
|
break;
|
||||||
case "用户组与权限" :
|
case "用户组与权限" :
|
||||||
case "用戶組與權限" :
|
case "用戶組與權限" :
|
||||||
case "Group" :
|
case "Group" :
|
||||||
url += "/setting/usergroup";
|
res = [url + "/setting/usergroup", ["SYSTEM_GROUP:READ"]];
|
||||||
break;
|
break;
|
||||||
case "系统-测试资源池":
|
case "系统-测试资源池":
|
||||||
case "系统-測試資源池" :
|
case "系统-測試資源池" :
|
||||||
case "System test resource" :
|
case "System test resource" :
|
||||||
url += "/setting/testresourcepool";
|
res = [url + "/setting/testresourcepool", ["SYSTEM_TEST_POOL:READ"]];
|
||||||
break;
|
break;
|
||||||
case "系统-系统参数设置":
|
case "系统-系统参数设置":
|
||||||
case "系统-系統參數設置" :
|
case "系统-系統參數設置" :
|
||||||
case "System parameter setting" :
|
case "System parameter setting" :
|
||||||
url += "/setting/systemparametersetting";
|
res = [url + "/setting/systemparametersetting", ["SYSTEM_SETTING:READ"]];
|
||||||
break;
|
break;
|
||||||
case "工作空间-成员" :
|
case "工作空间-成员" :
|
||||||
case "工作空間-成員" :
|
case "工作空間-成員" :
|
||||||
case "Workspace member" :
|
case "Workspace member" :
|
||||||
url += "/setting/member";
|
res = [url + "/setting/member", ["WORKSPACE_USER:READ"]];
|
||||||
break;
|
break;
|
||||||
case "项目-项目管理" :
|
case "项目-项目管理" :
|
||||||
case "項目-項目管理" :
|
case "項目-項目管理" :
|
||||||
case "Project project manager" :
|
case "Project project manager" :
|
||||||
url += "/setting/project/:type";
|
res = [url + "/setting/project/:type", ["WORKSPACE_PROJECT_MANAGER:READ"]];
|
||||||
break;
|
break;
|
||||||
case "项目-环境设置" :
|
case "项目-环境设置" :
|
||||||
case "項目-環境設置" :
|
case "項目-環境設置" :
|
||||||
case "Project environment setting" :
|
case "Project environment setting" :
|
||||||
url += "/project/env";
|
res = [url + "/project/env", ["WORKSPACE_PROJECT_ENVIRONMENT:READ"]];
|
||||||
break;
|
break;
|
||||||
case "项目-模版设置-自定义字段" :
|
case "项目-模版设置-自定义字段" :
|
||||||
case "項目-模版設置-自定義字段" :
|
case "項目-模版設置-自定義字段" :
|
||||||
case "Project template settings field" :
|
case "Project template settings field" :
|
||||||
url += "/project/template";
|
res = [url + "/project/template", ["PROJECT_TEMPLATE:READ"]];
|
||||||
break;
|
break;
|
||||||
case "项目-模版设置-用例模版" :
|
case "项目-模版设置-用例模版" :
|
||||||
case "項目-模版設置-用例模板" :
|
case "項目-模版設置-用例模板" :
|
||||||
case "Project template settings case" :
|
case "Project template settings case" :
|
||||||
url += "/project/template";
|
res = [url + "/project/template", ["PROJECT_TEMPLATE:READ"]];
|
||||||
break;
|
break;
|
||||||
case "项目-模版设置-缺陷模版" :
|
case "项目-模版设置-缺陷模版" :
|
||||||
case "項目-模版設置-缺陷模板" :
|
case "項目-模版設置-缺陷模板" :
|
||||||
case "Project template settings issue" :
|
case "Project template settings issue" :
|
||||||
url += "/project/template";
|
res = [url + "/project/template", ["PROJECT_TEMPLATE:READ"]];
|
||||||
break;
|
break;
|
||||||
case "项目-成员":
|
case "项目-成员":
|
||||||
case "項目-成員" :
|
case "項目-成員" :
|
||||||
case "Project member" :
|
case "Project member" :
|
||||||
url += "/project/member";
|
res = [url + "/project/member", ["PROJECT_USER:READ"]];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
res = [url, []];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return url;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue