fix(测试跟踪): 测试计划和评审查看跨项目的用例详情,报权限错误
--bug=1041793 --user=陈建星 【测试跟踪】测试计划/用例评审-关联其他项目的功能用例-测试计划内执行功能用例提示「当前用户没有操作此用例的权限」 https://www.tapd.cn/55049933/s/1604053
This commit is contained in:
parent
a0747c4be4
commit
72e553f1e2
|
@ -99,11 +99,11 @@ public class TestPlanTestCaseController {
|
||||||
return testPlanTestCaseService.listByNodes(request);
|
return testPlanTestCaseService.listByNodes(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{caseId}")
|
@GetMapping("/get/{id}")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ)
|
||||||
public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId) {
|
public TestPlanCaseDTO getTestPlanCases(@PathVariable String id) {
|
||||||
TestPlanCaseDTO testPlanCaseDTO = testPlanTestCaseService.get(caseId);
|
TestPlanCaseDTO testPlanCaseDTO = testPlanTestCaseService.get(id);
|
||||||
testPlanTestCaseService.checkPlanCaseOwner(testPlanCaseDTO.getCaseId(), SessionUtils.getUser(), SessionUtils.getUserId());
|
testPlanTestCaseService.checkPlanCaseOwner(testPlanCaseDTO.getPlanId(), SessionUtils.getUser());
|
||||||
return testPlanCaseDTO;
|
return testPlanCaseDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,10 +101,12 @@ public class TestReviewTestCaseController {
|
||||||
return testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
|
return testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{reviewId}")
|
@GetMapping("/get/{id}")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_REVIEW_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_REVIEW_READ)
|
||||||
public TestReviewCaseDTO get(@PathVariable String reviewId) {
|
public TestReviewCaseDTO get(@PathVariable String id) {
|
||||||
return testReviewTestCaseService.get(reviewId, SessionUtils.getUserId());
|
TestReviewCaseDTO testReviewCaseDTO = testReviewTestCaseService.get(id);
|
||||||
|
testReviewTestCaseService.checkReviewCaseOwner(testReviewCaseDTO.getReviewId(), SessionUtils.getUser());
|
||||||
|
return testReviewCaseDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/reviewer/status/{id}")
|
@GetMapping("/reviewer/status/{id}")
|
||||||
|
|
|
@ -674,7 +674,7 @@ public class TestPlanTestCaseService {
|
||||||
return updateIsDel(caseIds, false);
|
return updateIsDel(caseIds, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkPlanCaseOwner(String caseId, SessionUser sessionUser, String userId) {
|
public void checkPlanCaseOwner(String planId, SessionUser sessionUser) {
|
||||||
long count = sessionUser.getGroups()
|
long count = sessionUser.getGroups()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(g -> StringUtils.equals(g.getId(), UserGroupConstants.SUPER_GROUP))
|
.filter(g -> StringUtils.equals(g.getId(), UserGroupConstants.SUPER_GROUP))
|
||||||
|
@ -682,7 +682,7 @@ public class TestPlanTestCaseService {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case", userId, List.of(caseId));
|
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_plan", sessionUser.getId(), List.of(planId));
|
||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
MSException.throwException(Translator.get("check_owner_case"));
|
MSException.throwException(Translator.get("check_owner_case"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@ import io.metersphere.base.mapper.ext.ExtTestCaseReviewTestCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
|
||||||
import io.metersphere.commons.constants.TestCaseReviewStatus;
|
import io.metersphere.commons.constants.TestCaseReviewStatus;
|
||||||
import io.metersphere.commons.constants.TestPlanStatus;
|
import io.metersphere.commons.constants.TestPlanStatus;
|
||||||
|
import io.metersphere.commons.constants.UserGroupConstants;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.*;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.constants.TestCaseCommentType;
|
import io.metersphere.constants.TestCaseCommentType;
|
||||||
import io.metersphere.constants.TestCaseReviewCommentStatus;
|
import io.metersphere.constants.TestCaseReviewCommentStatus;
|
||||||
|
@ -469,9 +471,8 @@ public class TestReviewTestCaseService {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestReviewCaseDTO get(String testReviewTestCaseId, String currentUserId) {
|
public TestReviewCaseDTO get(String testReviewTestCaseId) {
|
||||||
TestReviewCaseDTO testReviewCaseDTO = extTestReviewCaseMapper.get(testReviewTestCaseId);
|
TestReviewCaseDTO testReviewCaseDTO = extTestReviewCaseMapper.get(testReviewTestCaseId);
|
||||||
checkReviewCaseOwner(testReviewCaseDTO.getCaseId(), currentUserId);
|
|
||||||
testReviewCaseDTO.setFields(testCaseService.getCustomFieldByCaseId(testReviewCaseDTO.getCaseId()));
|
testReviewCaseDTO.setFields(testCaseService.getCustomFieldByCaseId(testReviewCaseDTO.getCaseId()));
|
||||||
return testReviewCaseDTO;
|
return testReviewCaseDTO;
|
||||||
}
|
}
|
||||||
|
@ -891,8 +892,15 @@ public class TestReviewTestCaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkReviewCaseOwner(String caseId, String currentUserId) {
|
public void checkReviewCaseOwner(String reviewId, SessionUser sessionUser) {
|
||||||
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case", currentUserId, List.of(caseId));
|
long count = sessionUser.getGroups()
|
||||||
|
.stream()
|
||||||
|
.filter(g -> StringUtils.equals(g.getId(), UserGroupConstants.SUPER_GROUP))
|
||||||
|
.count();
|
||||||
|
if (count > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case_review", sessionUser.getId(), List.of(reviewId));
|
||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
MSException.throwException(Translator.get("check_owner_case"));
|
MSException.throwException(Translator.get("check_owner_case"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,11 +118,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: ['caseId', 'readOnly', 'versionEnable'],
|
props: ['caseId', 'readOnly', 'versionEnable'],
|
||||||
watch: {
|
|
||||||
caseId() {
|
|
||||||
this.initTable();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
handleCommand(key) {
|
handleCommand(key) {
|
||||||
if (!this.caseId) {
|
if (!this.caseId) {
|
||||||
|
|
Loading…
Reference in New Issue