refactor(权限管理): 权限设置
This commit is contained in:
parent
db96d93cf4
commit
855cb8affb
|
@ -22,9 +22,6 @@
|
|||
ON user_group.user_id = `user`.id
|
||||
WHERE user_group.source_id in
|
||||
(
|
||||
SELECT id FROM workspace w
|
||||
WHERE w.organization_id = #{orgMember.organizationId}
|
||||
UNION
|
||||
SELECT #{orgMember.organizationId} AS id FROM dual
|
||||
)
|
||||
<if test="orgMember.name != null">
|
||||
|
|
|
@ -72,6 +72,13 @@ public class PermissionConstants {
|
|||
public static final String WORKSPACE_PROJECT_MANAGER_READ_CREATE = "WORKSPACE_PROJECT_MANAGER:READ+CREATE";
|
||||
public static final String WORKSPACE_PROJECT_MANAGER_READ_EDIT = "WORKSPACE_PROJECT_MANAGER:READ+EDIT";
|
||||
public static final String WORKSPACE_PROJECT_MANAGER_READ_DELETE = "WORKSPACE_PROJECT_MANAGER:READ+DELETE";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ = "WORKSPACE_PROJECT_ENVIRONMENT:READ";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_CREATE = "WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_EDIT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_DELETE = "WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_COPY = "WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_IMPORT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+IMPORT";
|
||||
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_EXPORT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+EXPORT";
|
||||
|
||||
|
||||
public static final String PROJECT_USER_READ = "PROJECT_USER:READ";
|
||||
|
|
|
@ -485,7 +485,7 @@ public class UserService {
|
|||
Workspace workspace = workspaceMapper.selectByPrimaryKey(sourceId);
|
||||
user.setLastOrganizationId(workspace.getOrganizationId());
|
||||
user.setLastWorkspaceId(sourceId);
|
||||
getProjectListByWsAndUserId(sourceId)
|
||||
List<Project> projects = getProjectListByWsAndUserId(sourceId);
|
||||
if (projects.size() > 0) {
|
||||
user.setLastProjectId(projects.get(0).getId());
|
||||
} else {
|
||||
|
|
|
@ -235,11 +235,26 @@ VALUES (uuid(), 'ws_admin', 'WORKSPACE_TEMPLATE:READ+CASE_TEMPLATE', 'WORKSPACE_
|
|||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_MANAGER:READ', 'WORKSPACE_PROJECT_MANAGER');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_MANAGER:READ+CREATE','WORKSPACE_PROJECT_MANAGER');
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_MANAGER:READ+CREATE', 'WORKSPACE_PROJECT_MANAGER');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_MANAGER:READ+DELETE', 'WORKSPACE_PROJECT_MANAGER');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_MANAGER:READ+EDIT', 'WORKSPACE_PROJECT_MANAGER');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ+IMPORT','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ+EXPORT','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
insert into metersphere_dev.user_group_permission (id, group_id, permission_id, module_id)
|
||||
values (uuid(), 'ws_admin', 'WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE','WORKSPACE_PROJECT_ENVIRONMENT');
|
||||
|
||||
|
||||
-- 工作空间成员
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
|
@ -375,8 +390,6 @@ VALUES (uuid(), 'project_admin', 'PROJECT_API_REPORT:READ+DELETE', 'PROJECT_API_
|
|||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_admin', 'PROJECT_PERFORMANCE_REPORT:READ', 'PROJECT_PERFORMANCE_REPORT');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_admin', 'PROJECT_ENVIRONMENT:READ+DELETE', 'PROJECT_ENVIRONMENT');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_admin', 'PROJECT_TRACK_CASE:READ+EDIT', 'PROJECT_TRACK_CASE');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_admin', 'PROJECT_API_DEFINITION:READ+CREATE_PERFORMANCE', 'PROJECT_API_DEFINITION');
|
||||
|
@ -387,8 +400,6 @@ VALUES (uuid(), 'project_admin', 'PROJECT_API_SCENARIO:READ+COPY', 'PROJECT_API_
|
|||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_admin', 'PROJECT_API_DEFINITION:READ+RUN', 'PROJECT_API_DEFINITION');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_admin', 'PROJECT_ENVIRONMENT:READ+CREATE', 'PROJECT_ENVIRONMENT');
|
||||
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');
|
||||
|
@ -421,8 +432,6 @@ VALUES (uuid(), 'project_member', 'PROJECT_TRACK_REVIEW:READ+DELETE', 'PROJECT_T
|
|||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_API_SCENARIO:READ+IMPORT_SCENARIO', 'PROJECT_API_SCENARIO');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_ENVIRONMENT:READ+DELETE', 'PROJECT_ENVIRONMENT');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_TRACK_PLAN:READ+DELETE', 'PROJECT_TRACK_PLAN');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_TRACK_CASE:READ+DELETE', 'PROJECT_TRACK_CASE');
|
||||
|
@ -527,8 +536,6 @@ VALUES (uuid(), 'project_member', 'PROJECT_API_DEFINITION:READ+EDIT_CASE', 'PROJ
|
|||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_API_DEFINITION:READ', 'PROJECT_API_DEFINITION');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_ENVIRONMENT:READ+CREATE', 'PROJECT_ENVIRONMENT');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_API_SCENARIO:READ', 'PROJECT_API_SCENARIO');
|
||||
INSERT INTO user_group_permission (id, group_id, permission_id, module_id)
|
||||
VALUES (uuid(), 'project_member', 'PROJECT_API_SCENARIO:READ+RUN', 'PROJECT_API_SCENARIO');
|
|
@ -277,7 +277,37 @@
|
|||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ",
|
||||
"name": "查询环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_MANAGER"
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE",
|
||||
"name": "创建环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT",
|
||||
"name": "编辑环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE",
|
||||
"name": "删除环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY",
|
||||
"name": "复制环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ+IMPORT",
|
||||
"name": "导入环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_PROJECT_ENVIRONMENT:READ+EXPORT",
|
||||
"name": "导出环境",
|
||||
"resourceId": "WORKSPACE_PROJECT_ENVIRONMENT"
|
||||
},
|
||||
{
|
||||
"id": "WORKSPACE_TEMPLATE:READ",
|
||||
|
@ -329,21 +359,21 @@
|
|||
"name": "查询项目",
|
||||
"resourceId": "PROJECT_MANAGER"
|
||||
},
|
||||
{
|
||||
"id": "PROJECT_MANAGER:READ+CREATE",
|
||||
"name": "创建项目",
|
||||
"resourceId": "PROJECT_MANAGER"
|
||||
},
|
||||
// {
|
||||
// "id": "PROJECT_MANAGER:READ+CREATE",
|
||||
// "name": "创建项目",
|
||||
// "resourceId": "PROJECT_MANAGER"
|
||||
// },
|
||||
{
|
||||
"id": "PROJECT_MANAGER:READ+EDIT",
|
||||
"name": "编辑项目",
|
||||
"resourceId": "PROJECT_MANAGER"
|
||||
},
|
||||
{
|
||||
"id": "PROJECT_MANAGER:READ+DELETE",
|
||||
"name": "删除项目",
|
||||
"resourceId": "PROJECT_MANAGER"
|
||||
},
|
||||
// {
|
||||
// "id": "PROJECT_MANAGER:READ+DELETE",
|
||||
// "name": "删除项目",
|
||||
// "resourceId": "PROJECT_MANAGER"
|
||||
// },
|
||||
{
|
||||
"id": "PROJECT_ENVIRONMENT:READ",
|
||||
"name": "查询环境",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<span>
|
||||
<slot name="front"></slot>
|
||||
<ms-table-operator-button v-permission="editPermission" :isTesterPermission="isTesterPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
|
||||
<ms-table-operator-button v-permission="editPermission" :tip="tip1" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
|
||||
<slot name="middle"></slot>
|
||||
<ms-table-operator-button v-permission="deletePermission" :isTesterPermission="isTesterPermission" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
|
||||
<ms-table-operator-button v-permission="deletePermission" v-if="showDelete" :tip="tip2" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
|
||||
<slot name="behind"></slot>
|
||||
</span>
|
||||
|
||||
|
@ -42,6 +42,12 @@
|
|||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
showDelete: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -108,12 +108,12 @@
|
|||
<el-input v-model="form.phone" autocomplete="off" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户组" prop="groupIds"
|
||||
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||
:rules="{required: true, message: '请选择用户组', trigger: 'change'}">
|
||||
<el-select v-model="form.groupIds" multiple placeholder="请选择用户组" class="select-width">
|
||||
<el-option
|
||||
v-for="item in form.allgroups"
|
||||
:key="item.id"
|
||||
:label="$t('role.' + item.id)"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
</ms-table-header>
|
||||
</template>
|
||||
<!-- 环境列表内容 -->
|
||||
<el-table border :data="environments" @filter-change="filter"
|
||||
<el-table border :data="environments"
|
||||
@selection-change="handleSelectionChange" class="adjust-table" style="width: 100%" ref="table"
|
||||
:height="screenHeight"
|
||||
>
|
||||
<el-table-column type="selection"></el-table-column>
|
||||
<el-table-column :label="$t('commons.project')" width="250" :filters="projectFilters" column-key="projectId"
|
||||
<el-table-column :label="$t('commons.project')" width="250" column-key="projectId"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot="scope">
|
||||
<span>{{ idNameMap.get(scope.row.projectId) }}</span>
|
||||
|
@ -110,7 +110,7 @@
|
|||
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
|
||||
import ProjectSwitch from "@/business/components/common/head/ProjectSwitch";
|
||||
import SearchList from "@/business/components/common/head/SearchList";
|
||||
import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils";
|
||||
import {checkoutTestManagerOrTestUser, downloadFile, getCurrentProjectID} from "@/common/js/utils";
|
||||
import EnvironmentImport from "@/business/components/settings/project/EnvironmentImport";
|
||||
|
||||
export default {
|
||||
|
@ -212,6 +212,7 @@
|
|||
if (!this.projectList || this.projectList.length === 0) { //没有项目数据的话请求项目数据
|
||||
this.$get("/project/listAll", (response) => {
|
||||
this.projectList = response.data; //获取当前工作空间所拥有的项目,
|
||||
this.projectList = this.projectList.filter(project => project.id === getCurrentProjectID());
|
||||
this.projectList.forEach(project => {
|
||||
this.idNameMap.set(project.id, project.name);
|
||||
this.projectIds.push(project.id);
|
||||
|
@ -297,9 +298,9 @@
|
|||
},
|
||||
|
||||
//筛选指定项目下的环境
|
||||
filter(filters) {
|
||||
this.getEnvironments(filters.projectId)
|
||||
},
|
||||
// filter(filters) {
|
||||
// this.getEnvironments(filters.projectId)
|
||||
// },
|
||||
|
||||
//对话框取消按钮
|
||||
close() {
|
||||
|
|
|
@ -81,6 +81,7 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
|
|||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||
import EditMember from "@/business/components/settings/project/EditMember";
|
||||
import {GROUP_PROJECT, GROUP_WORKSPACE} from "@/common/js/constants";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "Member",
|
||||
|
@ -110,7 +111,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId;
|
||||
return getCurrentProjectID();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
:edit-permission="['PROJECT_MANAGER:READ+EDIT']"
|
||||
:delete-permission="['PROJECT_MANAGER:READ+DELETE']"
|
||||
@editClick="edit(scope.row)"
|
||||
:show-delete="false"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:behind>
|
||||
<ms-table-operator-button
|
||||
|
|
|
@ -121,7 +121,7 @@ export default {
|
|||
{
|
||||
path: 'wsenvlist',
|
||||
component: () => import('@/business/components/settings/workspace/WsEnvironmentList'),
|
||||
meta: {workspace: true, title: 'api_test.environment.environment_config', permissions: ['PROJECT_ENVIRONMENT:READ']}
|
||||
meta: {workspace: true, title: 'api_test.environment.environment_config', permissions: ['WORKSPACE_PROJECT_ENVIRONMENT:READ']}
|
||||
},
|
||||
{
|
||||
path: 'envlist',
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
<el-card class="table-card" v-loading="result.loading">
|
||||
<!-- 表头 -->
|
||||
<template v-slot:header>
|
||||
<ms-table-header :create-permission="['PROJECT_ENVIRONMENT:READ+CREATE']" :title="$t('api_test.environment.environment_list')" :create-tip="btnTips"
|
||||
<ms-table-header :create-permission="['WORKSPACE_PROJECT_ENVIRONMENT:READ+CREATE']" :title="$t('api_test.environment.environment_list')" :create-tip="btnTips"
|
||||
:condition.sync="condition" :is-tester-permission="isTesterPermission" @search="search" @create="createEnv">
|
||||
<template v-slot:button>
|
||||
<ms-table-button v-permission="['PROJECT_ENVIRONMENT:READ+IMPORT']" :is-tester-permission="isTesterPermission" icon="el-icon-box"
|
||||
<ms-table-button v-permission="['WORKSPACE_PROJECT_ENVIRONMENT:READ+IMPORT']" :is-tester-permission="isTesterPermission" icon="el-icon-box"
|
||||
:content="$t('commons.import')" @click="importJSON"/>
|
||||
<ms-table-button v-permission="['PROJECT_ENVIRONMENT:READ+EXPORT']" :is-tester-permission="isTesterPermission" icon="el-icon-box"
|
||||
<ms-table-button v-permission="['WORKSPACE_PROJECT_ENVIRONMENT:READ+EXPORT']" :is-tester-permission="isTesterPermission" icon="el-icon-box"
|
||||
:content="$t('commons.export')" @click="exportJSON"/>
|
||||
</template>
|
||||
</ms-table-header>
|
||||
|
@ -35,11 +35,11 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :edit-permission="['PROJECT_ENVIRONMENT:READ+EDIT']"
|
||||
:delete-permission="['PROJECT_ENVIRONMENT:READ+DELETE']"
|
||||
<ms-table-operator :edit-permission="['WORKSPACE_PROJECT_ENVIRONMENT:READ+EDIT']"
|
||||
:delete-permission="['WORKSPACE_PROJECT_ENVIRONMENT:READ+DELETE']"
|
||||
@editClick="editEnv(scope.row)" @deleteClick="deleteEnv(scope.row)">
|
||||
<template v-slot:middle>
|
||||
<ms-table-operator-button v-permission="['PROJECT_ENVIRONMENT:READ+COPY']" :tip="$t('commons.copy')" @exec="copyEnv(scope.row)" :is-tester-permission="isTesterPermission"
|
||||
<ms-table-operator-button v-permission="['WORKSPACE_PROJECT_ENVIRONMENT:READ+COPY']" :tip="$t('commons.copy')" @exec="copyEnv(scope.row)" :is-tester-permission="isTesterPermission"
|
||||
icon="el-icon-document-copy" type="info"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
|
|
Loading…
Reference in New Issue