Skip to content

Commit b08a108

Browse files
committed
fix: System workspace permission
1 parent ad72517 commit b08a108

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

ui/src/router/modules/system.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ const systemRouter = {
1919
parentPath: '/system',
2020
parentName: 'system',
2121
permission: [
22-
new ComplexPermission(
23-
[RoleConst.ADMIN,],
24-
[PermissionConst.USER_READ],
25-
[EditionConst.IS_EE],
26-
'OR',
27-
),
22+
RoleConst.ADMIN,
23+
PermissionConst.USER_READ
2824
],
2925
},
3026
component: () => import('@/views/system/user-manage/index.vue'),
@@ -63,7 +59,9 @@ const systemRouter = {
6359
permission: [
6460
new ComplexPermission(
6561
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
66-
[PermissionConst.WORKSPACE_WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole],
62+
[PermissionConst.WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole,
63+
PermissionConst.WORKSPACE_READ
64+
],
6765
[EditionConst.IS_EE],
6866
'OR',
6967
),

ui/src/utils/permission/data.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import { Permission, Role, Edition } from '@/utils/permission/type'
2525
// ANNOTATION = "READ+ANNOTATION" # 标注
2626
// CLEAR_POLICY = "READ+CLEAR_POLICY"
2727
const PermissionConst = {
28-
USER_READ: new Permission('USER:READ'),
29-
USER_CREATE: new Permission('USER:READ+CREATE'),
30-
USER_EDIT: new Permission('USER:READ+EDIT'),
31-
USER_DELETE: new Permission('USER:READ+DELETE'),
28+
USER_READ: new Permission('USER_MANAGEMENT:READ'),
29+
USER_CREATE: new Permission('USER_MANAGEMENT:READ+CREATE'),
30+
USER_EDIT: new Permission('USER_MANAGEMENT:READ+EDIT'),
31+
USER_DELETE: new Permission('USER_MANAGEMENT:READ+DELETE'),
3232

3333
WORKSPACE_USER_RESOURCE_PERMISSION_READ: new Permission('WORKSPACE_USER_RESOURCE_PERMISSION:READ'),
3434
WORKSPACE_USER_RESOURCE_PERMISSION_EDIT: new Permission('WORKSPACE_USER_RESOURCE_PERMISSION:READ+EDIT'),

ui/src/views/system/workspace/component/Member.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div class="flex-between mb-16">
33
<el-button type="primary" @click="handleAdd"
4-
v-hasPermission="RoleConst.ADMIN,PermissionConst.WORKSPACE_ADD_MEMBER"
4+
v-hasPermission="[
5+
RoleConst.ADMIN,
6+
PermissionConst.WORKSPACE_ADD_MEMBER]"
57
>
68
{{ $t('views.role.member.add') }}
79
</el-button>
@@ -22,7 +24,7 @@
2224
<template #default="{ row }">
2325
<el-tooltip effect="dark" :content="`${$t('views.role.member.delete.button')}`" placement="top">
2426
<el-button type="primary" text @click.stop="handleDelete(row)"
25-
v-hasPermission="RoleConst.ADMIN,PermissionConst.WORKSPACE_REMOVE_MEMBER"
27+
v-hasPermission="[RoleConst.ADMIN,PermissionConst.WORKSPACE_REMOVE_MEMBER]"
2628
>
2729
<el-icon>
2830
<EditPen />

ui/src/views/system/workspace/index.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,26 @@
3535
</el-button>
3636
<template #dropdown>
3737
<el-dropdown-menu style="min-width: 80px">
38-
<el-dropdown-item @click.stop="createOrUpdateWorkspace(row)" class="p-8">
38+
<el-dropdown-item @click.stop="createOrUpdateWorkspace(row)" class="p-8"
39+
v-if="hasPermission([
40+
RoleConst.ADMIN,
41+
PermissionConst.WORKSPACE_EDIT
42+
],
43+
'OR')"
44+
>
3945
<AppIcon iconName="app-copy"></AppIcon>
4046
{{
4147
$t('common.rename')
4248
}}
4349
</el-dropdown-item>
4450
<el-dropdown-item @click.stop="deleteWorkspace(row)" class="border-t p-8"
45-
v-if="row.id !== 'default'">
51+
v-if="row.id !== 'default' &&
52+
hasPermission([
53+
RoleConst.ADMIN,
54+
PermissionConst.WORKSPACE_DELETE
55+
],
56+
'OR')
57+
">
4658
<AppIcon iconName="app-copy"></AppIcon>
4759
{{
4860
$t('common.delete')

0 commit comments

Comments
 (0)