mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: Problem read permission
This commit is contained in:
parent
3edc68471b
commit
1febd0a957
|
|
@ -150,14 +150,21 @@ const share = {
|
|||
],
|
||||
'OR'
|
||||
),
|
||||
problem_read: () => false,
|
||||
problem_relate: () =>
|
||||
problem_read: () =>
|
||||
hasPermission (
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_KNOWLEDGE_PROBLEM_READ
|
||||
],
|
||||
'OR'
|
||||
),
|
||||
problem_relate: () =>
|
||||
hasPermission (
|
||||
[
|
||||
RoleConst.ADMIN,
|
||||
PermissionConst.SHARED_KNOWLEDGE_PROBLEM_RELATE
|
||||
],
|
||||
'OR'
|
||||
),
|
||||
problem_delete: () =>
|
||||
hasPermission (
|
||||
|
|
|
|||
|
|
@ -212,7 +212,16 @@ const workspace = {
|
|||
]
|
||||
,'OR'
|
||||
),
|
||||
problem_read: () => false,
|
||||
problem_read: (source_id:string) =>
|
||||
hasPermission(
|
||||
[
|
||||
new ComplexPermission([RoleConst.USER],[PermissionConst.KNOWLEDGE.getKnowledgeWorkspaceResourcePermission(source_id)],[],'AND'),
|
||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
||||
PermissionConst.KNOWLEDGE_PROBLEM_READ.getKnowledgeWorkspaceResourcePermission(source_id),
|
||||
PermissionConst.KNOWLEDGE_PROBLEM_READ.getWorkspacePermissionWorkspaceManageRole,
|
||||
],
|
||||
'OR',
|
||||
),
|
||||
problem_create: (source_id:string) =>
|
||||
hasPermission(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ const PermissionConst = {
|
|||
SHARED_KNOWLEDGE_PROBLEM_CREATE: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+CREATE'),
|
||||
SHARED_KNOWLEDGE_PROBLEM_EDIT: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+EDIT'),
|
||||
SHARED_KNOWLEDGE_PROBLEM_DELETE: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+DELETE'),
|
||||
SHARED_KNOWLEDGE_PROBLEM_RELATE: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+RELATE'),
|
||||
|
||||
SHARED_KNOWLEDGE_HIT_TEST_READ: new Permission('SYSTEM_KNOWLEDGE_HIT_TEST:READ'),
|
||||
KNOWLEDGE_HIT_TEST_READ: new Permission('KNOWLEDGE_HIT_TEST:READ'),
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
<el-col :span="6" class="border-l" style="width: 300px">
|
||||
<!-- 关联问题 -->
|
||||
<ProblemComponent
|
||||
v-if="permissionPrecise.problem_read(id)"
|
||||
:paragraphId="paragraphId"
|
||||
:docId="document_id"
|
||||
:knowledgeId="id"
|
||||
|
|
@ -56,12 +57,14 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, nextTick } from 'vue'
|
||||
import { ref, watch, nextTick, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { cloneDeep, debounce } from 'lodash'
|
||||
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
||||
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import permissionMap from '@/permission'
|
||||
|
||||
|
||||
const props = defineProps<{
|
||||
title: String
|
||||
|
|
@ -73,6 +76,21 @@ const {
|
|||
params: { id, documentId },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.query.from == 'systemManage') {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['knowledge'][apiType.value]
|
||||
})
|
||||
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const ProblemRef = ref()
|
||||
|
|
|
|||
Loading…
Reference in New Issue