fix(接口测试): 修复接口定义及接口自动化只读用户权限问题 (#6356)

Co-authored-by: BugKing <wangzhen@fit2cloud.com>
This commit is contained in:
metersphere-bot 2021-09-22 17:41:54 +08:00 committed by GitHub
parent 1b193a3589
commit 2bbb35f568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 15 deletions

View File

@ -8,7 +8,7 @@
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="path === '/api/automation/update'">{{ $t('operating_log.change_history') }}</el-link> <el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="path === '/api/automation/update'">{{ $t('operating_log.change_history') }}</el-link>
<el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario" <el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario"
title="ctrl + s"> title="ctrl + s" v-permission="['PROJECT_API_SCENARIO:READ+EDIT']">
{{ $t('commons.save') }} {{ $t('commons.save') }}
</el-button> </el-button>
</div> </div>

View File

@ -54,7 +54,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="1" v-if="!(isReadOnly || isCaseEdit)"> <el-col :span="1" v-if="!(isReadOnly || isCaseEdit)">
<el-button size="small" type="primary" @click="addCase">+{{ $t('api_test.definition.request.case') }} <el-button size="small" type="primary" @click="addCase" v-permission="['PROJECT_API_DEFINITION:READ+CREATE_CASE']">+{{ $t('api_test.definition.request.case') }}
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -24,7 +24,7 @@
<span @click.stop> <span @click.stop>
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/> <i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/>
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index" <el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
class="ms-api-header-select" style="width: 180px" class="ms-api-header-select" style="width: 180px" readonly="hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE')"
@blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/> @blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
<span v-else> <span v-else>
<el-tooltip :content="apiCase.id ? apiCase.name : ''" placement="top"> <el-tooltip :content="apiCase.id ? apiCase.name : ''" placement="top">
@ -82,7 +82,7 @@
<el-col :span="3"> <el-col :span="3">
<span @click.stop> <span @click.stop>
<ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play" <ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play" v-permission="['PROJECT_API_DEFINITION:READ+RUN']"
class="run-button" size="mini" :disabled="!apiCase.id" circle v-if="!loading"/> class="run-button" size="mini" :disabled="!apiCase.id" circle v-if="!loading"/>
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else> <el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
<el-button :disabled="!apiCase.id" @click.once="stop(apiCase)" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;" class="stop-btn" circle> <el-button :disabled="!apiCase.id" @click.once="stop(apiCase)" size="mini" style="color:white;padding: 0;width: 28px;height: 28px;" class="stop-btn" circle>
@ -91,9 +91,9 @@
</div> </div>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<ms-tip-button @click="copyCase(apiCase)" :tip="$t('commons.copy')" icon="el-icon-document-copy" <ms-tip-button @click="copyCase(apiCase)" :tip="$t('commons.copy')" icon="el-icon-document-copy" v-permission="['PROJECT_API_DEFINITION:READ+COPY_CASE']"
size="mini" :disabled="!apiCase.id || isCaseEdit" circle/> size="mini" :disabled="!apiCase.id || isCaseEdit" circle/>
<ms-tip-button @click="deleteCase(index,apiCase)" :tip="$t('commons.delete')" icon="el-icon-delete" <ms-tip-button @click="deleteCase(index,apiCase)" :tip="$t('commons.delete')" icon="el-icon-delete" v-permission="['PROJECT_API_SCENARIO:READ+DELETE_CASE']"
size="mini" :disabled="!apiCase.id || isCaseEdit" circle/> size="mini" :disabled="!apiCase.id || isCaseEdit" circle/>
<ms-api-extend-btns :is-case-edit="isCaseEdit" :environment="environment" :row="apiCase"/> <ms-api-extend-btns :is-case-edit="isCaseEdit" :environment="environment" :row="apiCase"/>
</span> </span>
@ -143,7 +143,8 @@
<ms-jmx-step :request="apiCase.request" :response="apiCase.responseData"/> <ms-jmx-step :request="apiCase.request" :response="apiCase.responseData"/>
<!-- 保存操作 --> <!-- 保存操作 -->
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" <el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)"
v-if="type!=='detail'"> v-if="type!=='detail'"
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
{{ $t('commons.save') }} {{ $t('commons.save') }}
</el-button> </el-button>
</div> </div>

View File

@ -8,7 +8,7 @@
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="httpForm.id"> <el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="httpForm.id">
{{ $t('operating_log.change_history') }} {{ $t('operating_log.change_history') }}
</el-link> </el-link>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button> <el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-permission="['PROJECT_API_DEFINITION:READ+EDIT_API']">{{ $t('commons.save') }}</el-button>
</div> </div>
<br/> <br/>
<p class="tip">{{ $t('test_track.plan_view.base_info') }} </p> <p class="tip">{{ $t('test_track.plan_view.base_info') }} </p>

View File

@ -275,13 +275,13 @@ export default {
buttons: [], buttons: [],
enableOrderDrag: true, enableOrderDrag: true,
simpleButtons: [ simpleButtons: [
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteToGcBatch}, {name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteToGcBatch, permissions: ['PROJECT_API_DEFINITION:READ+DELETE_CASE']},
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}, {name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch, permissions: ['PROJECT_API_DEFINITION:READ+EDIT_CASE']},
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleRunBatch}, {name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleRunBatch, permissions: ['PROJECT_API_DEFINITION:READ+RUN']},
], ],
trashButtons: [ trashButtons: [
{name: this.$t('commons.reduction'), handleClick: this.handleBatchRestore}, {name: this.$t('commons.reduction'), handleClick: this.handleBatchRestore, permissions: ['PROJECT_API_DEFINITION:READ+DELETE_CASE']},
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch}, {name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch, permissions: ['PROJECT_API_DEFINITION:READ+EDIT_CASE']},
], ],
operators: [], operators: [],
simpleOperators: [ simpleOperators: [

View File

@ -301,7 +301,7 @@ export default {
exec: this.handleTestCase, exec: this.handleTestCase,
isDivButton: true, isDivButton: true,
type: "primary", type: "primary",
permissions: ['PROJECT_API_DEFINITION:READ+CREATE_CASE'] permissions: ['PROJECT_API_DEFINITION:READ']
}, },
{ {
tip: this.$t('commons.delete'), tip: this.$t('commons.delete'),

View File

@ -5,7 +5,7 @@
</el-link> </el-link>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item> <el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
<el-dropdown-item command="create_performance">{{ $t('api_test.create_performance_test') }}</el-dropdown-item> <el-dropdown-item command="create_performance" v-permission="['PROJECT_API_DEFINITION:READ+CREATE_PERFORMANCE']">{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
<ms-reference-view ref="viewRef"/> <ms-reference-view ref="viewRef"/>
</el-dropdown> </el-dropdown>