refactor(测试计划): 批量权限设置

This commit is contained in:
shiziyuan9527 2021-05-26 19:03:16 +08:00 committed by jianxing
parent 8a5f267910
commit 16e0e805f8
7 changed files with 41 additions and 11 deletions

View File

@ -406,6 +406,13 @@ INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
VALUES (uuid(), 'project_admin', 'PROJECT_ENVIRONMENT:READ', 'PROJECT_ENVIRONMENT');
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
VALUES (uuid(), 'project_admin', 'PROJECT_TRACK_CASE:READ+COPY', 'PROJECT_TRACK_CASE');
insert into user_group_permission (id, group_id, permission_id, module_id)
values (uuid(), 'project_admin', 'PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT', 'PROJECT_TRACK_PLAN');
insert into user_group_permission (id, group_id, permission_id, module_id)
values (uuid(), 'project_admin', 'PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN', 'PROJECT_TRACK_PLAN');
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
values (uuid(), 'project_admin', 'PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE','PROJECT_TRACK_PLAN');
-- 项目成员
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
@ -540,6 +547,12 @@ INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
VALUES (uuid(), 'project_member', 'PROJECT_API_SCENARIO:READ+RUN', 'PROJECT_API_SCENARIO');
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
VALUES (uuid(), 'project_member', 'PROJECT_TRACK_PLAN:READ', 'PROJECT_TRACK_PLAN');
insert into user_group_permission (id, group_id, permission_id, module_id)
values (uuid(), 'project_member', 'PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT', 'PROJECT_TRACK_PLAN');
insert into user_group_permission (id, group_id, permission_id, module_id)
values (uuid(), 'project_member', 'PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN', 'PROJECT_TRACK_PLAN');
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
values (uuid(), 'project_member', 'PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE','PROJECT_TRACK_PLAN');
-- 只读用户
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)

View File

@ -514,6 +514,21 @@
"name": "关联/取消关联用例",
"resourceId": "PROJECT_TRACK_PLAN"
},
{
"id": "PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE",
"name": "批量取消关联用例",
"resourceId": "PROJECT_TRACK_PLAN"
},
{
"id": "PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN",
"name": "批量执行用例",
"resourceId": "PROJECT_TRACK_PLAN"
},
{
"id": "PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT",
"name": "批量编辑用例",
"resourceId": "PROJECT_TRACK_PLAN"
},
{
"id": "PROJECT_API_DEFINITION:READ",
"name": "查询接口",

View File

@ -6,7 +6,7 @@
</div>
<el-dropdown-menu slot="dropdown" class="dropdown-menu-class">
<div class="show-more-btn-title">{{$t('test_track.case.batch_handle', [size])}}</div>
<el-dropdown-item v-for="(btn,index) in buttons" :key="index" @click.native.stop="click(btn)">
<el-dropdown-item v-for="(btn,index) in buttons" v-permission="btn.permission ? btn.permission: []" :key="index" @click.native.stop="click(btn)">
{{btn.name}}
</el-dropdown-item>
</el-dropdown-menu>

View File

@ -230,9 +230,9 @@ export default {
deletePath: "/test/case/delete",
selectRows: new Set(),
buttons: [
{name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch},
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute},
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit}
{name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']},
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']},
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']}
],
typeArr: [
{id: 'projectEnv', name: this.$t('api_test.definition.request.run_env')},

View File

@ -205,12 +205,14 @@ export default {
...API_SCENARIO_FILTERS,
buttons: [
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
},
{
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']
},
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit}
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
}
],
selectRows: new Set(),
typeArr: [

View File

@ -360,10 +360,10 @@ export default {
showMore: false,
buttons: [
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_EDIT']
},
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
}
],
typeArr: [

View File

@ -199,10 +199,10 @@ export default {
screenHeight: 'calc(100vh - 330px)',//
buttons: [
{
name: this.$t('test_track.plan.load_case.unlink_in_bulk'), handleClick: this.handleDeleteBatch
name: this.$t('test_track.plan.load_case.unlink_in_bulk'), handleClick: this.handleDeleteBatch, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_DELETE']
},
{
name: this.$t('test_track.plan.load_case.batch_exec_cases'), handleClick: this.handleRunBatch
name: this.$t('test_track.plan.load_case.batch_exec_cases'), handleClick: this.handleRunBatch, permission: ['PROJECT_TRACK_PLAN:READ+CASE_BATCH_RUN']
}
],
statusFilters: [