Browse Source

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

guoyuanquan@mail.taiji.com.cn 1 month ago
parent
commit
097535292a
1 changed files with 4 additions and 0 deletions
  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,