Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/src/permission/tool/system-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const systemManage = {
),
delete: () => false,
create: () => false,
import: () => false,
switch: () => false,
edit: () => false,
copy: () => false,
Expand Down
8 changes: 8 additions & 0 deletions ui/src/permission/tool/system-share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const share = {
],
'OR',
),
import: () =>
hasPermission(
[
RoleConst.ADMIN,
PermissionConst.SHARED_TOOL_IMPORT,
],
'OR',
),
delete: () =>
hasPermission(
[
Expand Down
10 changes: 10 additions & 0 deletions ui/src/permission/tool/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ const workspace = {
],
'OR'
),
import: () =>
hasPermission(
[
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
RoleConst.USER.getWorkspaceRole,
PermissionConst.TOOL_IMPORT.getWorkspacePermission,
PermissionConst.TOOL_IMPORT.getWorkspacePermissionWorkspaceManageRole
],
'OR'
),
folderCreate: () =>
hasPermission(
[
Expand Down
10 changes: 9 additions & 1 deletion ui/src/views/paragraph/component/ParagraphCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
shadow="always"
style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px"
@click.stop
v-if="MoreFieldPermission(id)"
>
<el-switch
:loading="changeStateloading"
Expand Down Expand Up @@ -42,7 +43,9 @@
</el-icon>
</el-button>
</span>
<el-dropdown trigger="click" :teleported="false">
<el-dropdown trigger="click" :teleported="false"
v-if="MoreFieldPermission(id)"
>
<el-button text>
<el-icon><MoreFilled /></el-icon>
</el-button>
Expand Down Expand Up @@ -154,6 +157,11 @@ const permissionPrecise = computed (() => {
return permissionMap['knowledge'][apiType.value]
})

const MoreFieldPermission = (id:any) => {
return permissionPrecise.value.doc_generate(id) ||
permissionPrecise.value.doc_edit(id)
}

const emit = defineEmits(['dialogVisibleChange','clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move'])
const loading = ref(false)
const changeStateloading = ref(false)
Expand Down
13 changes: 11 additions & 2 deletions ui/src/views/tool/component/ToolListContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
:on-change="(file: any, fileList: any) => importTool(file)"
class="import-button"
>
<el-dropdown-item>
<el-dropdown-item
v-if="permissionPrecise.import()"
>
<div class="flex align-center w-full">
<el-avatar shape="square" class="mt-4" :size="36" style="background: none">
<img src="@/assets/icon_import.svg" alt="" />
Expand Down Expand Up @@ -195,7 +197,8 @@
</div>
</template>
<template #mouseEnter>
<div @click.stop v-if="!isShared">
<div @click.stop v-if="!isShared &&
MoreFieldPermission(item.id)">
<el-switch
v-model="item.is_active"
:before-change="() => changeState(item)"
Expand Down Expand Up @@ -350,6 +353,12 @@ const permissionPrecise = computed(() => {
return permissionMap['tool'][apiType.value]
})

const MoreFieldPermission = (id: any) => {
return (permissionPrecise.value.edit(id) ||
permissionPrecise.value.export(id) ||
permissionPrecise.value.delete(id) || isSystemShare.value)
}

const InitParamDrawerRef = ref()
const search_type = ref('name')
const search_form = ref<any>({
Expand Down
Loading