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
4 changes: 3 additions & 1 deletion ui/src/permission/application/system-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {hasPermission} from '@/utils/permission/index'
import {PermissionConst, RoleConst} from '@/utils/permission/data'

const systemManage = {
create: () => false,
create: () => false,
batchDelete: () => false,
batchMove: () => false,
folderCreate: () => false,
edit: () =>
hasPermission(
Expand Down
20 changes: 20 additions & 0 deletions ui/src/permission/application/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ const workspace = {
],
'OR'
),
batchDelete: () =>
hasPermission(
[
RoleConst.USER.getWorkspaceRole,
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.APPLICATION_BATCH_DELETE.getWorkspacePermission,
PermissionConst.APPLICATION_BATCH_DELETE.getWorkspacePermissionWorkspaceManageRole,
],
'OR',
),
batchMove: () =>
hasPermission(
[
RoleConst.USER.getWorkspaceRole,
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.APPLICATION_BATCH_MOVE.getWorkspacePermission,
PermissionConst.APPLICATION_BATCH_MOVE.getWorkspacePermissionWorkspaceManageRole,
],
'OR',
),
folderCreate: (folder_id: string) =>
hasPermission(
[
Expand Down
2 changes: 2 additions & 0 deletions ui/src/permission/knowledge/system-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const systemManage = {
'OR',
),
create: () => false,
batchDelete: () => false,
batchMove: () => false,
sync: () => hasPermission(
[
RoleConst.ADMIN,
Expand Down
2 changes: 2 additions & 0 deletions ui/src/permission/knowledge/system-share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
const share = {
is_share: () => false,
create: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_CREATE], 'OR'),
batchDelete: () => false,
batchMove: () => false,
sync: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_SYNC], 'OR'),
vector: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_VECTOR], 'OR'),
generate: () => hasPermission([RoleConst.ADMIN, PermissionConst.SHARED_KNOWLEDGE_GENERATE], 'OR'),
Expand Down
2 changes: 2 additions & 0 deletions ui/src/permission/knowledge/workspace-share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { EditionConst, PermissionConst, RoleConst } from '@/utils/permission/dat
const workspaceShare = {
is_share: () => true,
create: () => false,
batchDelete: () => false,
batchMove: () => false,
sync: () => false,
vector: () => false,
generate: () => false,
Expand Down
20 changes: 20 additions & 0 deletions ui/src/permission/knowledge/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ const workspace = {
],
'OR',
),
batchDelete: () =>
hasPermission(
[
RoleConst.USER.getWorkspaceRole,
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.KNOWLEDGE_BATCH_DELETE.getWorkspacePermission,
PermissionConst.KNOWLEDGE_BATCH_DELETE.getWorkspacePermissionWorkspaceManageRole,
],
'OR',
),
batchMove: () =>
hasPermission(
[
RoleConst.USER.getWorkspaceRole,
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.KNOWLEDGE_BATCH_MOVE.getWorkspacePermission,
PermissionConst.KNOWLEDGE_BATCH_MOVE.getWorkspacePermissionWorkspaceManageRole,
],
'OR',
),
folderRead: (folder_id: string) =>
hasPermission(
[
Expand Down
2 changes: 2 additions & 0 deletions ui/src/permission/tool/system-manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const systemManage = {
'OR'
),
create: () => false,
batchDelete: () => false,
batchMove: () => false,
import: () => false,
switch: () =>
hasPermission(
Expand Down
2 changes: 2 additions & 0 deletions ui/src/permission/tool/system-share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const share = {
],
'OR',
),
batchDelete: () => false,
batchMove: () => false,
import: () =>
hasPermission(
[
Expand Down
20 changes: 20 additions & 0 deletions ui/src/permission/tool/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ const workspace = {
],
'OR'
),
batchDelete: () =>
hasPermission(
[
RoleConst.USER.getWorkspaceRole,
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.TOOL_BATCH_DELETE.getWorkspacePermission,
PermissionConst.TOOL_BATCH_DELETE.getWorkspacePermissionWorkspaceManageRole,
],
'OR',
),
batchMove: () =>
hasPermission(
[
RoleConst.USER.getWorkspaceRole,
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
PermissionConst.TOOL_BATCH_MOVE.getWorkspacePermission,
PermissionConst.TOOL_BATCH_MOVE.getWorkspacePermissionWorkspaceManageRole,
],
'OR',
),
import: () =>
hasPermission(
[
Expand Down
9 changes: 9 additions & 0 deletions ui/src/utils/permission/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ const PermissionConst = {
KNOWLEDGE_GENERATE: new Permission('KNOWLEDGE:READ+GENERATE'),
KNOWLEDGE_RELATE_RESOURCE_VIEW: new Permission('KNOWLEDGE:READ+RELATE_VIEW'),

KNOWLEDGE_BATCH_DELETE: new Permission('KNOWLEDGE:READ+BATCH_DELETE'),
KNOWLEDGE_BATCH_MOVE: new Permission('KNOWLEDGE:READ+BATCH_MOVE'),

APPLICATION_BATCH_DELETE: new Permission('APPLICATION:READ+BATCH_DELETE'),
APPLICATION_BATCH_MOVE: new Permission('APPLICATION:READ+BATCH_MOVE'),

TOOL_BATCH_DELETE: new Permission('TOOL:READ+BATCH_DELETE'),
TOOL_BATCH_MOVE: new Permission('TOOL:READ+BATCH_MOVE'),

KNOWLEDGE_WORKFLOW_READ: new Permission('KNOWLEDGE_WORKFLOW:READ'),
KNOWLEDGE_WORKFLOW_EDIT: new Permission('KNOWLEDGE_WORKFLOW:READ+EDIT'),
KNOWLEDGE_WORKFLOW_EXPORT: new Permission('KNOWLEDGE_WORKFLOW:READ+EXPORT'),
Expand Down
5 changes: 3 additions & 2 deletions ui/src/views/application/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<el-option :label="$t('common.status.unpublished')" value="unpublished" />
</el-select>
</div>
<span class="ml-8" v-if="permissionPrecise.create()">
<span class="ml-8" v-if="permissionPrecise.batchDelete() || permissionPrecise.batchMove()">
<el-button @click="batchSelectedHandle(true)" v-if="isBatch === false">
<AppIcon iconName="app-batch-delete" class="mr-4" />
{{ $t('views.paragraph.setting.batchSelected') }}
Expand Down Expand Up @@ -338,11 +338,12 @@
class="ml-16"
:disabled="multipleSelection.length === 0"
@click="openMoveToDialog()"
v-if="permissionPrecise.batchMove()"
>
{{ $t('common.moveTo') }}
</el-button>

<el-button :disabled="multipleSelection.length === 0" @click="deleteMulApplication">
<el-button :disabled="multipleSelection.length === 0" @click="deleteMulApplication" v-if="permissionPrecise.batchDelete()">
{{ $t('common.delete') }}
</el-button>
<span class="color-secondary ml-24 mr-16">
Expand Down
9 changes: 7 additions & 2 deletions ui/src/views/knowledge/component/KnowledgeListContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.nick_name" />
</el-select>
</div>
<span class="ml-8" v-if="!isShared && permissionPrecise.create()">
<span class="ml-8" v-if="!isShared && (permissionPrecise.batchMove() || permissionPrecise.batchDelete())">
<el-button @click="batchSelectedHandle(true)" v-if="isBatch === false">
<AppIcon iconName="app-batch-delete" class="mr-4" />
{{ $t('views.paragraph.setting.batchSelected') }}
Expand Down Expand Up @@ -378,11 +378,16 @@
class="ml-16"
:disabled="multipleSelection.length === 0"
@click="openMoveToDialog()"
v-if="permissionPrecise.batchMove()"
>
{{ $t('common.moveTo') }}
</el-button>

<el-button :disabled="multipleSelection.length === 0" @click="deleteMulKnowledge">
<el-button
:disabled="multipleSelection.length === 0"
@click="deleteMulKnowledge"
v-if="permissionPrecise.batchDelete()"
>
{{ $t('common.delete') }}
</el-button>
<span class="color-secondary ml-24 mr-16">
Expand Down
9 changes: 7 additions & 2 deletions ui/src/views/tool/component/ToolListContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.nick_name" />
</el-select>
</div>
<span class="ml-8" v-if="!isShared && permissionPrecise.create()">
<span class="ml-8" v-if="!isShared && (permissionPrecise.batchMove() || permissionPrecise.batchDelete())">
<el-button @click="batchSelectedHandle(true)" v-if="isBatch === false">
<AppIcon iconName="app-batch-delete" class="mr-4" />
{{ $t('views.paragraph.setting.batchSelected') }}
Expand Down Expand Up @@ -422,11 +422,16 @@
class="ml-16"
:disabled="multipleSelection.length === 0"
@click="openMoveToDialog()"
v-if="permissionPrecise.batchMove()"
>
{{ $t('common.moveTo') }}
</el-button>

<el-button :disabled="multipleSelection.length === 0" @click="deleteMulTool">
<el-button
:disabled="multipleSelection.length === 0"
@click="deleteMulTool"
v-if="permissionPrecise.batchDelete()"
>
{{ $t('common.delete') }}
</el-button>
<span class="color-secondary ml-24 mr-16">
Expand Down
Loading