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);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{caseId}")
|
||||
@GetMapping("/get/{id}")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ)
|
||||
public TestPlanCaseDTO getTestPlanCases(@PathVariable String caseId) {
|
||||
TestPlanCaseDTO testPlanCaseDTO = testPlanTestCaseService.get(caseId);
|
||||
testPlanTestCaseService.checkPlanCaseOwner(testPlanCaseDTO.getCaseId(), SessionUtils.getUser(), SessionUtils.getUserId());
|
||||
public TestPlanCaseDTO getTestPlanCases(@PathVariable String id) {
|
||||
TestPlanCaseDTO testPlanCaseDTO = testPlanTestCaseService.get(id);
|
||||
testPlanTestCaseService.checkPlanCaseOwner(testPlanCaseDTO.getPlanId(), SessionUtils.getUser());
|
||||
return testPlanCaseDTO;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,10 +101,12 @@ public class TestReviewTestCaseController {
|
|||
return testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{reviewId}")
|
||||
@GetMapping("/get/{id}")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_REVIEW_READ)
|
||||
public TestReviewCaseDTO get(@PathVariable String reviewId) {
|
||||
return testReviewTestCaseService.get(reviewId, SessionUtils.getUserId());
|
||||
public TestReviewCaseDTO get(@PathVariable String id) {
|
||||
TestReviewCaseDTO testReviewCaseDTO = testReviewTestCaseService.get(id);
|
||||
testReviewTestCaseService.checkReviewCaseOwner(testReviewCaseDTO.getReviewId(), SessionUtils.getUser());
|
||||
return testReviewCaseDTO;
|
||||
}
|
||||
|
||||
@GetMapping("/reviewer/status/{id}")
|
||||
|
|
|
@ -674,7 +674,7 @@ public class TestPlanTestCaseService {
|
|||
return updateIsDel(caseIds, false);
|
||||
}
|
||||
|
||||
public void checkPlanCaseOwner(String caseId, SessionUser sessionUser, String userId) {
|
||||
public void checkPlanCaseOwner(String planId, SessionUser sessionUser) {
|
||||
long count = sessionUser.getGroups()
|
||||
.stream()
|
||||
.filter(g -> StringUtils.equals(g.getId(), UserGroupConstants.SUPER_GROUP))
|
||||
|
@ -682,7 +682,7 @@ public class TestPlanTestCaseService {
|
|||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case", userId, List.of(caseId));
|
||||
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_plan", sessionUser.getId(), List.of(planId));
|
||||
if (!hasPermission) {
|
||||
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.commons.constants.TestCaseReviewStatus;
|
||||
import io.metersphere.commons.constants.TestPlanStatus;
|
||||
import io.metersphere.commons.constants.UserGroupConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.constants.TestCaseCommentType;
|
||||
import io.metersphere.constants.TestCaseReviewCommentStatus;
|
||||
|
@ -469,9 +471,8 @@ public class TestReviewTestCaseService {
|
|||
return comments;
|
||||
}
|
||||
|
||||
public TestReviewCaseDTO get(String testReviewTestCaseId, String currentUserId) {
|
||||
public TestReviewCaseDTO get(String testReviewTestCaseId) {
|
||||
TestReviewCaseDTO testReviewCaseDTO = extTestReviewCaseMapper.get(testReviewTestCaseId);
|
||||
checkReviewCaseOwner(testReviewCaseDTO.getCaseId(), currentUserId);
|
||||
testReviewCaseDTO.setFields(testCaseService.getCustomFieldByCaseId(testReviewCaseDTO.getCaseId()));
|
||||
return testReviewCaseDTO;
|
||||
}
|
||||
|
@ -891,8 +892,15 @@ public class TestReviewTestCaseService {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkReviewCaseOwner(String caseId, String currentUserId) {
|
||||
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case", currentUserId, List.of(caseId));
|
||||
public void checkReviewCaseOwner(String reviewId, SessionUser sessionUser) {
|
||||
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) {
|
||||
MSException.throwException(Translator.get("check_owner_case"));
|
||||
}
|
||||
|
|
|
@ -118,11 +118,6 @@ export default {
|
|||
}
|
||||
},
|
||||
props: ['caseId', 'readOnly', 'versionEnable'],
|
||||
watch: {
|
||||
caseId() {
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(key) {
|
||||
if (!this.caseId) {
|
||||
|
|
Loading…
Reference in New Issue