You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ca...@apache.org on 2022/09/19 06:48:21 UTC
[dolphinscheduler] branch 3.1.0-prepare updated: [python] Fix permission error when create related objects (#11783)
This is an automated email from the ASF dual-hosted git repository.
caishunfeng pushed a commit to branch 3.1.0-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/3.1.0-prepare by this push:
new ed33066178 [python] Fix permission error when create related objects (#11783)
ed33066178 is described below
commit ed330661786fc9ccac7bf9cfc49bad0645eb0929
Author: Jiajie Zhong <zh...@hotmail.com>
AuthorDate: Tue Sep 6 12:00:08 2022 +0800
[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
---
.../java/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);
}