Skip to content

Commit ec8f33d

Browse files
committed
fix: Knowledge document problem
1 parent 8231ae6 commit ec8f33d

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

ui/src/permission/knowledge/system-manage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const systemManage = {
3535
problem_create: () => false,
3636
problem_relate: () => false,
3737
problem_delete: () => false,
38+
problem_edit: () => false,
3839

3940
folderCreate: () => false,
4041
folderEdit: () => false,

ui/src/permission/knowledge/system-share.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ const share = {
165165
],
166166
'OR'
167167
),
168+
problem_edit: () =>
169+
hasPermission (
170+
[
171+
RoleConst.ADMIN,
172+
PermissionConst.SHARED_KNOWLEDGE_PROBLEM_EDIT
173+
],
174+
'OR'
175+
),
168176
folderCreate: () => false,
169177
folderEdit: () => false,
170178
folderDelete: () => false,

ui/src/permission/knowledge/workspace-share.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const workspaceShare = {
2626
problem_create: () => false,
2727
problem_relate: () => false,
2828
problem_delete: () => false,
29+
problem_edit: () => false,
2930

3031
folderCreate: () => false,
3132
folderEdit: () => false,

ui/src/permission/knowledge/workspace.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,16 @@ const workspace = {
240240
],
241241
'OR',
242242
),
243+
problem_edit: (source_id:string) =>
244+
hasPermission(
245+
[
246+
new ComplexPermission([RoleConst.USER],[PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(source_id)],[],'AND'),
247+
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
248+
PermissionConst.KNOWLEDGE_PROBLEM_EDIT.getKnowledgeWorkspaceResourcePermission(source_id),
249+
PermissionConst.KNOWLEDGE_PROBLEM_EDIT.getWorkspacePermissionWorkspaceManageRole,
250+
],
251+
'OR',
252+
),
243253
}
244254

245255
export default workspace

ui/src/views/problem/component/DetailProblemDrawer.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ReadWrite
1212
@change="editName"
1313
:data="currentContent"
14-
:showEditIcon="true"
14+
:showEditIcon="permissionPrecise.problem_edit(id as string)"
1515
:maxlength="256"
1616
/>
1717
</el-form-item>
@@ -21,7 +21,7 @@
2121
:title="item.title || '-'"
2222
class="cursor mb-8"
2323
:showIcon="false"
24-
@click.stop="editParagraph(item)"
24+
@click.stop="permissionPrecise.doc_edit(id as string) && editParagraph(item)"
2525
style="height: 210px"
2626
>
2727
<template #tag>
@@ -30,7 +30,9 @@
3030
:content="$t('views.problem.setting.cancelRelated')"
3131
placement="top"
3232
>
33-
<el-button type="primary" text @click.stop="disassociation(item)">
33+
<el-button type="primary" text @click.stop="disassociation(item)"
34+
v-if="permissionPrecise.doc_edit(id as string)"
35+
>
3436
<AppIcon iconName="app-quxiaoguanlian"></AppIcon>
3537
</el-button>
3638
</el-tooltip>
@@ -65,7 +67,9 @@
6567
</div>
6668
<template #footer>
6769
<div>
68-
<el-button @click="relateProblem">{{
70+
<el-button @click="relateProblem"
71+
v-if="permissionPrecise.doc_edit(id as string)"
72+
>{{
6973
$t('views.problem.relateParagraph.title')
7074
}}</el-button>
7175
<el-button @click="pre" :disabled="pre_disable || loading">{{
@@ -86,6 +90,7 @@ import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
8690
import RelateProblemDialog from './RelateProblemDialog.vue'
8791
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
8892
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
93+
import permissionMap from '@/permission'
8994
import { t } from '@/locales'
9095
const props = withDefaults(
9196
defineProps<{
@@ -127,6 +132,10 @@ const apiType = computed(() => {
127132
}
128133
})
129134
135+
const permissionPrecise = computed(() => {
136+
return permissionMap['knowledge'][apiType.value]
137+
})
138+
130139
const RelateProblemDialogRef = ref()
131140
const ParagraphDialogRef = ref()
132141
const loading = ref(false)

ui/src/views/problem/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<ReadWrite
6565
@change="editName($event, row.id)"
6666
:data="row.content"
67-
:showEditIcon="row.id === currentMouseId"
67+
:showEditIcon="permissionPrecise.problem_edit(id) && row.id === currentMouseId"
6868
:maxlength="256"
6969
/>
7070
</template>

0 commit comments

Comments
 (0)