Browse Source

[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
3.2.0-release
Jiajie Zhong 2 years ago committed by GitHub
parent
commit
0e534dd61f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java

4
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 RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL;
private static final int DEFAULT_DRY_RUN = 0; private static final int DEFAULT_DRY_RUN = 0;
private static final ComplementDependentMode COMPLEMENT_DEPENDENT_MODE = ComplementDependentMode.OFF_MODE; 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 @Autowired
private ProcessDefinitionMapper processDefinitionMapper; 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 // 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() { private final User dummyAdminUser = new User() {
{ {
setId(Integer.MAX_VALUE); setId(ADMIN_USER_ID);
setUserName("dummyUser"); setUserName("dummyUser");
setUserType(UserType.ADMIN_USER); setUserType(UserType.ADMIN_USER);
} }

Loading…
Cancel
Save