This is an automated email from the ASF dual-hosted git repository.
monreid pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new be6e84276 [Feature] Improve the search_owner when query the app list
(#1828)
be6e84276 is described below
commit be6e842764c14e65e9c5f2a700a10d07d8caaedb
Author: benjobs <[email protected]>
AuthorDate: Sat Oct 15 14:03:20 2022 +0800
[Feature] Improve the search_owner when query the app list (#1828)
* [Feature] Improve the search_owner when query the app list
* [Feature] Improve the search_owner when query the app list
* [Feature] Improve the search_owner when query the app list
* [Feature] Improve the search_owner when query the app list
* [bug] onwers need to de-duplicate
* [Feature] Improve the search_owner when query the app list
* [Feature] Improve the search_owner when query the app list
* [Feature] Improve the search_owner when query the app list
---
.../org/apache/streampark/common/conf/ConfigConst.scala | 8 ++++++++
.../streampark/common/conf/InternalConfigHolder.scala | 2 +-
.../org/apache/streampark/common/util/RedisClient.scala | 3 ++-
.../console/system/controller/PassportController.java | 3 +--
.../console/system/controller/UserController.java | 10 ++++++++--
.../apache/streampark/console/system/entity/User.java | 7 +++++++
.../streampark/console/system/mapper/UserMapper.java | 3 +--
.../streampark/console/system/service/UserService.java | 1 +
.../console/system/service/impl/UserServiceImpl.java | 13 +++++--------
.../src/main/resources/db/data-h2.sql | 14 +++++++-------
.../src/main/resources/mapper/system/UserMapper.xml | 16 ++++++++++++++++
.../streampark-console-webapp/src/api/index.js | 3 ++-
.../streampark-console-webapp/src/api/user.js | 4 ++++
.../src/views/flink/app/View.vue | 6 +++---
.../connector/clickhouse/conf/ClickHouseHttpConfig.scala | 3 ++-
.../streampark/connector/doris/conf/DorisConfig.scala | 5 +++--
16 files changed, 71 insertions(+), 30 deletions(-)
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/conf/ConfigConst.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/conf/ConfigConst.scala
index a0f575ee2..4129f078c 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/conf/ConfigConst.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/conf/ConfigConst.scala
@@ -19,6 +19,14 @@ package org.apache.streampark.common.conf
import java.time.LocalDateTime
object ConfigConst {
+
+ /**
+ * common const
+ *
+ */
+
+ val DEFAULT_DATAMASK_STRING = "********"
+
/**
*
* about parameter...
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
index 2ccdca27f..a91b381b4 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
@@ -176,7 +176,7 @@ object InternalConfigHolder extends Logger {
logInfo(
s"""registered configs:
|ConfigHub collected configs: ${configKeys.size}
- | ${configKeys.map(key => s"$key = ${if (key.contains("password"))
"********" else get(key)}").mkString("\n ")}""".stripMargin)
+ | ${configKeys.map(key => s"$key = ${if (key.contains("password"))
ConfigConst.DEFAULT_DATAMASK_STRING else get(key)}").mkString("\n
")}""".stripMargin)
}
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/util/RedisClient.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/util/RedisClient.scala
index 52aca476f..7c3478b05 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/util/RedisClient.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/util/RedisClient.scala
@@ -17,6 +17,7 @@
package org.apache.streampark.common.util
+import org.apache.streampark.common.conf.ConfigConst
import redis.clients.jedis._
import redis.clients.jedis.exceptions.JedisConnectionException
@@ -86,7 +87,7 @@ object RedisClient extends Logger {
* @return
*/
def createJedisPool(endpoint: RedisEndpoint): JedisPool = {
- val endpointEn: RedisEndpoint = endpoint.copy(auth = "********")
+ val endpointEn: RedisEndpoint = endpoint.copy(auth =
ConfigConst.DEFAULT_DATAMASK_STRING)
logInfo(s"[StreamPark] RedisClient: createJedisPool with $endpointEn ")
new JedisPool(poolConfig, endpoint.host, endpoint.port, endpoint.timeout,
endpoint.auth, endpoint.db)
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
index 405a91d3a..adca4c6df 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/PassportController.java
@@ -126,8 +126,7 @@ public class PassportController {
Set<String> permissions = this.userService.getPermissions(username);
userInfo.put("permissions", permissions);
- user.setPassword("******");
- user.setSalt("******");
+ user.dataMasking();
userInfo.put("user", user);
return userInfo;
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
index 46a5183fc..f1213f438 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java
@@ -189,8 +189,7 @@ public class UserController {
userService.setLatestTeam(teamId, user.getUserId());
//2) get latest userInfo
- user.setPassword("******");
- user.setSalt("******");
+ user.dataMasking();
Map<String, Object> infoMap = new HashMap<>(8);
infoMap.put("user", user);
@@ -205,4 +204,11 @@ public class UserController {
return new RestResponse().data(infoMap);
}
+ @PostMapping("appOwners")
+ public RestResponse appOnwers(Long teamId) {
+ List<User> userList = userService.findByAppOwner(teamId);
+ userList.forEach((u) -> u.dataMasking());
+ return RestResponse.success(userList);
+ }
+
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
index 6f7f0769f..f0c5c4008 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/entity/User.java
@@ -17,6 +17,7 @@
package org.apache.streampark.console.system.entity;
+import org.apache.streampark.common.conf.ConfigConst;
import org.apache.streampark.console.core.enums.UserType;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -102,4 +103,10 @@ public class User implements Serializable {
*/
private Long teamId;
+ public void dataMasking() {
+ String dataMask = ConfigConst.DEFAULT_DATAMASK_STRING();
+ this.setPassword(dataMask);
+ this.setSalt(dataMask);
+ }
+
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
index 38d1a2c03..f04529ce7 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/mapper/UserMapper.java
@@ -23,7 +23,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
import java.util.List;
@@ -31,7 +30,7 @@ public interface UserMapper extends BaseMapper<User> {
IPage<User> findUserDetail(Page page, @Param("user") User user);
- @Select("SELECT u.* FROM t_user u LEFT JOIN t_access_token t ON u.USER_ID
= t.USER_ID WHERE t.USER_ID IS NULL")
List<User> getNoTokenUser();
+ List<User> findByAppOwner(@Param("teamId") Long teamId);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
index 100a47e20..81fb39057 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java
@@ -111,4 +111,5 @@ public interface UserService extends IService<User> {
void fillInTeam(User user);
+ List<User> findByAppOwner(Long teamId);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
index 7a2613e69..16d24736c 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java
@@ -21,7 +21,6 @@ import org.apache.streampark.common.util.AssertUtils;
import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.util.ShaHashUtils;
-import org.apache.streampark.console.core.service.CommonService;
import org.apache.streampark.console.system.entity.Member;
import org.apache.streampark.console.system.entity.Menu;
import org.apache.streampark.console.system.entity.Team;
@@ -29,7 +28,6 @@ import org.apache.streampark.console.system.entity.User;
import org.apache.streampark.console.system.mapper.UserMapper;
import org.apache.streampark.console.system.service.MemberService;
import org.apache.streampark.console.system.service.MenuService;
-import org.apache.streampark.console.system.service.TeamService;
import org.apache.streampark.console.system.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -61,12 +59,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,
User> implements Us
@Autowired
private MenuService menuService;
- @Autowired
- private CommonService commonService;
-
- @Autowired
- private TeamService teamService;
-
@Override
public User findByName(String username) {
return baseMapper.selectOne(new
LambdaQueryWrapper<User>().eq(User::getUsername, username));
@@ -206,6 +198,11 @@ public class UserServiceImpl extends
ServiceImpl<UserMapper, User> implements Us
}
}
+ @Override
+ public List<User> findByAppOwner(Long teamId) {
+ return baseMapper.findByAppOwner(teamId);
+ }
+
private void setUserRoles(User user, String[] roles) {
Arrays.stream(roles).forEach(roleId -> {
Member ur = new Member();
diff --git
a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
index 98e8585f7..529c317df 100644
---
a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
+++
b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
@@ -19,7 +19,7 @@
-- Records of t_team
-- ----------------------------
insert into `t_team` values (100000, 'default', 'The default team', now(),
now());
-insert into `t_team` values (100001, 'test_team1', 'The test team1', now(),
now());
+insert into `t_team` values (100001, 'test', 'The test team', now(), now());
-- ----------------------------
@@ -152,14 +152,14 @@ insert into `t_setting` values (15,
'docker.register.namespace', null, 'Namespac
-- Records of t_user
-- ----------------------------
insert into `t_user` values (100000, 'admin', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 1,
null, '1', now(), now(),null,'0',null,null);
-insert into `t_user` values (100001, 'test_user1', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 2,
null, '1', now(), now(),null,'0',null,null);
-insert into `t_user` values (100002, 'test_user2', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 2,
null, '1', now(), now(),null,'0',null,null);
-insert into `t_user` values (100003, 'test_user3', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 2,
null, '1', now(), now(),null,'0',null,null);
+insert into `t_user` values (100001, 'test1', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 2,
null, '1', now(), now(),null,'0',null,null);
+insert into `t_user` values (100002, 'test2', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 2,
null, '1', now(), now(),null,'0',null,null);
+insert into `t_user` values (100003, 'test3', '',
'rh8b1ojwog777yrg0daesf04gk',
'2513f3748847298ea324dffbf67fe68681dd92315bda830065facd8efe08f54f', null, 2,
null, '1', now(), now(),null,'0',null,null);
-- ----------------------------
-- Records of t_member
-- ----------------------------
insert into `t_member` values (100000, 100000, 100001, 100001, now(), now());
-- test_user1 is the developer of the default team
-insert into `t_member` values (100001, 100001, 100001, 100001, now(), now());
-- test_user1 is the developer of the test_team1 team
-insert into `t_member` values (100002, 100000, 100002, 100001, now(), now());
-- test_user2 is the developer of the test_team1 team
-insert into `t_member` values (100003, 100001, 100003, 100001, now(), now());
-- test_user3 is the developer of the test_team1 team
+insert into `t_member` values (100001, 100001, 100001, 100001, now(), now());
-- test_user1 is the developer of the test team
+insert into `t_member` values (100002, 100000, 100002, 100001, now(), now());
-- test_user2 is the developer of the test team
+insert into `t_member` values (100003, 100001, 100003, 100001, now(), now());
-- test_user3 is the developer of the test team
diff --git
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
index 85d3141a6..621676d37 100644
---
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
+++
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/UserMapper.xml
@@ -59,4 +59,20 @@
order by ${user.sortField} ${user.sortOrder}
</if>
</select>
+
+ <select id="getNoTokenUser" resultType="user" parameterType="user">
+ select u.* from t_user u left join t_access_token t
+ on u.user_id = t.user_id
+ where t.user_id is null
+ </select>
+
+ <select id="findByAppOwner" resultType="user" parameterType="user">
+ select u.* from t_user u inner join (
+ select distinct(user_id) as user_id
+ from t_flink_app
+ where team_id = #{teamId}
+ ) t
+ where u.user_id = t.user_id
+ </select>
+
</mapper>
diff --git a/streampark-console/streampark-console-webapp/src/api/index.js
b/streampark-console/streampark-console-webapp/src/api/index.js
index e5fc5467c..c7b48e938 100644
--- a/streampark-console/streampark-console-webapp/src/api/index.js
+++ b/streampark-console/streampark-console-webapp/src/api/index.js
@@ -169,7 +169,8 @@ export default {
CHECK_NAME: '/user/check/name',
CHECK_PASSWORD: '/user/check/password',
SET_TEAM: '/user/setTeam',
- INIT_TEAM: '/user/initTeam'
+ INIT_TEAM: '/user/initTeam',
+ APP_OWNERS: '/user/appOwners'
},
Token: {
LIST: '/token/list',
diff --git a/streampark-console/streampark-console-webapp/src/api/user.js
b/streampark-console/streampark-console-webapp/src/api/user.js
index e22c65739..b2ef9c39f 100644
--- a/streampark-console/streampark-console-webapp/src/api/user.js
+++ b/streampark-console/streampark-console-webapp/src/api/user.js
@@ -69,3 +69,7 @@ export function setTeam(queryParam) {
export function initTeam(queryParam) {
return http.post(api.User.INIT_TEAM, queryParam)
}
+
+export function appOwners(queryParam) {
+ return http.post(api.User.APP_OWNERS, queryParam)
+}
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
b/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
index a0c9e0285..648869d3e 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
@@ -1142,7 +1142,7 @@ import {activeURL} from '@/api/flinkCluster'
import {Terminal} from 'xterm'
import 'xterm/css/xterm.css'
import SvgIcon from '@/components/SvgIcon'
-import {list as listUser} from '@/api/user'
+import {appOwners} from '@/api/user'
export default {
components: {Ellipsis, State, SvgIcon},
@@ -1309,8 +1309,8 @@ export default {
mounted() {
this.handleDashboard()
- listUser({'pageSize': '9999'}).then((resp) => {
- this.users = resp.data.records
+ appOwners().then((resp) => {
+ this.users = resp.data
})
this.handleInitTagsOptions()
this.handleFetch(true)
diff --git
a/streampark-flink/streampark-flink-connector/streampark-flink-connector-clickhouse/src/main/scala/org/apache/streampark/flink/connector/clickhouse/conf/ClickHouseHttpConfig.scala
b/streampark-flink/streampark-flink-connector/streampark-flink-connector-clickhouse/src/main/scala/org/apache/streampark/flink/connector/clickhouse/conf/ClickHouseHttpConfig.scala
index b1f92a14c..ac417a06c 100644
---
a/streampark-flink/streampark-flink-connector/streampark-flink-connector-clickhouse/src/main/scala/org/apache/streampark/flink/connector/clickhouse/conf/ClickHouseHttpConfig.scala
+++
b/streampark-flink/streampark-flink-connector/streampark-flink-connector-clickhouse/src/main/scala/org/apache/streampark/flink/connector/clickhouse/conf/ClickHouseHttpConfig.scala
@@ -17,6 +17,7 @@
package org.apache.streampark.flink.connector.clickhouse.conf
+import org.apache.streampark.common.conf.ConfigConst
import org.apache.streampark.flink.connector.conf.ThresholdConf
import java.util.{Base64, Properties}
@@ -67,7 +68,7 @@ class ClickHouseHttpConfig(parameters: Properties) extends
ThresholdConf(ClickHo
override def toString: String = {
s"""
- |{ user: $user, password: ******, hosts: ${hosts.mkString(",")} }
+ |{ user: $user, password: ${ConfigConst.DEFAULT_DATAMASK_STRING},
hosts: ${hosts.mkString(",")} }
|""".stripMargin
}
}
diff --git
a/streampark-flink/streampark-flink-connector/streampark-flink-connector-doris/src/main/scala/org/apache/streampark/connector/doris/conf/DorisConfig.scala
b/streampark-flink/streampark-flink-connector/streampark-flink-connector-doris/src/main/scala/org/apache/streampark/connector/doris/conf/DorisConfig.scala
index 5dfd21c77..ac8f5d006 100644
---
a/streampark-flink/streampark-flink-connector/streampark-flink-connector-doris/src/main/scala/org/apache/streampark/connector/doris/conf/DorisConfig.scala
+++
b/streampark-flink/streampark-flink-connector/streampark-flink-connector-doris/src/main/scala/org/apache/streampark/connector/doris/conf/DorisConfig.scala
@@ -16,8 +16,9 @@
*/
package org.apache.streampark.connector.doris.conf
-import java.util.Properties
+import org.apache.streampark.common.conf.ConfigConst
+import java.util.Properties
import scala.collection.JavaConversions._
object DorisConfig {
@@ -83,7 +84,7 @@ class DorisConfig(parameters: Properties) {
override def toString: String = {
s"""
- |{ doris user: $user, password: ******, hosts: ${loadUrl.mkString(",")}
}
+ |{ doris user: $user, password: ${ConfigConst.DEFAULT_DATAMASK_STRING},
hosts: ${loadUrl.mkString(",")} }
|""".stripMargin
}
}