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
3 changes: 2 additions & 1 deletion apps/maxkb/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Config(dict):
"REDIS_MAX_CONNECTIONS": 100,
# 外置语言包路径
"EXTERNAL_LOCALE_PATH": "/opt/maxkb/local/locales",
"FILE_AUTH": True
}

def get_debug(self) -> bool:
Expand Down Expand Up @@ -167,7 +168,7 @@ def from_mapping(self, *mapping, **kwargs):
"""Updates the config like :meth:`update` ignoring items with non-upper
keys.

.. versionadded:: 0.11
... versionadded:: 0.11
"""
mappings = []
if len(mapping) == 1:
Expand Down
3 changes: 3 additions & 0 deletions apps/oss/serializers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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 maxkb.const import CONFIG
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 @@ -82,6 +83,8 @@ def _deny():


def auth(file, mk_file_auth):
if not CONFIG.get("FILE_AUTH", True):
return
Comment on lines +86 to +87
# 公共/临时文件无需鉴权
if file.source_type in _PUBLIC_SOURCE_TYPES:
return
Expand Down
Loading