feat: Share tool permission
This commit is contained in:
parent
a85cf51f42
commit
85ebd22c21
@ -3,12 +3,61 @@ import { ComplexPermission } from '@/utils/permission/type'
|
||||
import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||
const share = {
|
||||
is_share: () => false,
|
||||
delete: () => false,
|
||||
create: () => false,
|
||||
switch: () => false,
|
||||
edit: () => false,
|
||||
copy: () => false,
|
||||
export: () => false,
|
||||
debug: () => false,
|
||||
create: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_CREATE,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
delete: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_DELETE,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
switch: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_EDIT,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
edit: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_EDIT,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
copy: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_CREATE,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
export: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_EXPORT,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
debug: () =>
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_TOOL_DEBUG,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
}
|
||||
export default share
|
||||
|
||||
@ -4,12 +4,7 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
|
||||
const workspace = {
|
||||
is_share: () =>
|
||||
hasPermission(
|
||||
new ComplexPermission(
|
||||
[RoleConst.ADMIN],
|
||||
[PermissionConst.SHARED_TOOL_READ],
|
||||
[EditionConst.IS_EE],
|
||||
'OR',
|
||||
),
|
||||
[EditionConst.IS_EE],
|
||||
'OR',
|
||||
),
|
||||
delete: () =>
|
||||
|
||||
@ -145,6 +145,14 @@ const systemRouter = {
|
||||
activeMenu: '/system',
|
||||
parentPath: '/system',
|
||||
parentName: 'system',
|
||||
permission: [
|
||||
new ComplexPermission(
|
||||
[RoleConst.ADMIN],
|
||||
[PermissionConst.SHARED_TOOL_READ],
|
||||
[EditionConst.IS_EE],
|
||||
'OR'
|
||||
)
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/system-shared/ToolSharedIndex.vue'),
|
||||
},
|
||||
|
||||
@ -189,7 +189,6 @@
|
||||
@click="
|
||||
router.push({ path: `/knowledge/${item.id}/${currentFolder.id}/document` })
|
||||
"
|
||||
v-if="permissionPrecise.single(item.id)"
|
||||
>
|
||||
<template #icon>
|
||||
<KnowledgeIcon :type="item.type" />
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-dropdown trigger="click" v-if="!isShared">
|
||||
<el-button type="primary" class="ml-8" v-if="permissionPrecise.create()">
|
||||
<el-dropdown trigger="click" v-if="!isShared && permissionPrecise.create()">
|
||||
<el-button type="primary" class="ml-8">
|
||||
{{ $t('common.create') }}
|
||||
<el-icon class="el-icon--right">
|
||||
<arrow-down />
|
||||
@ -151,15 +151,7 @@
|
||||
class="cursor"
|
||||
@click.stop="openCreateDialog(item)"
|
||||
:disabled="
|
||||
hasPermission(
|
||||
[
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
RoleConst.USER.getWorkspaceRole,
|
||||
PermissionConst.TOOL_EDIT.getWorkspacePermissionWorkspaceManageRole,
|
||||
PermissionConst.TOOL_EDIT.getWorkspacePermission,
|
||||
],
|
||||
'OR',
|
||||
)
|
||||
permissionPrecise.edit()
|
||||
"
|
||||
>
|
||||
<template #icon>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user