Skip to content

Commit 01d94d6

Browse files
committed
chore: import Application model in file.py and clean up permission checks
1 parent e7fc581 commit 01d94d6

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎apps/oss/views/file.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding=utf-8
2-
from application.models import Chat
2+
from application.models import Chat, Application
33
from maxkb.const import CONFIG
44
from common.auth import AllTokenAuth, TokenAuth
55
from common.auth.authentication import has_permissions
@@ -60,11 +60,6 @@ def post(self, request: Request):
6060
if request.user is None or is_chat_path:
6161
if source_type != FileSourceType.CHAT.value:
6262
raise AppUnauthorizedFailed(403, _("No permission"))
63-
# 聊天文件必须归属于调用者所在应用下的会话
64-
if source_type == FileSourceType.CHAT.value:
65-
chat = QuerySet(Chat).filter(id=source_id, application_id=request.auth.application_id).first()
66-
if chat is None:
67-
raise AppUnauthorizedFailed(403, _("No permission"))
6863
return result.success(
6964
FileSerializer(
7065
data={

0 commit comments

Comments
 (0)