You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/09/06 04:00:17 UTC
[dolphinscheduler] branch dev updated: [python] Fix permission error when create related objects (#11783)
This is an automated email from the ASF dual-hosted git repository.
zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 0e534dd61f [python] Fix permission error when create related objects (#11783)
0e534dd61f is described below
commit 0e534dd61f0a873947652e48e8708a969609cf25
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);
}