fix(测试跟踪): 用例编辑页版本相关权限
--bug=1027392 --user=陈建星 【测试跟踪】只读用户-功能用例开启查看权限-用例详情页-点击版本无反应 https://www.tapd.cn/55049933/s/1387112 --bug=1027389 --user=陈建星 【测试跟踪】项目成员未开启创建用例权限-功能用例页面-点击版本下拉-新建成功 https://www.tapd.cn/55049933/s/1387002
This commit is contained in:
parent
f180fbf884
commit
88fe1b6f5f
|
@ -26,6 +26,7 @@ import io.metersphere.service.TestCaseService;
|
||||||
import io.metersphere.service.wapper.CheckPermissionService;
|
import io.metersphere.service.wapper.CheckPermissionService;
|
||||||
import io.metersphere.xpack.track.dto.EditTestCaseRequest;
|
import io.metersphere.xpack.track.dto.EditTestCaseRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -245,7 +246,7 @@ public class TestCaseController {
|
||||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class)
|
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class)
|
||||||
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.getTestCase(#request.id)", targetClass = TestCaseService.class,
|
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.getTestCase(#request.id)", targetClass = TestCaseService.class,
|
||||||
event = NoticeConstants.Event.UPDATE, subject = "测试用例通知")
|
event = NoticeConstants.Event.UPDATE, subject = "测试用例通知")
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ_EDIT)
|
@RequiresPermissions(value = {PermissionConstants.PROJECT_TRACK_CASE_READ_EDIT, PermissionConstants.PROJECT_TRACK_CASE_READ_CREATE}, logical = Logical.OR)
|
||||||
public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request) {
|
public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request) {
|
||||||
return testCaseService.edit(request);
|
return testCaseService.edit(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
v-show="versionEnable"
|
v-show="versionEnable"
|
||||||
ref="versionHistory"
|
ref="versionHistory"
|
||||||
:current-id="currentTestCaseInfo.id"
|
:current-id="currentTestCaseInfo.id"
|
||||||
:is-read="readOnly"
|
:is-read="versionReadOnly"
|
||||||
:is-public-show="isPublicShow || hasReadonlyPermission"
|
:is-public-show="isPublicShow"
|
||||||
:current-version-id="form.versionId"
|
:current-version-id="form.versionId"
|
||||||
@confirmOtherInfo="confirmOtherInfo"
|
@confirmOtherInfo="confirmOtherInfo"
|
||||||
:current-project-id="projectId"
|
:current-project-id="projectId"
|
||||||
|
@ -632,6 +632,16 @@ export default {
|
||||||
!hasPermission("PROJECT_TRACK_CASE:READ+EDIT")
|
!hasPermission("PROJECT_TRACK_CASE:READ+EDIT")
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
versionReadOnly() {
|
||||||
|
if (this.isPublicShow || this.hasReadonlyPermission) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const { rowClickHasPermission } = this.currentTestCaseInfo;
|
||||||
|
if (rowClickHasPermission !== undefined) {
|
||||||
|
return !rowClickHasPermission;
|
||||||
|
}
|
||||||
|
return hasPermission('PROJECT_TRACK_CASE:READ');
|
||||||
|
},
|
||||||
caseId() {
|
caseId() {
|
||||||
return !this.isPublicShow ? this.$route.params.caseId : this.publicCaseId;
|
return !this.isPublicShow ? this.$route.params.caseId : this.publicCaseId;
|
||||||
},
|
},
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<div
|
<div
|
||||||
class="create opt-row"
|
class="create opt-row"
|
||||||
v-if="!caseVersionMap.has(item.id)
|
v-if="!caseVersionMap.has(item.id)
|
||||||
&& !isRead"
|
&& hasCreatePermission"
|
||||||
@click.stop="create(item)"
|
@click.stop="create(item)"
|
||||||
>
|
>
|
||||||
{{ $t("commons.create") }}
|
{{ $t("commons.create") }}
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
@click.stop="del(item)"
|
@click.stop="del(item)"
|
||||||
v-if="caseVersionMap.has(item.id)
|
v-if="caseVersionMap.has(item.id)
|
||||||
&& !(item.id === currentVersionId)
|
&& !(item.id === currentVersionId)
|
||||||
&& !isRead"
|
&& hasDeletePermission"
|
||||||
>
|
>
|
||||||
{{ $t("commons.delete") }}
|
{{ $t("commons.delete") }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -157,7 +157,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
||||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
import {hasLicense, hasPermission} from "metersphere-frontend/src/utils/permission";
|
||||||
import {
|
import {
|
||||||
getProjectMembers,
|
getProjectMembers,
|
||||||
getProjectVersions,
|
getProjectVersions,
|
||||||
|
@ -218,6 +218,15 @@ export default {
|
||||||
},
|
},
|
||||||
compareDisable() {
|
compareDisable() {
|
||||||
return !this.versionCompareOptions || this.versionCompareOptions.length < 2;
|
return !this.versionCompareOptions || this.versionCompareOptions.length < 2;
|
||||||
|
},
|
||||||
|
hasCreatePermission() {
|
||||||
|
return hasPermission("PROJECT_TRACK_CASE:READ+CREATE")
|
||||||
|
},
|
||||||
|
hasEditPermission() {
|
||||||
|
return hasPermission("PROJECT_TRACK_CASE:READ+EDIT")
|
||||||
|
},
|
||||||
|
hasDeletePermission() {
|
||||||
|
return hasPermission("PROJECT_TRACK_CASE:READ+DELETE");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -320,6 +329,7 @@ export default {
|
||||||
return hasVersionCase // 有当前版本的用例
|
return hasVersionCase // 有当前版本的用例
|
||||||
&& latestVersionCondition // 有最新版本的用例,则非最新版本的其他版本不显示置新
|
&& latestVersionCondition // 有最新版本的用例,则非最新版本的其他版本不显示置新
|
||||||
&& !this.isRead // 不是只读
|
&& !this.isRead // 不是只读
|
||||||
|
&& this.hasEditPermission
|
||||||
&& !isNotDataLatestVersionCase // 已经是最新版本,不显示置新
|
&& !isNotDataLatestVersionCase // 已经是最新版本,不显示置新
|
||||||
},
|
},
|
||||||
handleVersionOptions() {
|
handleVersionOptions() {
|
||||||
|
|
Loading…
Reference in New Issue