fix: 测试跟踪部分权限问题

This commit is contained in:
chenjianxing 2021-05-26 22:39:19 +08:00 committed by BugKing
parent 4bf0bd7f7a
commit 6caf0e7347
15 changed files with 59 additions and 22 deletions

View File

@ -52,7 +52,7 @@
"vue-float-action-button": "^0.6.6", "vue-float-action-button": "^0.6.6",
"vue-i18n": "^8.15.3", "vue-i18n": "^8.15.3",
"vue-jsonpath-picker": "^1.1.5", "vue-jsonpath-picker": "^1.1.5",
"vue-minder-editor-plus": "^1.0.25", "vue-minder-editor-plus": "^1.0.26",
"vue-papa-parse": "^2.0.0", "vue-papa-parse": "^2.0.0",
"vue-pdf": "^4.2.0", "vue-pdf": "^4.2.0",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",

View File

@ -8,6 +8,9 @@
:tree-nodes="data" :tree-nodes="data"
:allLabel="$t('commons.all_module_title')" :allLabel="$t('commons.all_module_title')"
:type="isReadOnly ? 'view' : 'edit'" :type="isReadOnly ? 'view' : 'edit'"
:delete-permission="['PROJECT_API_SCENARIO:READ+DELETE']"
:add-permission="['PROJECT_API_SCENARIO:READ+CREATE']"
:update-permission="['PROJECT_API_SCENARIO:READ+EDIT']"
@add="add" @add="add"
@edit="edit" @edit="edit"
@drag="drag" @drag="drag"

View File

@ -13,6 +13,9 @@
@drag="drag" @drag="drag"
@remove="remove" @remove="remove"
@refresh="list" @refresh="list"
:delete-permission="['PROJECT_API_DEFINITION:READ+DELETE_API']"
:add-permission="['PROJECT_API_DEFINITION:READ+CREATE_API']"
:update-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']"
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
ref="nodeTree"> ref="nodeTree">

View File

