fix: Problem read permission
This commit is contained in:
parent
3edc68471b
commit
1febd0a957
@ -150,14 +150,21 @@ const share = {
|
|||||||
],
|
],
|
||||||
'OR'
|
'OR'
|
||||||
),
|
),
|
||||||
problem_read: () => false,
|
problem_read: () =>
|
||||||
problem_relate: () =>
|
|
||||||
hasPermission (
|
hasPermission (
|
||||||
[
|
[
|
||||||
RoleConst.ADMIN,
|
RoleConst.ADMIN,
|
||||||
PermissionConst.SHARED_KNOWLEDGE_PROBLEM_READ
|
PermissionConst.SHARED_KNOWLEDGE_PROBLEM_READ
|
||||||
],
|
],
|
||||||
'OR'
|
'OR'
|
||||||
|
),
|
||||||
|
problem_relate: () =>
|
||||||
|
hasPermission (
|
||||||
|
[
|
||||||
|
RoleConst.ADMIN,
|
||||||
|
PermissionConst.SHARED_KNOWLEDGE_PROBLEM_RELATE
|
||||||
|
],
|
||||||
|
'OR'
|
||||||
),
|
),
|
||||||
problem_delete: () =>
|
problem_delete: () =>
|
||||||
hasPermission (
|
hasPermission (
|
||||||
|
|||||||
@ -212,7 +212,16 @@ const workspace = {
|
|||||||
]
|
]
|
||||||
,'OR'
|
,'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) =>
|
problem_create: (source_id:string) =>
|
||||||
hasPermission(
|
hasPermission(
|
||||||
[
|
[
|
||||||
|
|||||||
@ -195,6 +195,7 @@ const PermissionConst = {
|
|||||||
SHARED_KNOWLEDGE_PROBLEM_CREATE: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+CREATE'),
|
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_EDIT: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+EDIT'),
|
||||||
SHARED_KNOWLEDGE_PROBLEM_DELETE: new Permission('SYSTEM_KNOWLEDGE_PROBLEM:READ+DELETE'),
|
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'),
|
SHARED_KNOWLEDGE_HIT_TEST_READ: new Permission('SYSTEM_KNOWLEDGE_HIT_TEST:READ'),
|
||||||
KNOWLEDGE_HIT_TEST_READ: new Permission('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">
|
<el-col :span="6" class="border-l" style="width: 300px">
|
||||||
<!-- 关联问题 -->
|
<!-- 关联问题 -->
|
||||||
<ProblemComponent
|
<ProblemComponent
|
||||||
|
v-if="permissionPrecise.problem_read(id)"
|
||||||
:paragraphId="paragraphId"
|
:paragraphId="paragraphId"
|
||||||
:docId="document_id"
|
:docId="document_id"
|
||||||
:knowledgeId="id"
|
:knowledgeId="id"
|
||||||
@ -56,12 +57,14 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch, nextTick } from 'vue'
|
import { ref, watch, nextTick, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { cloneDeep, debounce } from 'lodash'
|
import { cloneDeep, debounce } from 'lodash'
|
||||||
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
import ParagraphForm from '@/views/paragraph/component/ParagraphForm.vue'
|
||||||
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
import ProblemComponent from '@/views/paragraph/component/ProblemComponent.vue'
|
||||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
|
import permissionMap from '@/permission'
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title: String
|
title: String
|
||||||
@ -73,6 +76,21 @@ const {
|
|||||||
params: { id, documentId },
|
params: { id, documentId },
|
||||||
} = route as any
|
} = 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 emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
const ProblemRef = ref()
|
const ProblemRef = ref()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user