Loading docker/postgres/docker-entrypoint-initdb/init.sql +2 −1 Original line number Diff line number Diff line Loading @@ -623,6 +623,7 @@ CREATE TABLE t_ds_user ( create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , queue varchar(64) DEFAULT NULL , state int DEFAULT 1 , PRIMARY KEY (id) ); Loading Loading @@ -749,7 +750,7 @@ ALTER TABLE t_ds_worker_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_ -- Records of t_ds_user?user : admin , password : dolphinscheduler123 INSERT INTO t_ds_user(user_name,user_password,user_type,email,phone,tenant_id,create_time,update_time) VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', 'xx', '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); INSERT INTO t_ds_user(user_name,user_password,user_type,email,phone,state,tenant_id,create_time,update_time) VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', 'xx', 1, '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); -- Records of t_ds_alertgroup,dolphinscheduler warning group INSERT INTO t_ds_alertgroup(group_name,group_type,description,create_time,update_time) VALUES ('dolphinscheduler warning group', '0', 'dolphinscheduler warning group','2018-11-29 10:20:39', '2018-11-29 10:20:39'); Loading dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java +14 −11 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ public class UsersController extends BaseController { @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "email", value = "EMAIL", dataType = "Int", example = "100"), @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100") @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) Loading @@ -83,11 +84,11 @@ public class UsersController extends BaseController { @RequestParam(value = "tenantId") int tenantId, @RequestParam(value = "queue", required = false, defaultValue = "") String queue, @RequestParam(value = "email") String email, @RequestParam(value = "phone", required = false) String phone) throws Exception { logger.info("login user {}, create user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue); Map<String, Object> result = usersService.createUser(loginUser, userName, userPassword, email, tenantId, phone, queue); @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "state", required = false) int state) throws Exception { logger.info("login user {}, create user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}, state: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue, state); Map<String, Object> result = usersService.createUser(loginUser, userName, userPassword, email, tenantId, phone, queue, state); return returnDataList(result); } Loading Loading @@ -146,7 +147,8 @@ public class UsersController extends BaseController { @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "email", value = "EMAIL", dataType = "Int", example = "100"), @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100") @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) Loading @@ -158,10 +160,11 @@ public class UsersController extends BaseController { @RequestParam(value = "queue", required = false, defaultValue = "") String queue, @RequestParam(value = "email") String email, @RequestParam(value = "tenantId") int tenantId, @RequestParam(value = "phone", required = false) String phone) throws Exception { logger.info("login user {}, updateProcessInstance user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue); Map<String, Object> result = usersService.updateUser(id, userName, userPassword, email, tenantId, phone, queue); @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "state", required = false) int state) throws Exception { logger.info("login user {}, updateProcessInstance user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}, state: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue, state); Map<String, Object> result = usersService.updateUser(id, userName, userPassword, email, tenantId, phone, queue, state); return returnDataList(result); } Loading dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java +1 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,7 @@ public enum Status { QUERY_WORKER_GROUP_FAIL(10146,"query worker group fail ", "查询worker分组失败"), DELETE_WORKER_GROUP_FAIL(10147,"delete worker group fail ", "删除worker分组失败"), COPY_PROCESS_DEFINITION_ERROR(10148,"copy process definition error", "复制工作流错误"), USER_DISABLED(10149,"The current user is disabled", "当前用户已停用"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), Loading dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/interceptor/LoginHandlerInterceptor.java +10 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ */ package org.apache.dolphinscheduler.api.interceptor; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.security.Authenticator; import org.apache.dolphinscheduler.api.service.SessionService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.commons.httpclient.HttpStatus; Loading Loading @@ -85,6 +87,14 @@ public class LoginHandlerInterceptor implements HandlerInterceptor { return false; } } // check user state if (user.getState() == Flag.NO.ordinal()) { response.setStatus(HttpStatus.SC_UNAUTHORIZED); logger.info(Status.USER_DISABLED.getMsg()); return false; } request.setAttribute(Constants.SESSION_USER, user); return true; } Loading dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/PasswordAuthenticator.java +8 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,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; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.dao.entity.Session; import org.apache.dolphinscheduler.dao.entity.User; import org.slf4j.Logger; Loading Loading @@ -49,6 +50,13 @@ public class PasswordAuthenticator implements Authenticator { return result; } // check user state if (user.getState() == Flag.NO.ordinal()) { result.setCode(Status.USER_DISABLED.getCode()); result.setMsg(Status.USER_DISABLED.getMsg()); return result; } // create session String sessionId = sessionService.createSession(user, extra); if (sessionId == null) { Loading Loading
docker/postgres/docker-entrypoint-initdb/init.sql +2 −1 Original line number Diff line number Diff line Loading @@ -623,6 +623,7 @@ CREATE TABLE t_ds_user ( create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , queue varchar(64) DEFAULT NULL , state int DEFAULT 1 , PRIMARY KEY (id) ); Loading Loading @@ -749,7 +750,7 @@ ALTER TABLE t_ds_worker_server ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_worker_ -- Records of t_ds_user?user : admin , password : dolphinscheduler123 INSERT INTO t_ds_user(user_name,user_password,user_type,email,phone,tenant_id,create_time,update_time) VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', 'xx', '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); INSERT INTO t_ds_user(user_name,user_password,user_type,email,phone,state,tenant_id,create_time,update_time) VALUES ('admin', '7ad2410b2f4c074479a8937a28a22b8f', '0', 'xxx@qq.com', 'xx', 1, '0', '2018-03-27 15:48:50', '2018-10-24 17:40:22'); -- Records of t_ds_alertgroup,dolphinscheduler warning group INSERT INTO t_ds_alertgroup(group_name,group_type,description,create_time,update_time) VALUES ('dolphinscheduler warning group', '0', 'dolphinscheduler warning group','2018-11-29 10:20:39', '2018-11-29 10:20:39'); Loading
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java +14 −11 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ public class UsersController extends BaseController { @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "email", value = "EMAIL", dataType = "Int", example = "100"), @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100") @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) Loading @@ -83,11 +84,11 @@ public class UsersController extends BaseController { @RequestParam(value = "tenantId") int tenantId, @RequestParam(value = "queue", required = false, defaultValue = "") String queue, @RequestParam(value = "email") String email, @RequestParam(value = "phone", required = false) String phone) throws Exception { logger.info("login user {}, create user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue); Map<String, Object> result = usersService.createUser(loginUser, userName, userPassword, email, tenantId, phone, queue); @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "state", required = false) int state) throws Exception { logger.info("login user {}, create user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}, state: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue, state); Map<String, Object> result = usersService.createUser(loginUser, userName, userPassword, email, tenantId, phone, queue, state); return returnDataList(result); } Loading Loading @@ -146,7 +147,8 @@ public class UsersController extends BaseController { @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "email", value = "EMAIL", dataType = "Int", example = "100"), @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100") @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100"), @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) Loading @@ -158,10 +160,11 @@ public class UsersController extends BaseController { @RequestParam(value = "queue", required = false, defaultValue = "") String queue, @RequestParam(value = "email") String email, @RequestParam(value = "tenantId") int tenantId, @RequestParam(value = "phone", required = false) String phone) throws Exception { logger.info("login user {}, updateProcessInstance user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue); Map<String, Object> result = usersService.updateUser(id, userName, userPassword, email, tenantId, phone, queue); @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "state", required = false) int state) throws Exception { logger.info("login user {}, updateProcessInstance user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}, state: {}", loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone, queue, state); Map<String, Object> result = usersService.updateUser(id, userName, userPassword, email, tenantId, phone, queue, state); return returnDataList(result); } Loading
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java +1 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,7 @@ public enum Status { QUERY_WORKER_GROUP_FAIL(10146,"query worker group fail ", "查询worker分组失败"), DELETE_WORKER_GROUP_FAIL(10147,"delete worker group fail ", "删除worker分组失败"), COPY_PROCESS_DEFINITION_ERROR(10148,"copy process definition error", "复制工作流错误"), USER_DISABLED(10149,"The current user is disabled", "当前用户已停用"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), Loading
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/interceptor/LoginHandlerInterceptor.java +10 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ */ package org.apache.dolphinscheduler.api.interceptor; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.security.Authenticator; import org.apache.dolphinscheduler.api.service.SessionService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.commons.httpclient.HttpStatus; Loading Loading @@ -85,6 +87,14 @@ public class LoginHandlerInterceptor implements HandlerInterceptor { return false; } } // check user state if (user.getState() == Flag.NO.ordinal()) { response.setStatus(HttpStatus.SC_UNAUTHORIZED); logger.info(Status.USER_DISABLED.getMsg()); return false; } request.setAttribute(Constants.SESSION_USER, user); return true; } Loading
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/security/PasswordAuthenticator.java +8 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,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; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.dao.entity.Session; import org.apache.dolphinscheduler.dao.entity.User; import org.slf4j.Logger; Loading Loading @@ -49,6 +50,13 @@ public class PasswordAuthenticator implements Authenticator { return result; } // check user state if (user.getState() == Flag.NO.ordinal()) { result.setCode(Status.USER_DISABLED.getCode()); result.setMsg(Status.USER_DISABLED.getMsg()); return result; } // create session String sessionId = sessionService.createSession(user, extra); if (sessionId == null) { Loading