fix(测试跟踪): 分享测试计划报告后页面报错401
This commit is contained in:
parent
258f46cd11
commit
3f8060fc20
|
@ -2,6 +2,7 @@ package io.metersphere.controller;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.metersphere.commons.utils.HttpHeaderUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.TestPlanCaseDTO;
|
||||
import io.metersphere.plan.dto.TestPlanExtReportDTO;
|
||||
import io.metersphere.plan.dto.TestPlanSimpleReportDTO;
|
||||
|
@ -68,7 +69,9 @@ public class ShareController {
|
|||
@GetMapping("test/plan/ext/report/{shareId}/{reportId}")
|
||||
public TestPlanExtReportDTO getExtReport(@PathVariable String shareId, @PathVariable String reportId) throws JsonProcessingException {
|
||||
shareInfoService.validate(shareId, reportId);
|
||||
HttpHeaderUtils.runAsUser("admin");
|
||||
if (SessionUtils.getUser() == null) {
|
||||
HttpHeaderUtils.runAsUser("admin");
|
||||
}
|
||||
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByReportId(reportId);
|
||||
HttpHeaderUtils.clearUser();
|
||||
return reportExtInfo;
|
||||
|
@ -77,7 +80,9 @@ public class ShareController {
|
|||
@GetMapping("test/plan/ext/plan/{shareId}/{planId}")
|
||||
public TestPlanExtReportDTO getExtPlan(@PathVariable String shareId, @PathVariable String planId) throws JsonProcessingException {
|
||||
shareInfoService.validate(shareId, planId);
|
||||
HttpHeaderUtils.runAsUser("admin");
|
||||
if (SessionUtils.getUser() == null) {
|
||||
HttpHeaderUtils.runAsUser("admin");
|
||||
}
|
||||
TestPlanExtReportDTO reportExtInfo = testPlanService.getExtInfoByPlanId(planId);
|
||||
HttpHeaderUtils.clearUser();
|
||||
return reportExtInfo;
|
||||
|
|
|
@ -742,7 +742,9 @@ public class TestPlanReportService {
|
|||
runRequest.setReportId(testPlanExecutionQueue.getReportId());
|
||||
runRequest.setTestPlanId(testPlan.getId());
|
||||
try {
|
||||
HttpHeaderUtils.runAsUser("admin");
|
||||
if (SessionUtils.getUser() == null) {
|
||||
HttpHeaderUtils.runAsUser("admin");
|
||||
}
|
||||
//如果运行测试计划的过程中出现异常,则整个事务会回滚。 删除队列的事务也不会提交,也不会执行后面的测试计划
|
||||
testPlanService.runPlan(runRequest);
|
||||
} catch (Exception e) {
|
||||
|
@ -1125,7 +1127,9 @@ public class TestPlanReportService {
|
|||
}
|
||||
|
||||
public TestPlanSimpleReportDTO getShareDbReport(ShareInfo shareInfo, String reportId) {
|
||||
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
||||
if (SessionUtils.getUser() == null) {
|
||||
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
||||
}
|
||||
try {
|
||||
return getReport(reportId);
|
||||
} finally {
|
||||
|
|
|
@ -1482,7 +1482,9 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
public TestPlanSimpleReportDTO getShareReport(ShareInfo shareInfo, String planId) {
|
||||
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
||||
if (SessionUtils.getUser() == null) {
|
||||
HttpHeaderUtils.runAsUser(shareInfo.getCreateUserId());
|
||||
}
|
||||
try {
|
||||
return getReport(planId, null);
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue