Skip to content

Commit d811bfc

Browse files
committed
feat: System chat user group permission
1 parent 8bc776a commit d811bfc

File tree

2 files changed

+29
-54
lines changed

2 files changed

+29
-54
lines changed

ui/src/views/system-chat-user/authentication/component/CAS.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@
4444
</el-form>
4545

4646
<div class="text-right">
47-
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading">
47+
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading"
48+
v-hasPermission="
49+
new ComplexPermission(
50+
[RoleConst.ADMIN],
51+
[PermissionConst.USER_GROUP_REMOVE_MEMBER],
52+
[],'OR',)"
53+
>
4854
{{ $t('common.save') }}
4955
</el-button>
5056
</div>
@@ -58,6 +64,8 @@ import authApi from '@/api/chat-user/auth-setting'
5864
import type {FormInstance, FormRules} from 'element-plus'
5965
import {t} from '@/locales'
6066
import {MsgSuccess} from '@/utils/message'
67+
import { PermissionConst, RoleConst } from '@/utils/permission/data'
68+
import { ComplexPermission } from '@/utils/permission/type'
6169
6270
const form = ref<any>({
6371
id: '',

ui/src/views/system-chat-user/group/index.vue

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@
2323
@click="createOrUpdate()"
2424
v-hasPermission="
2525
new ComplexPermission(
26-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
27-
[PermissionConst.WORKSPACE_USER_GROUP_CREATE.getWorkspacePermission],
28-
[],
29-
'OR',
30-
)
31-
"
26+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
27+
[PermissionConst.WORKSPACE_USER_GROUP_CREATE, PermissionConst.USER_GROUP_CREATE],
28+
[],'OR',)"
3229
>
3330
<el-icon :size="18"><Plus /></el-icon>
3431
</el-button>
@@ -67,42 +64,21 @@
6764
<el-dropdown-item
6865
@click.stop="createOrUpdate(row)"
6966
class="p-8"
70-
v-if="
71-
hasPermission(
72-
new ComplexPermission(
73-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
74-
[
75-
PermissionConst.WORKSPACE_USER_GROUP_EDIT
76-
.getWorkspacePermission,
77-
],
78-
[],
79-
'OR',
80-
),
81-
'OR',
82-
)
83-
"
67+
v-if="hasPermission(new ComplexPermission(
68+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
69+
[PermissionConst.WORKSPACE_USER_GROUP_EDIT, PermissionConst.USER_GROUP_EDIT],
70+
[],'OR',),'OR',)"
8471
>
8572
<el-icon><EditPen /></el-icon>
8673
{{ $t('common.rename') }}
8774
</el-dropdown-item>
8875
<el-dropdown-item
8976
@click.stop="deleteGroup(row)"
9077
class="border-t p-8"
91-
v-if="
92-
row.id !== 'default' &&
93-
hasPermission(
94-
new ComplexPermission(
95-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
96-
[
97-
PermissionConst.WORKSPACE_USER_GROUP_DELETE
98-
.getWorkspacePermission,
99-
],
100-
[],
101-
'OR',
102-
),
103-
'OR',
104-
)
105-
"
78+
v-if="hasPermission(new ComplexPermission(
79+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
80+
[PermissionConst.WORKSPACE_USER_GROUP_DELETE, PermissionConst.USER_GROUP_DELETE],
81+
[],'OR',),'OR',)"
10682
>
10783
<el-icon><Delete /></el-icon>
10884
{{ $t('common.delete') }}
@@ -143,12 +119,9 @@
143119
@click="createUser()"
144120
v-hasPermission="
145121
new ComplexPermission(
146-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
147-
[PermissionConst.WORKSPACE_USER_GROUP_ADD_MEMBER.getWorkspacePermission],
148-
[],
149-
'OR',
150-
)
151-
"
122+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
123+
[PermissionConst.WORKSPACE_USER_GROUP_ADD_MEMBER, PermissionConst.USER_GROUP_ADD_MEMBER],
124+
[],'OR',)"
152125
>
153126
{{ t('views.role.member.add') }}
154127
</el-button>
@@ -157,12 +130,9 @@
157130
@click="handleDeleteUser()"
158131
v-hasPermission="
159132
new ComplexPermission(
160-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
161-
[PermissionConst.WORKSPACE_USER_GROUP_DELETE.getWorkspacePermission],
162-
[],
163-
'OR',
164-
)
165-
"
133+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
134+
[PermissionConst.WORKSPACE_USER_GROUP_REMOVE_MEMBER, PermissionConst.USER_GROUP_REMOVE_MEMBER],
135+
[],'OR',)"
166136
>
167137
{{ $t('common.remove') }}
168138
</el-button>
@@ -221,12 +191,9 @@
221191
@click.stop="handleDeleteUser(row)"
222192
v-hasPermission="
223193
new ComplexPermission(
224-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
225-
[PermissionConst.WORKSPACE_USER_GROUP_REMOVE_MEMBER.getWorkspacePermission],
226-
[],
227-
'OR',
228-
)
229-
"
194+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
195+
[PermissionConst.WORKSPACE_USER_GROUP_REMOVE_MEMBER, PermissionConst.USER_GROUP_REMOVE_MEMBER],
196+
[],'OR',)"
230197
>
231198
<el-icon>
232199
<EditPen />

0 commit comments

Comments
 (0)