Explorar el Código

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

guoyuanquan@mail.taiji.com.cn hace 1 mes
padre
commit
097535292a
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      api/services/dataset_service.py

+ 4 - 0
api/services/dataset_service.py

@@ -1627,6 +1627,10 @@ class DocumentService:
         name: str,
         name: str,
         batch: 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:
         if account.current_role == TenantAccountRole.EDITOR or account.dept_id!= dataset.dept_id:
             document = Document(
             document = Document(
                 tenant_id=dataset.tenant_id,
                 tenant_id=dataset.tenant_id,