@ -14,6 +14,7 @@
:default-mold="defaultMode" :default-mold="defaultMode"
@afterMount="$emit('afterMount')" @afterMount="$emit('afterMount')"
@moldChange="handleMoldChange" @moldChange="handleMoldChange"
:disabled="disabled"
@save="save" @save="save"
/> />
</div> </div>
@ -63,7 +64,8 @@ export default {
}, },
tagDisableCheck: Function, tagDisableCheck: Function,
tagEditCheck: Function, tagEditCheck: Function,
priorityDisableCheck: Function priorityDisableCheck: Function,
disabled: Boolean
}, },
data() { data() {
return { return {

View File

@ -7,11 +7,6 @@
<script> <script>
export default { export default {
name: "MsTableButton", name: "MsTableButton",
data() {
return {
disabled: false
}
},
props: { props: {
content: String, content: String,
icon: { icon: {
@ -33,7 +28,8 @@
isTesterPermission: { isTesterPermission: {
type: Boolean, type: Boolean,
default: false default: false
} },
disabled: Boolean
}, },
methods: { methods: {
exec() { exec() {

View File

@ -74,7 +74,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="add"> <el-tab-pane name="add">
<template v-slot:label> <template v-slot:label>
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand" v-permission="['PROJECT_TRACK_CASE:READ+CREATE']">
<el-button type="primary" plain icon="el-icon-plus" size="mini" /> <el-button type="primary" plain icon="el-icon-plus" size="mini" />
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="ADD" v-permission="['PROJECT_TRACK_CASE:READ+CREATE']"> <el-dropdown-item command="ADD" v-permission="['PROJECT_TRACK_CASE:READ+CREATE']">

View File

@ -6,7 +6,7 @@
</div> </div>
<el-dropdown-menu slot="dropdown" class="dropdown-menu-class"> <el-dropdown-menu slot="dropdown" class="dropdown-menu-class">
<div class="show-more-btn-title">{{$t('test_track.case.batch_handle', [size])}}</div> <div class="show-more-btn-title">{{$t('test_track.case.batch_handle', [size])}}</div>
<el-dropdown-item v-for="(btn,index) in buttons" v-permission="btn.permission ? btn.permission: []" :key="index" @click.native.stop="click(btn)"> <el-dropdown-item v-for="(btn,index) in buttons" :disabled="isDisable(btn)" :key="index" @click.native.stop="click(btn)">
{{btn.name}} {{btn.name}}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
@ -15,6 +15,8 @@
</template> </template>
<script> <script>
import {hasPermissions} from "@/common/js/utils";
export default { export default {
name: "ShowMoreBtn", name: "ShowMoreBtn",
props: { props: {
@ -36,6 +38,12 @@
if (btn.handleClick instanceof Function) { if (btn.handleClick instanceof Function) {
btn.handleClick(); btn.handleClick();
} }
},
isDisable(item) {
if (item.permission && item.permission.length > 0) {
return !hasPermissions(item.permission);
}
return true;
} }
} }
} }

View File

@ -12,6 +12,7 @@
:content="$t('commons.save')" :content="$t('commons.save')"
size="small" @click="saveCase" size="small" @click="saveCase"
icon="" icon=""
:disabled="readOnly"
title="ctrl + s"/> title="ctrl + s"/>
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand" <el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px"> @command="handleCommand" size="small" style="float: right;margin-right: 20px">
@ -123,7 +124,7 @@
import { import {
getCurrentUser, getCurrentUser,
getNodePath, getNodePath,
handleCtrlSEvent, handleCtrlSEvent, hasPermission,
listenGoBack, listenGoBack,
removeGoBackListener removeGoBackListener
} from "@/common/js/utils"; } from "@/common/js/utils";
@ -208,7 +209,6 @@
stepModel: 'STEP', stepModel: 'STEP',
customNum: '' customNum: ''
}, },
readOnly: false,
maintainerOptions: [], maintainerOptions: [],
testOptions: [], testOptions: [],
workspaceId: '', workspaceId: '',
@ -277,6 +277,9 @@
}, },
systemNameMap() { systemNameMap() {
return SYSTEM_FIELD_NAME_MAP; return SYSTEM_FIELD_NAME_MAP;
},
readOnly() {
return !hasPermission('PROJECT_TRACK_CASE:READ+EDIT');
} }
}, },
mounted() { mounted() {

View File

@ -275,7 +275,8 @@ export default {
handleClick: this.handleBatchEdit, handleClick: this.handleBatchEdit,
permissions: ['PROJECT_TRACK_CASE:READ+EDIT'] permissions: ['PROJECT_TRACK_CASE:READ+EDIT']
}, { }, {
name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove name: this.$t('test_track.case.batch_move_case'),
handleClick: this.handleBatchMove
}, { }, {
name: this.$t('test_track.case.batch_delete_case'), name: this.$t('test_track.case.batch_delete_case'),
handleClick: this.handleDeleteBatch, handleClick: this.handleDeleteBatch,

View File

@ -38,6 +38,7 @@
v-if="data.id !== 'root' && data.name !=='默认模块'" v-if="data.id !== 'root' && data.name !=='默认模块'"
class="item" class="item"
effect="dark" effect="dark"
v-permission="updatePermission"
:open-delay="200" :open-delay="200"
:content="$t('test_track.module.rename')" :content="$t('test_track.module.rename')"
placement="top"> placement="top">
@ -45,6 +46,7 @@
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip
v-if="data.name ==='默认模块' && data.level !==1" v-if="data.name ==='默认模块' && data.level !==1"
v-permission="updatePermission"
class="item" class="item"
effect="dark" effect="dark"
:open-delay="200" :open-delay="200"
@ -56,6 +58,7 @@
class="item" class="item"
effect="dark" effect="dark"
:open-delay="200" :open-delay="200"
v-permission="addPermission"
:content="$t('test_track.module.add_submodule')" :content="$t('test_track.module.add_submodule')"
placement="top"> placement="top">
<i @click.stop="append(node, data)" class="el-icon-circle-plus-outline"></i> <i @click.stop="append(node, data)" class="el-icon-circle-plus-outline"></i>
@ -65,6 +68,7 @@
v-if="data.name ==='默认模块' && data.level !==1" v-if="data.name ==='默认模块' && data.level !==1"
class="item" effect="dark" class="item" effect="dark"
:open-delay="200" :open-delay="200"
v-permission="deletePermission"
:content="$t('commons.delete')" :content="$t('commons.delete')"
placement="top"> placement="top">
<i @click.stop="remove(node, data)" class="el-icon-delete"></i> <i @click.stop="remove(node, data)" class="el-icon-delete"></i>
@ -75,6 +79,7 @@
class="item" effect="dark" class="item" effect="dark"
:open-delay="200" :open-delay="200"
:content="$t('commons.delete')" :content="$t('commons.delete')"
v-permission="deletePermission"
placement="top"> placement="top">
<i @click.stop="remove(node, data)" class="el-icon-delete"></i> <i @click.stop="remove(node, data)" class="el-icon-delete"></i>
</el-tooltip> </el-tooltip>
@ -99,7 +104,7 @@ export default {
children: "children", children: "children",
label: "label" label: "label"
}, },
extendTreeNodes: [] extendTreeNodes: [],
}; };
}, },
props: { props: {
@ -122,6 +127,9 @@ export default {
return 50; return 50;
} }
}, },
updatePermission: Array,
addPermission: Array,
deletePermission: Array
}, },
watch: { watch: {
treeNodes() { treeNodes() {

View File

@ -6,6 +6,9 @@
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:type="'edit'" :type="'edit'"
:name-limit="100" :name-limit="100"
:delete-permission="['PROJECT_TRACK_CASE:READ+DELETE']"
:add-permission="['PROJECT_TRACK_CASE:READ+CREATE']"
:update-permission="['PROJECT_TRACK_CASE:READ+EDIT']"
@add="add" @add="add"
@edit="edit" @edit="edit"
@drag="drag" @drag="drag"

View File

@ -9,6 +9,7 @@
:distinct-tags="tags" :distinct-tags="tags"
:tag-edit-check="tagEditCheck()" :tag-edit-check="tagEditCheck()"
:priority-disable-check="priorityDisableCheck()" :priority-disable-check="priorityDisableCheck()"
:disabled="disabled"
@save="save" @save="save"
ref="minder" ref="minder"
/> />
@ -21,7 +22,7 @@ import {
getTestCaseDataMap, getTestCaseDataMap,
parseCase, priorityDisableCheck, tagEditCheck, updateNode parseCase, priorityDisableCheck, tagEditCheck, updateNode
} from "@/business/components/track/common/minder/minderUtils"; } from "@/business/components/track/common/minder/minderUtils";
import {getNodePath} from "@/common/js/utils"; import {getNodePath, hasPermission} from "@/common/js/utils";
export default { export default {
name: "TestCaseMinder", name: "TestCaseMinder",
components: {MsModuleMinder}, components: {MsModuleMinder},
@ -52,6 +53,9 @@ name: "TestCaseMinder",
}, },
moduleOptions() { moduleOptions() {
return this.$store.state.testCaseModuleOptions; return this.$store.state.testCaseModuleOptions;
},
disabled() {
return !hasPermission('PROJECT_TRACK_CASE:READ+EDIT');
} }
}, },
watch: { watch: {

View File

@ -41,6 +41,9 @@
}, },
methods: { methods: {
setStatus(status) { setStatus(status) {
if (this.isReadOnly) {
return;
}
this.$emit('statusChange', status); this.$emit('statusChange', status);
} }
} }

View File

@ -249,6 +249,7 @@ import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import MsTestPlanScheduleMaintain from "@/business/components/track/plan/components/ScheduleMaintain"; import MsTestPlanScheduleMaintain from "@/business/components/track/plan/components/ScheduleMaintain";
import {hasPermission} from "@/common/js/utils";
export default { export default {
name: "TestPlanList", name: "TestPlanList",
@ -366,6 +367,9 @@ export default {
this.$emit('testPlanEdit', testPlan); this.$emit('testPlanEdit', testPlan);
}, },
statusChange(data) { statusChange(data) {
if (!hasPermission('PROJECT_TRACK_PLAN:READ+EDIT')) {
return;
}
let oldStatus = data.item.status; let oldStatus = data.item.status;
let newStatus = data.status; let newStatus = data.status;
let param = {}; let param = {};

View File

@ -122,7 +122,7 @@ import ApiTestDetail from "../test/ApiTestDetail";
import ApiTestResult from "../test/ApiTestResult"; import ApiTestResult from "../test/ApiTestResult";
import PerformanceTestDetail from "../test/PerformanceTestDetail"; import PerformanceTestDetail from "../test/PerformanceTestDetail";
import PerformanceTestResult from "../test/PerformanceTestResult"; import PerformanceTestResult from "../test/PerformanceTestResult";
import {getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {getUUID, hasPermission, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import CaseComment from "@/business/components/track/case/components/CaseComment"; import CaseComment from "@/business/components/track/case/components/CaseComment";
import MsPreviousNextButton from "../../../../../common/components/MsPreviousNextButton"; import MsPreviousNextButton from "../../../../../common/components/MsPreviousNextButton";
@ -185,7 +185,8 @@ export default {
testCaseTemplate: {}, testCaseTemplate: {},
formLabelWidth: "100px", formLabelWidth: "100px",
isCustomFiledActive: false, isCustomFiledActive: false,
otherInfoActive: true otherInfoActive: true,
isReadOnly: false
}; };
}, },
props: { props: {
@ -194,10 +195,6 @@ export default {
}, },
searchParam: { searchParam: {
type: Object type: Object
},
isReadOnly: {
type: Boolean,
default: false
} }
}, },
computed: { computed: {
@ -383,6 +380,8 @@ export default {
this.activeTab = 'detail'; this.activeTab = 'detail';
this.hasTapdId = false; this.hasTapdId = false;
this.hasZentaoId = false; this.hasZentaoId = false;
this.isReadOnly = !hasPermission('PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL');
listenGoBack(this.handleClose); listenGoBack(this.handleClose);
let initFuc = this.initData; let initFuc = this.initData;
getTemplate('field/template/case/get/relate/', this) getTemplate('field/template/case/get/relate/', this)