diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java index 8884e8f141..be4ff00e1a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java @@ -76,7 +76,7 @@ public class WorkerGroupController extends BaseController{ loginUser.getUserName(), id, name, ipList); try { - Map result = workerGroupService.saveWorkerGroup(id, name, ipList); + Map result = workerGroupService.saveWorkerGroup(loginUser,id, name, ipList); return returnDataList(result); }catch (Exception e){ logger.error(Status.SAVE_ERROR.getMsg(),e); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java index 049c65e139..09954938d7 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java @@ -56,10 +56,15 @@ public class WorkerGroupService extends BaseService { * @param ipList * @return */ - public Map saveWorkerGroup(int id, String name, String ipList){ + public Map saveWorkerGroup(User loginUser,int id, String name, String ipList){ Map result = new HashMap<>(5); + //only admin can operate + if (checkAdmin(loginUser, result)){ + return result; + } + if(StringUtils.isEmpty(name)){ putMsg(result, Status.NAME_NULL); return result;