From 0e534dd61f0a873947652e48e8708a969609cf25 Mon Sep 17 00:00:00 2001 From: Jiajie Zhong Date: Tue, 6 Sep 2022 12:00:08 +0800 Subject: [PATCH] [python] Fix permission error when create related objects (#11783) after we add permission to our codebase in dev branch, will got error when create objects from pydolphinscheduler, because users with user_id equal to `Integer.MAX_VALUE` is ordinary users which can not have access to create unless we grant permission to the role manually. this patch change dummyUser to admin user's user_id == 1 to fix it --- .../org/apache/dolphinscheduler/api/python/PythonGateway.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java index 5d0873e6c9..1b2102f6b0 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java @@ -90,6 +90,8 @@ public class PythonGateway { private static final RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL; private static final int DEFAULT_DRY_RUN = 0; private static final ComplementDependentMode COMPLEMENT_DEPENDENT_MODE = ComplementDependentMode.OFF_MODE; + // We use admin user's user_id to skip some permission issue from python gateway service + private static final int ADMIN_USER_ID = 1; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @@ -142,7 +144,7 @@ public class PythonGateway { // TODO replace this user to build in admin user if we make sure build in one could not be change private final User dummyAdminUser = new User() { { - setId(Integer.MAX_VALUE); + setId(ADMIN_USER_ID); setUserName("dummyUser"); setUserType(UserType.ADMIN_USER); }