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

View File

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

View File

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

View File

@ -35,14 +35,26 @@
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu style="min-width: 80px"> <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> <AppIcon iconName="app-copy"></AppIcon>
{{ {{
$t('common.rename') $t('common.rename')
}} }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item @click.stop="deleteWorkspace(row)" class="border-t p-8" <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> <AppIcon iconName="app-copy"></AppIcon>
{{ {{
$t('common.delete') $t('common.delete')