feat: System chat user group permission

This commit is contained in:
zhangzhanwei 2025-06-27 13:37:57 +08:00 committed by zhanweizhang7
parent d251d2bff4
commit 8e6ca99ef6
2 changed files with 29 additions and 54 deletions

View File

@ -44,7 +44,13 @@
</el-form>
<div class="text-right">
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading">
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading"
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN],
[PermissionConst.USER_GROUP_REMOVE_MEMBER],
[],'OR',)"
>
{{ $t('common.save') }}
</el-button>
</div>
@ -58,6 +64,8 @@ import authApi from '@/api/chat-user/auth-setting'
import type {FormInstance, FormRules} from 'element-plus'
import {t} from '@/locales'
import {MsgSuccess} from '@/utils/message'
import { PermissionConst, RoleConst } from '@/utils/permission/data'
import { ComplexPermission } from '@/utils/permission/type'
const form = ref<any>({
id: '',

View File

@ -23,12 +23,9 @@
@click="createOrUpdate()"
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[PermissionConst.WORKSPACE_USER_GROUP_CREATE.getWorkspacePermission],
[],
'OR',
)
"
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_CREATE, PermissionConst.USER_GROUP_CREATE],
[],'OR',)"
>
<el-icon :size="18"><Plus /></el-icon>
</el-button>
@ -67,20 +64,10 @@
<el-dropdown-item
@click.stop="createOrUpdate(row)"
class="p-8"
v-if="
hasPermission(
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[
PermissionConst.WORKSPACE_USER_GROUP_EDIT
.getWorkspacePermission,
],
[],
'OR',
),
'OR',
)
"
v-if="hasPermission(new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_EDIT, PermissionConst.USER_GROUP_EDIT],
[],'OR',),'OR',)"
>
<el-icon><EditPen /></el-icon>
{{ $t('common.rename') }}
@ -88,21 +75,10 @@
<el-dropdown-item
@click.stop="deleteGroup(row)"
class="border-t p-8"
v-if="
row.id !== 'default' &&
hasPermission(
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[
PermissionConst.WORKSPACE_USER_GROUP_DELETE
.getWorkspacePermission,
],
[],
'OR',
),
'OR',
)
"
v-if="hasPermission(new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_DELETE, PermissionConst.USER_GROUP_DELETE],
[],'OR',),'OR',)"
>
<el-icon><Delete /></el-icon>
{{ $t('common.delete') }}
@ -143,12 +119,9 @@
@click="createUser()"
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[PermissionConst.WORKSPACE_USER_GROUP_ADD_MEMBER.getWorkspacePermission],
[],
'OR',
)
"
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_ADD_MEMBER, PermissionConst.USER_GROUP_ADD_MEMBER],
[],'OR',)"
>
{{ t('views.role.member.add') }}
</el-button>
@ -157,12 +130,9 @@
@click="handleDeleteUser()"
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[PermissionConst.WORKSPACE_USER_GROUP_DELETE.getWorkspacePermission],
[],
'OR',
)
"
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_REMOVE_MEMBER, PermissionConst.USER_GROUP_REMOVE_MEMBER],
[],'OR',)"
>
{{ $t('common.remove') }}
</el-button>
@ -221,12 +191,9 @@
@click.stop="handleDeleteUser(row)"
v-hasPermission="
new ComplexPermission(
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
[PermissionConst.WORKSPACE_USER_GROUP_REMOVE_MEMBER.getWorkspacePermission],
[],
'OR',
)
"
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
[PermissionConst.WORKSPACE_USER_GROUP_REMOVE_MEMBER, PermissionConst.USER_GROUP_REMOVE_MEMBER],
[],'OR',)"
>
<el-icon>
<EditPen />