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