diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java index f535e48776..33e0e519b2 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java @@ -31,6 +31,7 @@ import org.apache.dolphinscheduler.api.service.SessionService; import org.apache.dolphinscheduler.api.service.UsersService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.constants.Constants; +import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.OkHttpUtils; import org.apache.dolphinscheduler.dao.entity.User; @@ -241,7 +242,7 @@ public class LoginController extends BaseController { String username = JSONUtils.getNodeString(userInfoJsonStr, "login"); User user = usersService.getUserByUserName(username); if (user == null) { - user = usersService.createUser(username, null, null, 0, null, null, 1); + user = usersService.createUser(UserType.GENERAL_USER, username, null); } String sessionId = sessionService.createSession(user, null); if (sessionId == null) { diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java index 27f8e5f8ef..f75a8ab8db 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java @@ -224,7 +224,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { } /*** - * create User for ldap and sso login + * create User for ldap、Casdoor SSO and OAuth2.0 login */ @Override @Transactional @@ -238,6 +238,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService { user.setUserType(userType); user.setCreateTime(now); user.setUpdateTime(now); + user.setTenantId(-1); user.setQueue(""); user.setState(Flag.YES.getCode());