Skip to content

Commit

Permalink
fix:修复知识库写权限的校验
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jun 17, 2024
1 parent 68d2494 commit f9f3406
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/backend/bisheng/api/v1/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ def get_filelist(*,
db_knowledge = session.get(Knowledge, knowledge_id)
if not db_knowledge:
raise HTTPException(status_code=500, detail='当前知识库不可用,返回上级目录')
writable = login_user.access_check(db_knowledge.user_id, str(knowledge_id), AccessType.KNOWLEDGE)
if not writable:
if not login_user.access_check(db_knowledge.user_id, str(knowledge_id), AccessType.KNOWLEDGE):
raise HTTPException(status_code=500, detail='没有访问权限')

# 查找上传的文件信息
Expand All @@ -323,7 +322,7 @@ def get_filelist(*,
return resp_200({
'data': [jsonable_encoder(knowledgefile) for knowledgefile in files],
'total': total_count,
'writeable': writable
'writeable': login_user.access_check(db_knowledge.user_id, str(knowledge_id), AccessType.KNOWLEDGE_WRITE)
})


Expand Down

0 comments on commit f9f3406

Please sign in to comment.