3 커밋 65a36e6bf5 ... 70816647e9

작성자 SHA1 메시지 날짜
  ‘suhuihui’ 70816647e9 Merge branch '1.1.3-guoyq' into 1.1.3-master 4 달 전
  guoyuanquan@mail.taiji.com.cn 97f10a98b5 Merge branch '1.1.3-master' of http://8.130.72.63:18081/shenzhen/tjdify into 1.1.3-guoyq 4 달 전
  guoyuanquan@mail.taiji.com.cn dc2c7273d3 添加部门后,修改相应的审核 4 달 전
1개의 변경된 파일31개의 추가작업 그리고 10개의 파일을 삭제
  1. 31 10
      api/controllers/console/datasets/datasets_document.py

+ 31 - 10
api/controllers/console/datasets/datasets_document.py

@@ -856,11 +856,24 @@ class DocumentStatusApi(DocumentResource):
             if action == "enable":
                 if document.enabled:
                     continue
-                if current_user.current_role not in (TenantAccountRole.ADMIN, TenantAccountRole.OWNER):
-                    document.enable_applicant = current_user.id
-                    document.check_status = 1
-                    db.session.commit()
-                    return {"result": "该操作需要提交管理员审核后生效,请确认是否提交"}, 200
+                #     本人 本人
+                if dataset.edit_auth == 1:
+                    if current_user != dataset.created_by:
+                        document.enable_applicant = current_user.id
+                        document.check_status = 1
+                        db.session.commit()
+                        return {"result": "该操作需要提交所有者审核后生效,请确认是否提交"}, 200
+                #     本部门
+                if dataset.edit_auth == 2:
+                    # 非本部门
+                    if current_user.dept_id != dataset.dept_id or current_user.current_role \
+                            not in (TenantAccountRole.ADMIN, TenantAccountRole.OWNER,TenantAccountRole.LEADER) \
+                            and current_user.id!=dataset.created_by:
+                        document.enable_applicant = current_user.id
+                        document.check_status = 1
+                        db.session.commit()
+                        return {"result": "该操作需要提交管理员审核后生效,请确认是否提交"}, 200
+
                 document.enabled = True
                 document.check_status = 3
                 document.disabled_at = None
@@ -888,11 +901,19 @@ class DocumentStatusApi(DocumentResource):
                     raise InvalidActionError(f"Document: {document.name} is not completed.")
                 if not document.enabled:
                     continue
-                #     下线判断,非管理员无法提交
-                if current_user.current_role not in (TenantAccountRole.ADMIN, TenantAccountRole.OWNER):
-                    document.enable_applicant = current_user.id
-                    db.session.commit()
-                    return {"result": "该操作需要提交管理员审核后生效,请确认是否提交"}, 200
+                if dataset.edit_auth == 1:
+                    if current_user != dataset.created_by:
+                        document.enable_applicant = current_user.id
+                        db.session.commit()
+                        return {"result": "该操作需要提交所有者审核后生效,请确认是否提交"}, 200
+                if dataset.edit_auth == 2:
+                    # 非本部门
+                    if current_user.dept_id != dataset.dept_id or current_user.current_role not in \
+                            (TenantAccountRole.ADMIN, TenantAccountRole.OWNER,TenantAccountRole.LEADER)\
+                            and current_user.id != dataset.created_by:
+                        document.enable_applicant = current_user.id
+                        db.session.commit()
+                        return {"result": "该操作需要提交管理员审核后生效,请确认是否提交"}, 200
 
                 document.enabled = False
                 document.disabled_at = datetime.now(UTC).replace(tzinfo=None)