fix: System workspace permission

This commit is contained in:
zhangzhanwei 2025-06-26 14:11:20 +08:00 committed by zhanweizhang7
parent ad72517ebe
commit b08a1088a2
4 changed files with 27 additions and 15 deletions

View File

@ -19,12 +19,8 @@ const systemRouter = {
parentPath: '/system',
parentName: 'system',
permission: [
new ComplexPermission(
[RoleConst.ADMIN,],
[PermissionConst.USER_READ],
[EditionConst.IS_EE],
'OR',
),
RoleConst.ADMIN,
PermissionConst.USER_READ
],
},
component: () => import('@/views/system/user-manage/index.vue'),
@ -63,7 +59,9 @@ const systemRouter = {
permission: [
new ComplexPermission(
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
[PermissionConst.WORKSPACE_WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole],
[PermissionConst.WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole,
PermissionConst.WORKSPACE_READ
],
[EditionConst.IS_EE],
'OR',
),

View File

@ -25,10 +25,10 @@ import { Permission, Role, Edition } from '@/utils/permission/type'
// ANNOTATION = "READ+ANNOTATION" # 标注
// CLEAR_POLICY = "READ+CLEAR_POLICY"
const PermissionConst = {
USER_READ: new Permission('USER:READ'),
USER_CREATE: new Permission('USER:READ+CREATE'),
USER_EDIT: new Permission('USER:READ+EDIT'),
USER_DELETE: new Permission('USER:READ+DELETE'),
USER_READ: new Permission('USER_MANAGEMENT:READ'),
USER_CREATE: new Permission('USER_MANAGEMENT:READ+CREATE'),
USER_EDIT: new Permission('USER_MANAGEMENT:READ+EDIT'),
USER_DELETE: new Permission('USER_MANAGEMENT:READ+DELETE'),
WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission('WORKSPACE_USER_RESOURCE_PERMISSION:READ'),
WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission('WORKSPACE_USER_RESOURCE_PERMISSION:READ+EDIT'),

View File

@ -1,7 +1,9 @@
<template>
<div class="flex-between mb-16">
<el-button type="primary" @click="handleAdd"
v-hasPermission="RoleConst.ADMIN,PermissionConst.WORKSPACE_ADD_MEMBER"
v-hasPermission="[
RoleConst.ADMIN,
PermissionConst.WORKSPACE_ADD_MEMBER]"
>
{{ $t('views.role.member.add') }}
</el-button>
@ -22,7 +24,7 @@
<template #default="{ row }">
<el-tooltip effect="dark" :content="`${$t('views.role.member.delete.button')}`" placement="top">
<el-button type="primary" text @click.stop="handleDelete(row)"
v-hasPermission="RoleConst.ADMIN,PermissionConst.WORKSPACE_REMOVE_MEMBER"
v-hasPermission="[RoleConst.ADMIN,PermissionConst.WORKSPACE_REMOVE_MEMBER]"
>
<el-icon>
<EditPen />

View File

@ -35,14 +35,26 @@
</el-button>
<template #dropdown>
<el-dropdown-menu style="min-width: 80px">
<el-dropdown-item @click.stop="createOrUpdateWorkspace(row)" class="p-8">
<el-dropdown-item @click.stop="createOrUpdateWorkspace(row)" class="p-8"
v-if="hasPermission([
RoleConst.ADMIN,
PermissionConst.WORKSPACE_EDIT
],
'OR')"
>
<AppIcon iconName="app-copy"></AppIcon>
{{
$t('common.rename')
}}
</el-dropdown-item>
<el-dropdown-item @click.stop="deleteWorkspace(row)" class="border-t p-8"
v-if="row.id !== 'default'">
v-if="row.id !== 'default' &&
hasPermission([
RoleConst.ADMIN,
PermissionConst.WORKSPACE_DELETE
],
'OR')
">
<AppIcon iconName="app-copy"></AppIcon>
{{
$t('common.delete')