Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/maxkb/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Config(dict):
"REDIS_MAX_CONNECTIONS": 100,
# 外置语言包路径
"EXTERNAL_LOCALE_PATH": "/opt/maxkb/local/locales",
"FILE_AUTH": True
"FILE_AUTH": "1"
}

def get_debug(self) -> bool:
Expand Down
27 changes: 16 additions & 11 deletions apps/oss/serializers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
import urllib

import uuid_utils.compat as uuid
from django.db.models import QuerySet
from django.http import HttpResponse
from django.utils.translation import gettext_lazy as _, gettext
from rest_framework import serializers

from application.models import Application, ChatShareLink, ApplicationAccessToken
from application.models import Application, ApplicationAccessToken, ChatShareLink
from common.auth.common import FileToken
from common.auth.handle.impl.user_token import get_auth
from common.constants.authentication_type import AuthenticationType
from common.database_model_manage.database_model_manage import DatabaseModelManage
from common.exception.app_exception import NotFound404, AppApiException, AppUnauthorizedFailed
from homepage.serializers.homepage import is_workspace_manage, is_extends_workspace_manage, \
has_extends_workspace_manage_permission, hasPermission
from knowledge.models import File, FileSourceType, Document, Knowledge, PublicFileAccess
from common.exception.app_exception import AppApiException, AppUnauthorizedFailed, NotFound404
from common.utils.common import common_convert_value
from django.db.models import QuerySet
from django.http import HttpResponse
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from homepage.serializers.homepage import (
has_extends_workspace_manage_permission,
hasPermission,
is_extends_workspace_manage,
is_workspace_manage,
)
from knowledge.models import Document, File, FileSourceType, Knowledge, PublicFileAccess
from maxkb.const import CONFIG
from rest_framework import serializers
from system_manage.models import WorkspaceUserResourcePermission
from system_manage.models.resource_mapping import ResourceMapping, ResourceType
from tools.serializers.tool import UploadedFileField
Expand Down Expand Up @@ -83,7 +88,7 @@ def _deny():


def auth(file, mk_file_auth):
if not CONFIG.get("FILE_AUTH", True):
if CONFIG.get("FILE_AUTH", "1") != "1":
return
# 公共/临时文件无需鉴权
if file.source_type in _PUBLIC_SOURCE_TYPES:
Expand Down
Loading