浏览代码

知识库个人,只允许创建者上传文档

guoyuanquan@mail.taiji.com.cn 1 月之前
父节点
当前提交
097535292a
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      api/services/dataset_service.py

+ 4 - 0
api/services/dataset_service.py

@@ -1627,6 +1627,10 @@ class DocumentService:
         name: str,
         batch: str,
     ):
+        if dataset.edit_auth==1 and account.id!=dataset.created_by:
+            raise ValueError(
+                f"Only the creator can upload documents to this knowledge base."
+            )
         if account.current_role == TenantAccountRole.EDITOR or account.dept_id!= dataset.dept_id:
             document = Document(
                 tenant_id=dataset.tenant_id,