This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 66579dd  [INLONG-3017][Manager] The interface of OpenAPI does not need 
authentication (#3018)
66579dd is described below

commit 66579dd17cc4e7bd72761db70d4f3b8bee8d4a5f
Author: healchow <[email protected]>
AuthorDate: Wed Mar 9 19:36:30 2022 +0800

    [INLONG-3017][Manager] The interface of OpenAPI does not need 
authentication (#3018)
---
 .../manager/common/pojo/cluster/ClusterInfo.java       |  7 +++++--
 .../core/impl/ThirdPartyClusterServiceImpl.java        |  8 ++++++--
 .../web/controller/openapi/OpenClusterController.java  | 18 ++++++------------
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/ClusterInfo.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/ClusterInfo.java
index 98d205f..2d52e9e 100644
--- 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/ClusterInfo.java
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/ClusterInfo.java
@@ -22,10 +22,10 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
- * Common cluster information
+ * Cluster info
  */
 @Data
-@ApiModel("Common cluster information")
+@ApiModel("Cluster info")
 public class ClusterInfo {
 
     @ApiModelProperty(value = "Incremental primary key")
@@ -61,6 +61,9 @@ public class ClusterInfo {
     @ApiModelProperty(value = "Name of in charges, separated by commas")
     private String inCharges;
 
+    @ApiModelProperty(value = "Name of in creator")
+    private String creator;
+
     @ApiModelProperty(value = "Cluster status")
     private Integer status;
 
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/ThirdPartyClusterServiceImpl.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/ThirdPartyClusterServiceImpl.java
index 37fc782..a4040f3 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/ThirdPartyClusterServiceImpl.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/ThirdPartyClusterServiceImpl.java
@@ -19,6 +19,7 @@ package org.apache.inlong.manager.service.core.impl;
 
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.inlong.manager.common.enums.Constant;
 import org.apache.inlong.manager.common.enums.EntityStatus;
 import org.apache.inlong.manager.common.enums.ErrorCodeEnum;
 import org.apache.inlong.manager.common.exceptions.BusinessException;
@@ -87,8 +88,11 @@ public class ThirdPartyClusterServiceImpl implements 
ThirdPartyClusterService {
         LOGGER.info("begin to insert a cluster info cluster={}", clusterInfo);
         Preconditions.checkNotNull(clusterInfo, "cluster is empty");
         ThirdPartyClusterEntity entity = 
CommonBeanUtils.copyProperties(clusterInfo, ThirdPartyClusterEntity::new);
-        entity.setCreator(operator);
+        if (operator != null) {
+            entity.setCreator(operator);
+        }
         entity.setCreateTime(new Date());
+        entity.setIsDeleted(Constant.UN_DELETED);
         thirdPartyClusterEntityMapper.insert(entity);
         LOGGER.info("success to add a cluster");
         return entity.getId();
@@ -121,7 +125,7 @@ public class ThirdPartyClusterServiceImpl implements 
ThirdPartyClusterService {
             LOGGER.error("cluster not found by id={}", id);
             throw new BusinessException(ErrorCodeEnum.CLUSTER_NOT_FOUND);
         }
-        entity.setIsDeleted(EntityStatus.IS_DELETED.getCode());
+        entity.setIsDeleted(id);
         entity.setStatus(EntityStatus.DELETED.getCode());
         entity.setModifier(operator);
         thirdPartyClusterEntityMapper.updateByPrimaryKey(entity);
diff --git 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
index 5428c6c..05b8dad 100644
--- 
a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
+++ 
b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenClusterController.java
@@ -24,8 +24,6 @@ import org.apache.inlong.manager.common.beans.Response;
 import org.apache.inlong.manager.common.enums.OperationType;
 import org.apache.inlong.manager.common.pojo.cluster.ClusterInfo;
 import org.apache.inlong.manager.common.pojo.cluster.ClusterRequest;
-import org.apache.inlong.manager.common.util.LoginUserUtils;
-import org.apache.inlong.manager.service.core.DataProxyClusterService;
 import org.apache.inlong.manager.service.core.ThirdPartyClusterService;
 import org.apache.inlong.manager.service.core.operationlog.OperationLog;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,24 +42,21 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/openapi/cluster")
-@Api(tags = "Cluster Config")
+@Api(tags = "Open-Cluster-API")
 public class OpenClusterController {
 
     @Autowired
     private ThirdPartyClusterService thirdPartyClusterService;
-    @Autowired
-    private DataProxyClusterService dataProxyClusterService;
 
     @PostMapping(value = "/save")
     @ApiOperation(value = "Save cluster info")
     @OperationLog(operation = OperationType.CREATE)
     public Response<Integer> save(@RequestBody ClusterInfo clusterInfo) {
-        String currentUser = LoginUserUtils.getLoginUserDetail().getUserName();
-        return Response.success(thirdPartyClusterService.save(clusterInfo, 
currentUser));
+        return Response.success(thirdPartyClusterService.save(clusterInfo, 
null));
     }
 
     @GetMapping(value = "/get/{id}")
-    @ApiOperation(value = "Get cluster info by id")
+    @ApiOperation(value = "Get cluster by id")
     @ApiImplicitParam(name = "id", value = "common cluster ID", dataTypeClass 
= Integer.class, required = true)
     public Response<ClusterInfo> get(@PathVariable Integer id) {
         return Response.success(thirdPartyClusterService.get(id));
@@ -77,16 +72,15 @@ public class OpenClusterController {
     @OperationLog(operation = OperationType.UPDATE)
     @ApiOperation(value = "Update cluster info")
     public Response<Boolean> update(@RequestBody ClusterInfo clusterInfo) {
-        String username = LoginUserUtils.getLoginUserDetail().getUserName();
-        return Response.success(thirdPartyClusterService.update(clusterInfo, 
username));
+        return Response.success(thirdPartyClusterService.update(clusterInfo, 
null));
     }
 
     @DeleteMapping(value = "/delete/{id}")
-    @ApiOperation(value = "Delete cluster info by id")
+    @ApiOperation(value = "Delete cluster by id")
     @OperationLog(operation = OperationType.DELETE)
     @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = 
Integer.class, required = true)
     public Response<Boolean> delete(@PathVariable Integer id) {
-        return Response.success(thirdPartyClusterService.delete(id, 
LoginUserUtils.getLoginUserDetail().getUserName()));
+        return Response.success(thirdPartyClusterService.delete(id, null));
     }
 
 }

Reply via email to