This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
new 3928a9f99 [Improve] proxy minor improvement (#4000)
3928a9f99 is described below
commit 3928a9f992e0ed08a31d0fce246a427a21a4f78e
Author: benjobs <[email protected]>
AuthorDate: Wed Aug 28 20:44:03 2024 +0800
[Improve] proxy minor improvement (#4000)
---
.../console/core/service/impl/ProxyServiceImpl.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProxyServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProxyServiceImpl.java
index 2be531b0d..bcbd57ceb 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProxyServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProxyServiceImpl.java
@@ -23,6 +23,7 @@ import
org.apache.streampark.console.base.exception.PermissionDeniedException;
import org.apache.streampark.console.core.entity.Application;
import org.apache.streampark.console.core.entity.ApplicationLog;
import org.apache.streampark.console.core.entity.FlinkCluster;
+import org.apache.streampark.console.core.enums.UserType;
import org.apache.streampark.console.core.service.ApplicationLogService;
import org.apache.streampark.console.core.service.ApplicationService;
import org.apache.streampark.console.core.service.FlinkClusterService;
@@ -31,7 +32,9 @@ import
org.apache.streampark.console.core.service.ServiceHelper;
import org.apache.streampark.console.core.task.FlinkK8sWatcherWrapper;
import org.apache.streampark.console.system.authentication.JWTUtil;
import org.apache.streampark.console.system.entity.Member;
+import org.apache.streampark.console.system.entity.User;
import org.apache.streampark.console.system.service.MemberService;
+import org.apache.streampark.console.system.service.UserService;
import org.apache.streampark.flink.kubernetes.FlinkK8sWatcher;
import org.apache.commons.io.IOUtils;
@@ -78,6 +81,8 @@ public class ProxyServiceImpl implements ProxyService {
@Autowired private ApplicationLogService logService;
+ @Autowired private UserService userService;
+
@Autowired private FlinkK8sWatcher flinkK8sWatcher;
@Autowired private FlinkK8sWatcherWrapper k8sWatcherWrapper;
@@ -190,10 +195,13 @@ public class ProxyServiceImpl implements ProxyService {
if (token != null) {
Long userId = JWTUtil.getUserId(token);
if (userId != null && !userId.equals(app.getUserId())) {
- Member member = memberService.findByUserId(app.getTeamId(), userId);
- if (member == null) {
- throw new PermissionDeniedException(
- "Permission denied, this job not created by the current user,
And the job cannot be found in the current user's team.");
+ User user = userService.getById(userId);
+ if (user != null && user.getUserType() != UserType.ADMIN) {
+ Member member = memberService.findByUserId(app.getTeamId(), userId);
+ if (member == null) {
+ throw new PermissionDeniedException(
+ "Permission denied, this job not created by the current user,
And the job cannot be found in the current user's team.");
+ }
}
}
}