测试跟踪-只读用户

This commit is contained in:
chenjianxing 2020-05-22 19:56:09 +08:00
parent 21d7beb82f
commit f9ff75fe36
10 changed files with 21 additions and 34 deletions

View File

@ -54,7 +54,6 @@ public class ProjectController {
} }
@PostMapping("/list/{goPage}/{pageSize}") @PostMapping("/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.TEST_MANAGER)
public Pager<List<ProjectDTO>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ProjectRequest request) { public Pager<List<ProjectDTO>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ProjectRequest request) {
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);

View File

@ -27,7 +27,7 @@ public class UserRoleController {
} }
@GetMapping("/list/ws/{workspaceId}/{userId}") @GetMapping("/list/ws/{workspaceId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) { public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) {
return userRoleService.getWorkspaceMemberRoles(workspaceId, userId); return userRoleService.getWorkspaceMemberRoles(workspaceId, userId);
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<el-button @click="exec()" plain :type="type" :icon="icon" :size="size"> <el-button v-permission="['test_manager', 'test_user']" @click="exec()" plain :type="type" :icon="icon" :size="size">
{{content}} {{content}}
</el-button> </el-button>
</template> </template>

View File

@ -1,5 +1,6 @@
<template> <template>
<ms-tip-button @click="exec" <ms-tip-button v-permission="['test_manager', 'test_user']"
@click="exec"
@clickStop="clickStop" @clickStop="clickStop"
:type="type" :type="type"
:tip="tip" :tip="tip"

View File

@ -23,7 +23,7 @@
</el-menu-item> </el-menu-item>
</el-submenu> </el-submenu>
<el-submenu index="3" v-permission="['test_manager','test_user','test_viewer']" v-if="isCurrentWorkspaceUser"> <el-submenu index="3" v-permission="['test_manager']" v-if="isCurrentWorkspaceUser">
<template v-slot:title> <template v-slot:title>
<font-awesome-icon class="icon workspace" :icon="['far', 'list-alt']" size="lg"/> <font-awesome-icon class="icon workspace" :icon="['far', 'list-alt']" size="lg"/>
<span>{{$t('commons.workspace')}}</span> <span>{{$t('commons.workspace')}}</span>

View File

@ -14,7 +14,7 @@
@refresh="refresh" @refresh="refresh"
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:type="'edit'" :type="'edit'"
:draggable="true" :draggable="nodeTreeDraggable"
:select-node.sync="selectNode" :select-node.sync="selectNode"
@refreshTable="refreshTable" @refreshTable="refreshTable"
:current-project="currentProject" :current-project="currentProject"
@ -54,13 +54,14 @@
import NodeTree from '../common/NodeTree'; import NodeTree from '../common/NodeTree';
import TestCaseEdit from './components/TestCaseEdit'; import TestCaseEdit from './components/TestCaseEdit';
import {CURRENT_PROJECT} from '../../../../common/js/constants'; import {CURRENT_PROJECT, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
import TestCaseList from "./components/TestCaseList"; import TestCaseList from "./components/TestCaseList";
import SelectMenu from "../common/SelectMenu"; import SelectMenu from "../common/SelectMenu";
import TestCaseMove from "./components/TestCaseMove"; import TestCaseMove from "./components/TestCaseMove";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer"; import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {hasRoles} from "../../../../common/js/utils";
export default { export default {
name: "TestCase", name: "TestCase",
@ -81,6 +82,7 @@
selectParentNodes: [], selectParentNodes: [],
testCaseReadOnly: true, testCaseReadOnly: true,
selectNode: {}, selectNode: {},
nodeTreeDraggable: true,
} }
}, },
mounted() { mounted() {
@ -213,6 +215,9 @@
this.refresh(); this.refresh();
}, },
getNodeTree() { getNodeTree() {
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.nodeTreeDraggable = false;
}
if (this.currentProject) { if (this.currentProject) {
this.result = this.$get("/case/node/list/" + this.currentProject.id, response => { this.result = this.$get("/case/node/list/" + this.currentProject.id, response => {
this.treeNodes = response.data; this.treeNodes = response.data;

View File

@ -17,7 +17,6 @@
action="" action=""
:on-exceed="handleExceed" :on-exceed="handleExceed"
:beforeUpload="UploadValidate" :beforeUpload="UploadValidate"
:on-success="handleSuccess"
:on-error="handleError" :on-error="handleError"
:show-file-list="false" :show-file-list="false"
:http-request="upload" :http-request="upload"
@ -82,18 +81,6 @@
this.errList = []; this.errList = [];
return true; return true;
}, },
handleSuccess(response) {
// let res = response.data;
// if (res.success) {
// this.$success(this.$t('test_track.case.import.success'));
// this.dialogVisible = false;
// this.$emit("refresh");
// } else {
// this.errList = res.errList;
// }
// this.fileList = [];
},
handleError(err, file, fileList) { handleError(err, file, fileList) {
this.isLoading = false; this.isLoading = false;
this.$error(err.message); this.$error(err.message);
@ -106,8 +93,6 @@
this.dialogVisible = true; this.dialogVisible = true;
}, },
downloadTemplate() { downloadTemplate() {
// this.$get('/test/case/export/template');
// fileDownload('/test/case/export/template', {});
this.$fileDownload('/test/case/export/template'); this.$fileDownload('/test/case/export/template');
}, },
upload(file) { upload(file) {

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading"> <div v-loading="result.loading">
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small"> <el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small">
<template v-if="type == 'edit'" v-slot:append> <template v-if="type == 'edit'" v-slot:append>
<el-button icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button> <el-button v-permission="['test_manager', 'test_user']" icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button>
</template> </template>
</el-input> </el-input>
@ -24,7 +24,7 @@
<span class="node-title">{{node.label}}</span> <span class="node-title">{{node.label}}</span>
<span v-if="type == 'edit'" class="node-operate child"> <span v-if="type == 'edit'" class="node-operate child" v-permission="['test_manager', 'test_user']">
<el-tooltip <el-tooltip
class="item" class="item"
effect="dark" effect="dark"

View File

@ -8,18 +8,16 @@
<el-menu-item :index="'/track/home'"> <el-menu-item :index="'/track/home'">
{{ $t("i18n.home") }} {{ $t("i18n.home") }}
</el-menu-item> </el-menu-item>
<el-submenu v-if="isCurrentWorkspaceUser" index="3" popper-class="submenu">
<el-submenu v-if="isCurrentWorkspaceUser"
index="3" popper-class="submenu" v-permission="['test_manager']" >
<template v-slot:title>{{$t('commons.project')}}</template> <template v-slot:title>{{$t('commons.project')}}</template>
<ms-recent-list :options="projectRecent"/> <ms-recent-list :options="projectRecent"/>
<el-divider/> <el-divider/>
<ms-show-all :index="'/track/project/all'"/> <ms-show-all :index="'/track/project/all'"/>
<ms-create-button :index="'/track/project/create'" :title="$t('project.create')"/> <ms-create-button v-permission="['test_manager', 'test_user']" :index="'/track/project/create'" :title="$t('project.create')"/>
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser"
index="6" popper-class="submenu" v-permission="['test_manager', 'test_user']"> index="6" popper-class="submenu">
<template v-slot:title>{{$t('test_track.case.test_case')}}</template> <template v-slot:title>{{$t('test_track.case.test_case')}}</template>
<ms-recent-list :options="caseRecent"/> <ms-recent-list :options="caseRecent"/>
<el-divider/> <el-divider/>
@ -27,14 +25,13 @@
<el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item> <el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item>
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser" index="7" popper-class="submenu">
index="7" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']">
<template v-slot:title>{{$t('test_track.plan.test_plan')}}</template> <template v-slot:title>{{$t('test_track.plan.test_plan')}}</template>
<ms-recent-list :options="planRecent"/> <ms-recent-list :options="planRecent"/>
<el-divider/> <el-divider/>
<ms-show-all :index="'/track/plan/all'"/> <ms-show-all :index="'/track/plan/all'"/>
<el-menu-item :index="testPlanViewPath" class="blank_item"></el-menu-item> <el-menu-item :index="testPlanViewPath" class="blank_item"></el-menu-item>
<ms-create-button :index="'/track/plan/create'" :title="$t('test_track.plan.create_plan')"/> <ms-create-button v-permission="['test_manager', 'test_user']" :index="'/track/plan/create'" :title="$t('test_track.plan.create_plan')"/>
</el-submenu> </el-submenu>
</el-menu> </el-menu>
</el-col> </el-col>

View File

@ -19,8 +19,8 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12" class="head-right"> <el-col :span="12" class="head-right">
<el-button plain size="mini" @click="handleSave">{{$t('commons.save')}}</el-button> <el-button v-permission="['test_manager', 'test_user']" plain size="mini" @click="handleSave">{{$t('commons.save')}}</el-button>
<el-button plain size="mini" @click="handleEdit">{{$t('test_track.plan_view.edit_component')}}</el-button> <el-button v-permission="['test_manager', 'test_user']" plain size="mini" @click="handleEdit">{{$t('test_track.plan_view.edit_component')}}</el-button>
</el-col> </el-col>
</el-row> </el-row>