fix: 修复评审的发起人不能关联用例的问题

This commit is contained in:
shiziyuan9527 2020-10-22 17:21:52 +08:00
parent badbe8eda0
commit 6e4a8f1ab4
2 changed files with 16 additions and 4 deletions

View File

@ -360,9 +360,16 @@ public class TestCaseReviewService {
public void testReviewRelevance(ReviewRelevanceRequest request) {
String reviewId = request.getReviewId();
List<String> userIds = getTestCaseReviewerIds(reviewId);
String creator = "";
TestCaseReview review = testCaseReviewMapper.selectByPrimaryKey(reviewId);
if (review != null) {
creator = review.getCreator();
}
String currentId = SessionUtils.getUser().getId();
if (!userIds.contains(currentId)) {
MSException.throwException("非用例评审人员,不能关联用例!");
if (!userIds.contains(currentId) && !StringUtils.equals(creator, currentId)) {
MSException.throwException("没有权限,不能关联用例!");
}
List<String> testCaseIds = request.getTestCaseIds();

View File

@ -87,8 +87,13 @@ public class TestReviewTestCaseService {
private void checkReviewer(String reviewId) {
List<String> userIds = testCaseReviewService.getTestCaseReviewerIds(reviewId);
String currentId = SessionUtils.getUser().getId();
if (!userIds.contains(currentId)) {
MSException.throwException("非用例评审人员,不能解除用例关联!");
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
String creator = "";
if (caseReview != null) {
creator = caseReview.getCreator();
}
if (!userIds.contains(currentId) && !StringUtils.equals(creator, currentId)) {
MSException.throwException("没有权限,不能解除用例关联!");
}
}