[ISSUE #76] Add InstanceUser and ACL interfaces (#77)
* feat: add service user and acl
* feat: add service user and acl
* feat: add service user and acl
* feat: add service user and acl
* feat: replace serviceuser with instanceuser
* feat: replace serviceuser with instanceuser #2
* feat: commit deletion serviceusermapperTest
* feat: 提交 application-test.yml 改回密码password的
* feat: 最终更改
* feat: 最终更改-2
* feat: 最终更改-3
* Revert "feat: 最终更改-3"
This reverts commit 528d6f2ea1e8f8ebc70ff4c3dcc296be9b31c944.
* feat: 最终更改-4
* feat: 最终更改-5
diff --git a/.gitignore b/.gitignore
index 7f22e5a..56a4477 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@
*.iws
*.iml
*.ipr
+*.http
out/
!**/src/main/**/out/
!**/src/test/**/out/
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java
similarity index 96%
rename from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java
rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java
index 1ea76c9..aaf81ba 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/InstanceUserMetadata.java
@@ -25,7 +25,7 @@
* Service users are users that are used by components like mysql, kafka, etc.
*/
@Data
-public class ServiceUserMetadata {
+public class InstanceUserMetadata {
private String userName;
//service users are only store users by now
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java
index 24b4adc..2031153 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/CreateUserRequest.java
@@ -17,9 +17,9 @@
package org.apache.eventmesh.dashboard.common.model.remoting.user;
-import org.apache.eventmesh.dashboard.common.model.metadata.ServiceUserMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.InstanceUserMetadata;
public class CreateUserRequest {
- private ServiceUserMetadata serviceUserMetadata;
+ private InstanceUserMetadata instanceUserMetadata;
}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java
index d225706..8fdf0bc 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java
+++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserResponse.java
@@ -18,7 +18,7 @@
package org.apache.eventmesh.dashboard.common.model.remoting.user;
-import org.apache.eventmesh.dashboard.common.model.metadata.ServiceUserMetadata;
+import org.apache.eventmesh.dashboard.common.model.metadata.InstanceUserMetadata;
import java.util.List;
@@ -27,5 +27,5 @@
@Data
public class GetUserResponse {
- private List<ServiceUserMetadata> serviceUserMetadata;
+ private List<InstanceUserMetadata> instanceUserMetadata;
}
diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml
index c68e5a8..020bd9e 100644
--- a/eventmesh-dashboard-console/pom.xml
+++ b/eventmesh-dashboard-console/pom.xml
@@ -79,29 +79,29 @@
<scope>runtime</scope>
</dependency>
- <!-- health check client -->
- <!-- EventMesh SDK -->
-<!-- <dependency>-->
-<!-- <groupId>org.apache.eventmesh</groupId>-->
-<!-- <artifactId>eventmesh-sdk-java</artifactId>-->
-<!-- <version>1.10.0-release</version>-->
-<!-- <exclusions>-->
-<!-- <exclusion>-->
-<!-- <groupId>junit</groupId>-->
-<!-- <artifactId>junit</artifactId>-->
-<!-- </exclusion>-->
-<!-- <exclusion>-->
-<!-- <groupId>junit</groupId>-->
-<!-- <artifactId>junit-dep</artifactId>-->
-<!-- </exclusion>-->
-<!-- <exclusion>-->
-<!-- <groupId>org.apache.logging.log4j</groupId>-->
-<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
-<!-- </exclusion>-->
-<!-- </exclusions>-->
-<!-- </dependency>-->
+ <!--health check client -->
+ <!--EventMesh SDK -->
+ <!--<dependency>-->
+ <!-- <groupId>org.apache.eventmesh</groupId>-->
+ <!-- <artifactId>eventmesh-sdk-java</artifactId>-->
+ <!-- <version>1.10.0-release</version>-->
+ <!-- <exclusions>-->
+ <!-- <exclusion>-->
+ <!-- <groupId>junit</groupId>-->
+ <!-- <artifactId>junit</artifactId>-->
+ <!-- </exclusion>-->
+ <!-- <exclusion>-->
+ <!-- <groupId>junit</groupId>-->
+ <!-- <artifactId>junit-dep</artifactId>-->
+ <!-- </exclusion>-->
+ <!-- <exclusion>-->
+ <!-- <groupId>org.apache.logging.log4j</groupId>-->
+ <!-- <artifactId>log4j-slf4j-impl</artifactId>-->
+ <!-- </exclusion>-->
+ <!-- </exclusions>-->
+ <!--</dependency>-->
- <!-- health check client end -->
+ <!--health check client end-->
</dependencies>
<build>
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java
new file mode 100644
index 0000000..c35ebf9
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.controller;
+
+import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity;
+import org.apache.eventmesh.dashboard.console.service.acl.AclService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/acl")
+public class AclController {
+
+ @Autowired
+ private AclService aclService;
+
+ @PostMapping("/insertAcl")
+ public void insertAcl(@RequestBody AclEntity aclEntity) {
+ this.aclService.insert(aclEntity);
+ }
+
+ @PostMapping("deleteAcl")
+ public void deleteAcl(@RequestBody AclEntity aclEntity) {
+ this.aclService.deleteAclById(aclEntity);
+ }
+
+ @PostMapping("/updateAcl")
+ public void updateAcl(@RequestBody AclEntity aclEntity) {
+ this.aclService.updateResourceTypeById(aclEntity);
+ }
+
+ @PostMapping("/selectAcl")
+ public void selectAcl(@RequestBody AclEntity aclEntity) {
+ this.aclService.selectById(aclEntity);
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/InstanceUserController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/InstanceUserController.java
new file mode 100644
index 0000000..89b61c8
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/InstanceUserController.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.controller;
+
+import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity;
+import org.apache.eventmesh.dashboard.console.service.instanceuser.InstanceUserService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/instanceUser")
+public class InstanceUserController {
+
+ @Autowired
+ private InstanceUserService instanceUserService;
+
+ @PostMapping("/insertInstanceUser")
+ public void insertInstanceUser(@RequestBody InstanceUserEntity instanceUserEntity) {
+ this.instanceUserService.insert(instanceUserEntity);
+ }
+
+ @PostMapping("/deleteInstanceUserByCluster")
+ public void deleteInstanceUserByCluster(@RequestBody InstanceUserEntity instanceUserEntity) {
+ this.instanceUserService.deleteInstanceUserByCluster(instanceUserEntity);
+ }
+
+ @PostMapping("/updateNameById")
+ public void updateNameById(@RequestBody InstanceUserEntity instanceUserEntity) {
+ this.instanceUserService.updatePasswordById(instanceUserEntity);
+ }
+
+ @PostMapping("/selectAll")
+ public void selectAll() {
+
+ }
+
+ @PostMapping("/selectById")
+ public void selectById(@RequestBody InstanceUserEntity instanceUserEntity) {
+ this.instanceUserService.selectById(instanceUserEntity);
+ }
+
+ @PostMapping("/selectByName")
+ public void selectByName(@RequestBody InstanceUserEntity instanceUserEntity) {
+ this.instanceUserService.selectByName(instanceUserEntity);
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java
new file mode 100644
index 0000000..78b7d7d
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.entity.acl;
+
+import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true, exclude = "status")
+public class AclEntity extends BaseEntity {
+
+ private static final long serialVersionUID = 6057071983428111947L;
+ private Long id;
+ private Long clusterId;
+ private String pattern;
+ private Integer operation;
+ private Integer permissionType;
+ private String host;
+ private Integer resourceType;
+ private String resourceName;
+ private Integer patternType;
+ private Integer status;
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/instanceuser/InstanceUserEntity.java
similarity index 61%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/instanceuser/InstanceUserEntity.java
index 1ea76c9..8ca85b4 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/instanceuser/InstanceUserEntity.java
@@ -15,20 +15,32 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.metadata;
+package org.apache.eventmesh.dashboard.console.entity.instanceuser;
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
+import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
-/**
- * Service users are users that are used by components like mysql, kafka, etc.
- */
+
@Data
-public class ServiceUserMetadata {
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true, exclude = "status")
+public class InstanceUserEntity extends BaseEntity {
- private String userName;
- //service users are only store users by now
- private StoreType serviceType;
+ private Integer instanceType;
+
private String password;
+
+ private Long clusterId;
+
+ private String name;
+
+ private String token;
+
+ private Integer status;
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java
new file mode 100644
index 0000000..e2e5021
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.acl;
+
+import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+/**
+ * Mybatis Mapper for the table of acl.
+ */
+@Mapper
+public interface AclMapper {
+
+ @Insert({
+ "<script>",
+ " INSERT INTO acl (cluster_Id, pattern, operation, permission_Type, host, resource_Type, resource_Name, pattern_Type) VALUES ",
+ " <foreach collection='list' item='c' index='index' separator=','>",
+ " (#{c.clusterId}, #{c.pattern}, #{c.operation}, #{c.permissionType}, #{c.host}, "
+ +
+ " #{c.resourceType}, #{c.resourceName}, #{c.patternType})",
+ " </foreach>",
+ "</script>"})
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ void batchInsert(List<AclEntity> aclEntities);
+
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ @Insert("INSERT INTO acl (cluster_id, pattern, operation, permission_type, host, resource_type, resource_name, pattern_type)"
+ + "VALUE (#{clusterId}, #{pattern}, #{operation}, #{permissionType}, #{host}, #{resourceType}, #{resourceName}, #{patternType})")
+ void insert(AclEntity aclEntity);
+
+ @Update("UPDATE acl SET status=0 WHERE id=#{id}")
+ void deleteById(AclEntity aclEntity);
+
+ @Update("UPDATE acl SET resource_type=#{resourceType} WHERE id=#{id}")
+ void updateResourceTypeById(AclEntity aclEntity);
+
+ @Select("SELECT * FROM acl")
+ List<AclEntity> selectAll();
+
+ @Select("SELECT * FROM acl WHERE id=#{id}")
+ AclEntity selectById(AclEntity aclEntity);
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java
index 167c7b2..905b551 100644
--- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java
@@ -52,7 +52,8 @@
@Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name, config_value, start_version, "
+ "status, is_default, end_version, diff_type, description, edit, is_modify, eventmesh_version) VALUE "
+ "(#{clusterId},#{businessType},#{instanceType},#{instanceId},#{configName},"
- + "#{configValue},#{startVersion},#{status},#{isDefault},#{endVersion},#{diffType},#{description},#{edit},#{isModify},#{eventmeshVersion})")
+ + "#{configValue},#{startVersion},#{status},#{isDefault},#{endVersion},#{diffType},"
+ + "#{description},#{edit},#{isModify},#{eventmeshVersion})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
Integer addConfig(ConfigEntity configEntity);
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapper.java
new file mode 100644
index 0000000..86017d7
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapper.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.instanceuser;
+
+import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+/**
+ * Mybatis Mapper for the table of instanceuser.
+ */
+@Mapper
+public interface InstanceUserMapper {
+
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ @Insert("INSERT INTO instance_user (id, instance_type, password, cluster_id, name, token, status) "
+ + "VALUES (#{id}, #{instanceType}, #{password}, #{clusterId}, #{name}, #{token},1)")
+ void insert(InstanceUserEntity instanceuserEntity);
+
+ @Update("UPDATE instance_user SET status=0 WHERE cluster_id=#{clusterId}")
+ void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity);
+
+ @Update("UPDATE instance_user SET password=#{password} WHERE id=#{id}")
+ void updatePasswordById(InstanceUserEntity instanceuserentity);
+
+ @Select("SELECT * FROM instance_user WHERE status=1")
+ List<InstanceUserEntity> selectAll();
+
+ @Select("SELECT * FROM instance_user WHERE id=#{id} AND status=1")
+ InstanceUserEntity selectById(InstanceUserEntity instanceuserEntity);
+
+ @Select("SELECT * FROM instance_user WHERE name=#{name} AND status=1")
+ List<InstanceUserEntity> selectByName(InstanceUserEntity instanceuserEntity);
+
+}
diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/AclService.java
similarity index 64%
copy from eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java
copy to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/AclService.java
index 1ea76c9..b92af3a 100644
--- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ServiceUserMetadata.java
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/AclService.java
@@ -15,20 +15,25 @@
* limitations under the License.
*/
-package org.apache.eventmesh.dashboard.common.model.metadata;
+package org.apache.eventmesh.dashboard.console.service.acl;
-import org.apache.eventmesh.dashboard.common.enums.StoreType;
+import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity;
-import lombok.Data;
+import java.util.List;
/**
- * Service users are users that are used by components like mysql, kafka, etc.
+ * Service providing data of acl.
*/
-@Data
-public class ServiceUserMetadata {
+public interface AclService {
- private String userName;
- //service users are only store users by now
- private StoreType serviceType;
- private String password;
+ void insert(AclEntity aclEntity);
+
+ void deleteAclById(AclEntity aclEntity);
+
+ void updateResourceTypeById(AclEntity aclEntity);
+
+ List<AclEntity> selectAll();
+
+ AclEntity selectById(AclEntity aclEntity);
+
}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/Impl/AclServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/Impl/AclServiceImpl.java
new file mode 100644
index 0000000..94d1519
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/Impl/AclServiceImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.acl.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity;
+import org.apache.eventmesh.dashboard.console.mapper.acl.AclMapper;
+import org.apache.eventmesh.dashboard.console.service.acl.AclService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AclServiceImpl implements AclService {
+
+ @Autowired
+ private AclMapper aclMapper;
+
+ @Override
+ public void insert(AclEntity aclEntity) {
+ aclMapper.insert(aclEntity);
+ }
+
+ @Override
+ public void deleteAclById(AclEntity aclEntity) {
+ aclMapper.deleteById(aclEntity);
+ }
+
+ @Override
+ public void updateResourceTypeById(AclEntity aclEntity) {
+ aclMapper.updateResourceTypeById(aclEntity);
+ }
+
+ @Override
+ public List<AclEntity> selectAll() {
+ return aclMapper.selectAll();
+ }
+
+ @Override
+ public AclEntity selectById(AclEntity aclEntity) {
+ return aclMapper.selectById(aclEntity);
+ }
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/Impl/InstanceUserServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/Impl/InstanceUserServiceImpl.java
new file mode 100644
index 0000000..4b9fe1b
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/Impl/InstanceUserServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.instanceuser.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity;
+import org.apache.eventmesh.dashboard.console.mapper.instanceuser.InstanceUserMapper;
+import org.apache.eventmesh.dashboard.console.service.instanceuser.InstanceUserService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+
+@Service
+public class InstanceUserServiceImpl implements InstanceUserService {
+
+ @Autowired
+ private InstanceUserMapper instanceUserMapper;
+
+ @Override
+ public void insert(InstanceUserEntity instanceuserEntity) {
+ instanceUserMapper.insert(instanceuserEntity);
+ }
+
+ @Override
+ public void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity) {
+ instanceUserMapper.deleteInstanceUserByCluster(instanceuserEntity);
+ }
+
+ @Override
+ public void updatePasswordById(InstanceUserEntity instanceuserEntity) {
+ instanceUserMapper.updatePasswordById(instanceuserEntity);
+ }
+
+ @Override
+ public List<InstanceUserEntity> selectAll() {
+ return instanceUserMapper.selectAll();
+ }
+
+ @Override
+ public InstanceUserEntity selectById(InstanceUserEntity instanceuserEntity) {
+ return instanceUserMapper.selectById(instanceuserEntity);
+ }
+
+ @Override
+ public List<InstanceUserEntity> selectByName(InstanceUserEntity instanceuserEntity) {
+ return instanceUserMapper.selectByName(instanceuserEntity);
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/InstanceUserService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/InstanceUserService.java
new file mode 100644
index 0000000..8b512c4
--- /dev/null
+++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/InstanceUserService.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.instanceuser;
+
+import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity;
+
+import java.util.List;
+
+/**
+ * InstanceUser data service
+ */
+public interface InstanceUserService {
+
+ void insert(InstanceUserEntity instanceuserEntity);
+
+ void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity);
+
+ void updatePasswordById(InstanceUserEntity instanceuserentity);
+
+ List<InstanceUserEntity> selectAll();
+
+ InstanceUserEntity selectById(InstanceUserEntity instanceuserEntity);
+
+ List<InstanceUserEntity> selectByName(InstanceUserEntity instanceuserEntity);
+
+}
diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
index fa1ccb3..0e31fbd 100644
--- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
+++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql
@@ -23,10 +23,10 @@
register_name_list varchar(4096) default '' not null comment '注册中心名字',
bootstrap_servers varchar(2048) default '' not null comment 'server地址',
eventmesh_version varchar(32) default '' not null comment 'eventmesh版本',
- client_properties text null comment 'EventMesh客户端配置',
- jmx_properties text null comment 'JMX配置',
- reg_properties text null comment '注册中心配置',
- description text null comment '备注',
+ client_properties text null comment 'EventMesh客户端配置',
+ jmx_properties text null comment 'JMX配置',
+ reg_properties text null comment '注册中心配置',
+ description text null comment '备注',
auth_type int default 0 not null comment '认证类型,-1未知,0:无认证,',
run_state tinyint default 1 not null comment '运行状态, 0表示未监控, 1监控中,有注册中心,2:监控中,无注册中心',
create_time timestamp default CURRENT_TIMESTAMP not null comment '接入时间',
@@ -35,8 +35,7 @@
store_type int default 0 not null,
constraint uniq_name
unique (name)
-)
- comment '物理集群信息表';
+) comment '物理集群信息表';
create index idx_uniq_name
on cluster (name);
@@ -52,10 +51,10 @@
instance_type tinyint not null comment '配置类型 0:runtime,1:storage,2:connector,3:topic',
instance_id bigint default -1 not null comment '实例ID,上面配置对应的(比如runtime)的id',
config_name varchar(192) default '' not null comment '配置名称',
- config_value text null comment '配置值',
+ config_value text null comment '配置值',
start_version varchar(64) default '' not null comment '配置开始使用的版本',
status int default 1 not null comment '0 关闭 1 开启 ',
- is_default int default 1 null,
+ is_default int default 1 null,
end_version varchar(64) default '' not null comment '配置结束使用的版本',
diff_type int default -1 not null comment '差异类型',
description varchar(1000) default '' not null comment '备注',
@@ -66,8 +65,7 @@
eventmesh_version varchar(64) default ' ' not null,
constraint uniq_instance_type_instance_id_config_name
unique (instance_id, config_name, instance_type)
-)
- comment '配置信息表';
+) comment '配置信息表';
create index idx_phy_id_instance_id
on config (cluster_id, instance_id);
@@ -81,8 +79,8 @@
primary key,
cluster_id bigint default -1 not null comment '集群id',
name varchar(192) collate utf8_bin default '' not null comment 'Group名称',
- member_count int unsigned default '0' not null comment '成员数',
- members text null comment 'group的member列表',
+ member_count int unsigned default '0' not null comment '成员数',
+ members text null comment 'group的member列表',
type tinyint not null comment 'group类型 0:consumer 1:producer',
state varchar(64) default '' not null comment '状态',
create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
@@ -90,8 +88,7 @@
status int default 1 not null,
constraint uniq_cluster_phy_id_name
unique (cluster_id, name)
-)
- comment 'Group信息表';
+) comment 'Group信息表';
create index cluster_id
on `group` (cluster_id, name);
@@ -112,16 +109,13 @@
status int default 1 not null,
constraint uniq_cluster_topic_group
unique (cluster_id, topic_name, group_name)
-)
- comment 'GroupMember信息表';
+) comment 'GroupMember信息表';
create index cluster_id
on group_member (cluster_id, topic_name, group_name);
-
-
drop table if exists runtime;
create table runtime
(
@@ -140,8 +134,7 @@
endpoint_map varchar(1024) default '' not null comment '监听信息',
constraint uniq_cluster_phy_id__host_port
unique (cluster_id, host)
-)
- comment 'Runtime信息表';
+) comment 'Runtime信息表';
create index idx_phy_id_host_storage_id
on runtime (cluster_id, storage_cluster_id);
@@ -169,30 +162,67 @@
endpoint_map varchar(1024) default '' not null comment '监听信息',
constraint uniq_cluster_phy_id__storage_id
unique (cluster_id, store_id)
-)
- comment 'Store信息表';
+) comment 'Store信息表';
create index idx_store_id_runtime_id
on store (store_id, cluster_id, runtime_id);
+DROP TABLE IF EXISTS `instance_user`;
+CREATE TABLE `instance_user`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `instance_type` int(255) NOT NULL DEFAULT 0 COMMENT '区分不同软件',
+ `password` varchar(100) NOT NULL DEFAULT '' COMMENT '密码',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '物理集群ID',
+ `name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '名称',
+ `token` varchar(8192) NOT NULL DEFAULT '' COMMENT '密钥',
+ `status` int default 1 not null comment '状态: 1启用,0未启用',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Instance_User信息表';
+
+
+
+DROP TABLE IF EXISTS `acl`;
+CREATE TABLE `acl`
+(
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `pattern` varchar(192) NOT NULL DEFAULT '' COMMENT 'Service User Pattern',
+ `operation` int(11) NOT NULL DEFAULT '0' COMMENT '操作,',
+ `permission_type` int(11) NOT NULL DEFAULT '0' COMMENT '权限类型(0:未知,1:任意,2:拒绝,3:允许)',
+ `host` varchar(192) NOT NULL DEFAULT '' COMMENT '',
+ `resource_type` int(11) NOT NULL DEFAULT '0' COMMENT '资源类型(0:未知,1:任意,10:Kafka Topic,11:Kafka Group;21:Rocketmq topic)',
+ `resource_name` varchar(192) NOT NULL DEFAULT '' COMMENT '资源名称',
+ `pattern_type` tinyint(4) NOT NULL COMMENT '匹配类型(0:未知,1:任意,2:Match,3:Literal,4:prefixed)',
+ `status` int NOT NULL DEFAULT 1 COMMENT '状态(0:删除,1:存在)',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`),
+ INDEX `idx_cluster_phy_id_principal_res_name` (`cluster_id`, `pattern`, `resource_name`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8mb4,
+ DEFAULT COLLATE = utf8mb4_bin COMMENT ='ACL信息表';
+
DROP TABLE IF EXISTS `group`;
CREATE TABLE `group`
(
- `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群id',
`name` varchar(192) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Group名称',
- `member_count` int unsigned NOT NULL DEFAULT '0' COMMENT '成员数',
+ `member_count` int unsigned NOT NULL DEFAULT '0' COMMENT '成员数',
`members` varchar(1024) COMMENT 'group的member列表',
`type` tinyint NOT NULL COMMENT 'group类型 0:consumer 1:producer',
`state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
- `status` int NOT NULL DEFAULT '1',
+ `status` int NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_phy_id_name` (`cluster_id`, `name`),
- KEY `cluster_id` (`cluster_id`, `name`)
+ KEY `cluster_id` (`cluster_id`, `name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 322
DEFAULT CHARSET = utf8mb4,
@@ -203,17 +233,17 @@
CREATE TABLE `group_member`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
- `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
- `group_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Group名称',
- `eventmesh_user` varchar(192) NOT NULL DEFAULT '' COMMENT 'EventMesh用户',
- `state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
- `status` int NOT NULL DEFAULT '1',
+ `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
+ `group_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Group名称',
+ `eventmesh_user` varchar(192) NOT NULL DEFAULT '' COMMENT 'EventMesh用户',
+ `state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ `status` int NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_topic_group` (`cluster_id`, `topic_name`, `group_name`),
- KEY `cluster_id` (`cluster_id`, `topic_name`, `group_name`)
+ KEY `cluster_id` (`cluster_id`, `topic_name`, `group_name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 257
DEFAULT CHARSET = utf8mb4,
@@ -224,19 +254,19 @@
CREATE TABLE `operation_log`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '物理集群ID',
- `operation_type` varchar(192) NOT NULL DEFAULT '' COMMENT '操作类型,如:启动,停止,重启,添加,删除,修改',
- `state` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败',
+ `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '物理集群ID',
+ `operation_type` varchar(192) NOT NULL DEFAULT '' COMMENT '操作类型,如:启动,停止,重启,添加,删除,修改',
+ `state` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败',
`content` varchar(1024) COMMENT '备注信息',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `end_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
- `operation_user` varchar(192) DEFAULT NULL,
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `end_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
+ `operation_user` varchar(192) DEFAULT NULL,
`result` varchar(1024),
- `target_type` varchar(192) NOT NULL,
- `is_delete` int NOT NULL DEFAULT '0',
+ `target_type` varchar(192) NOT NULL,
+ `is_delete` int NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
- KEY `idx_cluster_phy_id` (`cluster_id`),
- KEY `idx_state` (`state`)
+ KEY `idx_cluster_phy_id` (`cluster_id`),
+ KEY `idx_state` (`state`)
) ENGINE = InnoDB
AUTO_INCREMENT = 68
DEFAULT CHARSET = utf8mb4,
@@ -247,20 +277,20 @@
CREATE TABLE `topic`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID',
`topic_name` varchar(192) CHARACTER SET utf8mb4
- COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Topic名称',
- `runtime_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'RuntimeId',
- `storage_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'StorageId',
- `retention_ms` bigint NOT NULL DEFAULT '-2' COMMENT '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
- `type` tinyint NOT NULL DEFAULT '0' COMMENT 'Topic类型,默认0,0:普通,1:EventMesh内部',
- `description` varchar(1024) DEFAULT '' COMMENT '备注信息',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(尽量与Topic实际创建时间一致)',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间(尽量与Topic实际创建时间一致)',
- `status` int NOT NULL DEFAULT '1',
+ COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Topic名称',
+ `runtime_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'RuntimeId',
+ `storage_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'StorageId',
+ `retention_ms` bigint NOT NULL DEFAULT '-2' COMMENT '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms',
+ `type` tinyint NOT NULL DEFAULT '0' COMMENT 'Topic类型,默认0,0:普通,1:EventMesh内部',
+ `description` varchar(1024) DEFAULT '' COMMENT '备注信息',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(尽量与Topic实际创建时间一致)',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间(尽量与Topic实际创建时间一致)',
+ `status` int NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`),
- KEY `cluster_id` (`cluster_id`, `topic_name`)
+ KEY `cluster_id` (`cluster_id`, `topic_name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 562
DEFAULT CHARSET = utf8mb4,
@@ -270,24 +300,24 @@
DROP TABLE IF EXISTS `client`;
CREATE TABLE `client`
(
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
- `name` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端名称',
- `platform` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端平台',
- `language` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端语言',
- `pid` bigint(22) NOT NULL DEFAULT '-1' COMMENT '客户端进程ID',
- `host` varchar(128) NOT NULL DEFAULT '' COMMENT '客户端地址',
- `port` int(16) NOT NULL DEFAULT '-1' COMMENT '客户端端口',
- `protocol` varchar(192) NOT NULL DEFAULT '' COMMENT '协议类型',
+ `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `name` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端名称',
+ `platform` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端平台',
+ `language` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端语言',
+ `pid` bigint(22) NOT NULL DEFAULT '-1' COMMENT '客户端进程ID',
+ `host` varchar(128) NOT NULL DEFAULT '' COMMENT '客户端地址',
+ `port` int(16) NOT NULL DEFAULT '-1' COMMENT '客户端端口',
+ `protocol` varchar(192) NOT NULL DEFAULT '' COMMENT '协议类型',
`status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态: 1启用,0未启用',
- `config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7',
- `description` varchar(1024) NOT NULL DEFAULT '' COMMENT '客户端描述',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ `config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7',
+ `description` varchar(1024) NOT NULL DEFAULT '' COMMENT '客户端描述',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
- INDEX `idx_cluster_id` (`cluster_id`)
+ INDEX `idx_cluster_id` (`cluster_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4,
DEFAULT COLLATE = utf8mb4_bin COMMENT ='client is an SDK application that can produce or consume events.';
@@ -298,17 +328,17 @@
CREATE TABLE `connector`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
- `name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector名称',
- `class_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector类',
- `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Connector类型',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector名称',
+ `class_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector类',
+ `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Connector类型',
`status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态: 1启用,0未启用',
`pod_state` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'k8s pod状态。0: pending;1: running;2: success;3: failed;4: unknown',
- `config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ `config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
- INDEX `idx_cluster_id` (`cluster_id`)
+ INDEX `idx_cluster_id` (`cluster_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4,
DEFAULT COLLATE = utf8mb4_bin COMMENT ='Connector信息表';
@@ -316,27 +346,27 @@
DROP TABLE IF EXISTS `connection`;
CREATE TABLE `connection`
(
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
- `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
- `source_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'source类型,可以为client或source connector',
- `source_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或source connector ID',
- `sink_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'sink类型,可以为client或sink connector',
- `sink_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或sink connector ID',
- `runtime_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '对应runtime id',
+ `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `source_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'source类型,可以为client或source connector',
+ `source_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或source connector ID',
+ `sink_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'sink类型,可以为client或sink connector',
+ `sink_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或sink connector ID',
+ `runtime_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '对应runtime id',
`status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态: 1启用,0未启用',
- `topic` varchar(192) NOT NULL DEFAULT '' COMMENT 'topic name',
- `group_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'GroupID',
- `description` varchar(1024) NOT NULL DEFAULT '' COMMENT '客户端描述',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ `topic` varchar(192) NOT NULL DEFAULT '' COMMENT 'topic name',
+ `group_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'GroupID',
+ `description` varchar(1024) NOT NULL DEFAULT '' COMMENT '客户端描述',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
- INDEX `idx_cluster_id` (`cluster_id`),
- INDEX `idx_group_id` (`group_id`),
- INDEX `idx_topic` (`topic`),
- INDEX `idx_source_id` (`source_id`),
- INDEX `idx_sink_id` (`sink_id`)
+ INDEX `idx_cluster_id` (`cluster_id`),
+ INDEX `idx_group_id` (`group_id`),
+ INDEX `idx_topic` (`topic`),
+ INDEX `idx_source_id` (`source_id`),
+ INDEX `idx_sink_id` (`sink_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4,
DEFAULT COLLATE = utf8mb4_bin COMMENT ='connection from event source to event sink. event source can be a source connector or a producer client.';
@@ -345,16 +375,16 @@
CREATE TABLE `health_check_result`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
- `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查维度(0:未知, 1:Cluster, 2:Runtime, 3:Topic, 4:Storage)',
+ `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查维度(0:未知, 1:Cluster, 2:Runtime, 3:Topic, 4:Storage)',
`type_id` bigint(20) unsigned NOT NULL COMMENT '对应检查维度的实例id',
- `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群ID',
- `state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查状态(0:未通过,1:通过,2:正在检查,3:超时)',
- `result_desc` varchar(1024) NOT NULL DEFAULT '' COMMENT '检查结果描述',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群ID',
+ `state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查状态(0:未通过,1:通过,2:正在检查,3:超时)',
+ `result_desc` varchar(1024) NOT NULL DEFAULT '' COMMENT '检查结果描述',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
- INDEX `idx_cluster_id` (`cluster_id`),
- INDEX `idx_type` (`type`)
+ INDEX `idx_cluster_id` (`cluster_id`),
+ INDEX `idx_type` (`type`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4,
DEFAULT COLLATE = utf8mb4_bin COMMENT ='健康检查结果';
@@ -363,23 +393,30 @@
CREATE TABLE `meta`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
- `name` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心名称',
- `type` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心类型,nacos,etcd,zookeeper',
- `version` varchar(128) NOT NULL DEFAULT '' COMMENT '注册中心版本',
- `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
- `host` varchar(128) NOT NULL DEFAULT '' COMMENT '注册中心地址',
- `port` int(16) NOT NULL DEFAULT '-1' COMMENT '注册中心端口',
- `role` varchar(16) NOT NULL DEFAULT '-1' COMMENT '角色, leader follower observer',
- `username` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心用户名',
- `params` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心启动参数',
+ `name` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心名称',
+ `type` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心类型,nacos,etcd,zookeeper',
+ `version` varchar(128) NOT NULL DEFAULT '' COMMENT '注册中心版本',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
+ `host` varchar(128) NOT NULL DEFAULT '' COMMENT '注册中心地址',
+ `port` int(16) NOT NULL DEFAULT '-1' COMMENT '注册中心端口',
+ `role` varchar(16) NOT NULL DEFAULT '-1' COMMENT '角色, leader follower observer',
+ `username` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心用户名',
+ `params` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心启动参数',
`status` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT '状态: 1启用,0未启用',
- `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
- INDEX `idx_cluster_id` (`cluster_id`)
+ INDEX `idx_cluster_id` (`cluster_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4,
- DEFAULT COLLATE = utf8mb4_bin COMMENT ='注册中心信息表';
\ No newline at end of file
+ DEFAULT COLLATE = utf8mb4_bin COMMENT ='注册中心信息表';
+
+
+
+
+
+
+
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java
new file mode 100644
index 0000000..5071650
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java
@@ -0,0 +1,102 @@
+package org.apache.eventmesh.dashboard.console.mapper.acl;
+import java.sql.Timestamp;
+
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(classes = EventMeshDashboardApplication.class)
+@ActiveProfiles("test")
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:acl-test.sql")
+
+public class AclMapperTest {
+
+ @Autowired
+ private AclMapper aclMapper;
+
+ @Test
+ public void testBatchInsert() {
+
+ List<AclEntity> aclEntities = new ArrayList<>();
+ for (int i = 7; i < 10; i++) {
+ AclEntity aclEntity = new AclEntity();
+
+ aclEntity.setClusterId(1L);
+ aclEntity.setPattern("pattern1");
+ aclEntity.setOperation(0);
+ aclEntity.setPermissionType(1);
+ aclEntity.setHost("127.0.0.1");
+ aclEntity.setResourceType(1);
+ aclEntity.setResourceName("2");
+ aclEntity.setPatternType(1);
+ aclEntities.add(aclEntity);
+ }
+
+ aclMapper.batchInsert(aclEntities);
+ assertEquals(3, aclEntities.size());
+ // aclEntities.size()返回的是新加的size,是3,而不是acl表中总的size,是5
+ }
+
+ @Test
+ public void testInsert() {
+// AclEntity aclEntity = new AclEntity("", 0, "0", "", "0", "source_name", 1);
+ AclEntity aclEntity = new AclEntity();
+ aclEntity.setClusterId(0L);
+ aclEntity.setPattern("pattern1");
+ aclEntity.setOperation(0);
+ aclEntity.setPermissionType(1);
+ aclEntity.setHost("host");
+ aclEntity.setResourceType(1);
+ aclEntity.setResourceName("resn");
+ aclEntity.setPatternType(0);
+ aclEntity.setStatus(0);
+ aclEntity.setId(0L);
+ aclEntity.setClusterId(0L);
+
+ aclMapper.insert(aclEntity);
+ assertNotNull(aclEntity);
+ assertEquals(5, aclEntity.getId());
+ }
+
+ @Test
+ public void testDelete() {
+ AclEntity aclEntity = new AclEntity();
+ aclEntity.setId(4L);
+ aclMapper.deleteById(aclEntity);
+ assertEquals(4, aclEntity.getId());
+ // 删除的就是id=4这条数据
+ // 通过改status为0,实现删除
+ }
+
+ @Test
+ public void testUpdate() {
+ AclEntity aclEntity = new AclEntity();
+ aclEntity.setId(3L);
+ aclEntity.setResourceType(10);
+ aclMapper.updateResourceTypeById(aclEntity);
+ aclEntity = aclMapper.selectById(aclEntity);
+ assertEquals(10, aclEntity.getResourceType());
+ }
+
+ @Test
+ public void testSelect() {
+ AclEntity aclEntity = new AclEntity();
+ aclEntity.setId(3L);
+ aclMapper.selectById(aclEntity);
+ assertEquals(3, aclEntity.getId());
+ }
+
+}
diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java
new file mode 100644
index 0000000..5a62e54
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java
@@ -0,0 +1,68 @@
+package org.apache.eventmesh.dashboard.console.mapper.instanceuser;
+
+import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
+import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.jdbc.Sql;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@ExtendWith(SpringExtension.class)
+@SpringBootTest(classes = EventMeshDashboardApplication.class)
+@ActiveProfiles("test")
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"})
+@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:instance-user-test.sql")
+class InstanceUserMapperTest {
+
+ @Autowired
+ private InstanceUserMapper instanceUserMapper;
+
+ @Test
+ public void testSelectAll() {
+ List<InstanceUserEntity> instanceUserEntities = instanceUserMapper.selectAll();
+ assertEquals(3, instanceUserEntities.size());
+ }
+
+ @Test
+ public void testSelectById() {
+ InstanceUserEntity instanceUserEntity1 = new InstanceUserEntity();
+ instanceUserEntity1.setId(3L);
+ InstanceUserEntity instanceUserEntity = instanceUserMapper.selectById(instanceUserEntity1);
+ assertEquals(3, instanceUserEntity.getId());
+ }
+
+ @Test
+ public void testSelectByName() {
+ InstanceUserEntity instanceUserEntity1 = new InstanceUserEntity();
+ instanceUserEntity1.setName("name01");
+ List<InstanceUserEntity> instanceUserEntities = instanceUserMapper.selectByName(instanceUserEntity1);
+ assertEquals(1, instanceUserEntities.size());
+ }
+
+ @Test
+ public void testInsert() {
+ InstanceUserEntity instanceUserEntity = new InstanceUserEntity(0, "pwd", 13L, "name4", "11", 1);
+ instanceUserMapper.insert(instanceUserEntity);
+ assertNotNull(instanceUserEntity);
+ assertEquals(4, instanceUserEntity.getId());
+ // instanceuser.sql中新加三条数据,这条数据id自增为4
+ }
+
+ @Test
+ public void testUpdateNameById() {
+ InstanceUserEntity instanceUserEntity = new InstanceUserEntity();
+ instanceUserEntity.setId(3L);
+ instanceUserEntity.setPassword("123");
+ instanceUserMapper.updatePasswordById(instanceUserEntity);
+ instanceUserEntity = instanceUserMapper.selectById(instanceUserEntity);
+ assertEquals("123", instanceUserEntity.getPassword());
+ }
+
+}
\ No newline at end of file
diff --git a/eventmesh-dashboard-console/src/test/resources/acl-test.sql b/eventmesh-dashboard-console/src/test/resources/acl-test.sql
new file mode 100644
index 0000000..5352e47
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/acl-test.sql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+INSERT INTO eventmesh_dashboard_test.acl (id, cluster_id, pattern, operation, permission_type, host, resource_type,
+ resource_name, pattern_type, create_time, update_time)
+VALUES (3, 0, '', 0, '0', '', '0', 'source_name', 1, '2024-03-27 13:22:36', '2024-03-27 14:12:07');
+INSERT INTO eventmesh_dashboard_test.acl (id, cluster_id, pattern, operation, permission_type, host, resource_type,
+ resource_name, pattern_type, create_time, update_time)
+VALUES (4, 0, '', 0, '0', '', '0', 'source_name1', 1, '2024-03-27 13:22:36', '2024-03-27 14:12:07');
diff --git a/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql b/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql
new file mode 100644
index 0000000..2a4b47b
--- /dev/null
+++ b/eventmesh-dashboard-console/src/test/resources/instance-user-test.sql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+DELETE FROM `eventmesh_dashboard_test`.instance_user WHERE TRUE;
+ALTER TABLE `eventmesh_dashboard_test`.instance_user AUTO_INCREMENT = 1;
+
+INSERT INTO eventmesh_dashboard_test.instance_user (instance_type, password, cluster_id, name, token, status)
+VALUES (1, 'pwd01', 1, 'name01', 'token01', 1);
+
+INSERT INTO eventmesh_dashboard_test.instance_user (instance_type, password, cluster_id, name, token, status)
+VALUES (2, 'pwd02', 2, 'name02', 'token02', 1);
+
+INSERT INTO eventmesh_dashboard_test.instance_user (instance_type, password, cluster_id, name, token, status)
+VALUES (3, 'pwd03', 3, 'name03', 'token03', 1);
+
diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java
index 69ec414..5f5e18d 100644
--- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java
+++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/UserRemotingService.java
@@ -27,9 +27,9 @@
*/
public interface UserRemotingService {
- CreateUserRequest createServiceUser(CreateUserRequest request);
+ CreateUserRequest createInstanceUser(CreateUserRequest request);
- DeleterUserRequest deleteServiceUser(DeleterUserRequest request);
+ DeleterUserRequest deleteInstanceUser(DeleterUserRequest request);
- GetUserResult getServiceUser(GetUserRequest request);
+ GetUserResult getInstanceUser(GetUserRequest request);
}