feat: System chat user permission
This commit is contained in:
parent
594ca6cd89
commit
86ee4598ee
@ -72,6 +72,11 @@ const PermissionConst = {
|
|||||||
CHAT_USER_GROUP: new Permission('CHAT_USER:READ+USER_GROUP'),
|
CHAT_USER_GROUP: new Permission('CHAT_USER:READ+USER_GROUP'),
|
||||||
|
|
||||||
USER_GROUP_READ: new Permission('USER_GROUP:READ'),
|
USER_GROUP_READ: new Permission('USER_GROUP:READ'),
|
||||||
|
USER_GROUP_CREATE: new Permission('USER_GROUP:READ+CREATE'),
|
||||||
|
USER_GROUP_EDIT: new Permission('USER_GROUP:READ+EDIT'),
|
||||||
|
USER_GROUP_DELETE: new Permission('USER_GROUP:READ+DELETE'),
|
||||||
|
USER_GROUP_ADD_MEMBER: new Permission('USER_GROUP:READ+ADD_MEMBER'),
|
||||||
|
USER_GROUP_REMOVE_MEMBER: new Permission('USER_GROUP:READ+REMOVE_MEMBER'),
|
||||||
|
|
||||||
|
|
||||||
ROLE_READ: new Permission('ROLE:READ'),
|
ROLE_READ: new Permission('ROLE:READ'),
|
||||||
|
|||||||
@ -14,20 +14,19 @@
|
|||||||
@click="createUser()"
|
@click="createUser()"
|
||||||
v-hasPermission="
|
v-hasPermission="
|
||||||
new ComplexPermission(
|
new ComplexPermission(
|
||||||
[
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
RoleConst.ADMIN,
|
[PermissionConst.CHAT_USER_CREATE, PermissionConst.WORKSPACE_CHAT_USER_CREATE],
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
[],'OR',)"
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
],
|
|
||||||
[PermissionConst.WORKSPACE_CHAT_USER_CREATE.getWorkspacePermission],
|
|
||||||
[],
|
|
||||||
'OR',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ t('views.userManage.createUser') }}
|
{{ t('views.userManage.createUser') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="syncUsers">
|
<el-button @click="syncUsers"
|
||||||
|
v-hasPermission="
|
||||||
|
new ComplexPermission(
|
||||||
|
[RoleConst.ADMIN],
|
||||||
|
[PermissionConst.CHAT_USER_SYNC],
|
||||||
|
[],'OR',)"
|
||||||
|
>
|
||||||
{{ $t('views.chatUser.syncUsers') }}
|
{{ $t('views.chatUser.syncUsers') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@ -35,16 +34,9 @@
|
|||||||
@click="setUserGroups"
|
@click="setUserGroups"
|
||||||
v-hasPermission="
|
v-hasPermission="
|
||||||
new ComplexPermission(
|
new ComplexPermission(
|
||||||
[
|
[RoleConst.ADMIN,RoleConst.WORKSPACE_MANAGE],
|
||||||
RoleConst.ADMIN,
|
[PermissionConst.CHAT_USER_GROUP, PermissionConst.WORKSPACE_CHAT_USER_GROUP],
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
[],'OR',)"
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
],
|
|
||||||
[PermissionConst.WORKSPACE_CHAT_USER_GROUP.getWorkspacePermission],
|
|
||||||
[],
|
|
||||||
'OR',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('views.chatUser.setUserGroups') }}
|
{{ $t('views.chatUser.setUserGroups') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -53,16 +45,9 @@
|
|||||||
@click="handleBatchDelete"
|
@click="handleBatchDelete"
|
||||||
v-hasPermission="
|
v-hasPermission="
|
||||||
new ComplexPermission(
|
new ComplexPermission(
|
||||||
[
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
RoleConst.ADMIN,
|
[PermissionConst.WORKSPACE_CHAT_USER_DELETE, PermissionConst.CHAT_USER_DELETE],
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
[],'OR',)"
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
],
|
|
||||||
[PermissionConst.WORKSPACE_CHAT_USER_DELETE.getWorkspacePermission],
|
|
||||||
[],
|
|
||||||
'OR',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('common.delete') }}
|
{{ $t('common.delete') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -186,6 +171,10 @@
|
|||||||
size="small"
|
size="small"
|
||||||
v-model="row.is_active"
|
v-model="row.is_active"
|
||||||
:before-change="() => changeState(row)"
|
:before-change="() => changeState(row)"
|
||||||
|
v-if="hasPermission(new ComplexPermission(
|
||||||
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
|
[PermissionConst.CHAT_USER_EDIT, PermissionConst.WORKSPACE_CHAT_USER_EDIT],
|
||||||
|
[],'OR'),'OR')"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
@ -195,18 +184,10 @@
|
|||||||
text
|
text
|
||||||
@click.stop="editUser(row)"
|
@click.stop="editUser(row)"
|
||||||
:title="$t('common.edit')"
|
:title="$t('common.edit')"
|
||||||
v-hasPermission="
|
v-if="hasPermission(new ComplexPermission(
|
||||||
new ComplexPermission(
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[
|
[PermissionConst.CHAT_USER_EDIT, PermissionConst.WORKSPACE_CHAT_USER_EDIT],
|
||||||
RoleConst.ADMIN,
|
[],'OR'),'OR')"
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
],
|
|
||||||
[PermissionConst.WORKSPACE_CHAT_USER_EDIT.getWorkspacePermission],
|
|
||||||
[],
|
|
||||||
'OR',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<EditPen />
|
<EditPen />
|
||||||
@ -220,18 +201,10 @@
|
|||||||
text
|
text
|
||||||
@click.stop="editPwdUser(row)"
|
@click.stop="editPwdUser(row)"
|
||||||
:title="$t('views.userManage.setting.updatePwd')"
|
:title="$t('views.userManage.setting.updatePwd')"
|
||||||
v-hasPermission="
|
v-if="hasPermission(new ComplexPermission(
|
||||||
new ComplexPermission(
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[
|
[PermissionConst.CHAT_USER_EDIT, PermissionConst.WORKSPACE_CHAT_USER_EDIT],
|
||||||
RoleConst.ADMIN,
|
[],'OR'),'OR')"
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
],
|
|
||||||
[PermissionConst.WORKSPACE_CHAT_USER_EDIT.getWorkspacePermission],
|
|
||||||
[],
|
|
||||||
'OR',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Lock />
|
<Lock />
|
||||||
@ -245,18 +218,10 @@
|
|||||||
text
|
text
|
||||||
@click.stop="deleteUserManage(row)"
|
@click.stop="deleteUserManage(row)"
|
||||||
:title="$t('common.delete')"
|
:title="$t('common.delete')"
|
||||||
v-hasPermission="
|
v-if="hasPermission(new ComplexPermission(
|
||||||
new ComplexPermission(
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
[
|
[PermissionConst.CHAT_USER_DELETE, PermissionConst.WORKSPACE_CHAT_USER_DELETE],
|
||||||
RoleConst.ADMIN,
|
[],'OR'),'OR')"
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
],
|
|
||||||
[PermissionConst.WORKSPACE_CHAT_USER_DELETE.getWorkspacePermission],
|
|
||||||
[],
|
|
||||||
'OR',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete />
|
<Delete />
|
||||||
@ -301,6 +266,7 @@ import SystemGroupApi from '@/api/system/user-group'
|
|||||||
import type { ListItem } from '@/api/type/common'
|
import type { ListItem } from '@/api/type/common'
|
||||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||||
import { ComplexPermission } from '@/utils/permission/type'
|
import { ComplexPermission } from '@/utils/permission/type'
|
||||||
|
import { hasPermission } from '@/utils/permission'
|
||||||
|
|
||||||
const search_type = ref('username')
|
const search_type = ref('username')
|
||||||
const search_form = ref<{
|
const search_form = ref<{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user