{"record":{"id":"d693ff38d69abffb","repo":"apache/dolphinscheduler","slug":"1400001","errorCode":"1400001","errorMessage":"The current user does not have this permission.","messagePattern":"The current user does not have this permission\\.","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":209,"sourceCode":"    public TaskGroup queryTaskGroupById(User loginUser, int id) {\n        return taskGroupMapper.selectById(id);\n    }\n\n    @Override\n    public PageInfo<TaskGroup> doQuery(User loginUser, int pageNo, int pageSize, int userId, String name,\n                                       Integer status) {\n        Page<TaskGroup> page = new Page<>(pageNo, pageSize);\n        IPage<TaskGroup> taskGroupPaging =\n                taskGroupMapper.queryTaskGroupPaging(page, name, status);\n\n        return buildPageInfo(pageNo, pageSize, taskGroupPaging);\n    }\n\n    @Override\n    public void closeTaskGroup(User loginUser, int id) {\n        if (!canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP,\n                ApiFuncIdentificationConstant.TASK_GROUP_CLOSE)) {\n            throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);\n        }\n        TaskGroup taskGroup = taskGroupMapper.selectById(id);\n        if (taskGroup.getStatus() == Flag.NO) {\n            log.info(\"Task group has been closed, taskGroupId:{}.\", id);\n            throw new ServiceException(Status.TASK_GROUP_STATUS_CLOSED);\n        }\n        taskGroup.setStatus(Flag.NO);\n        if (taskGroupMapper.updateById(taskGroup) > 0) {\n            log.info(\"Task group close complete, taskGroupId:{}.\", id);\n        } else {\n            log.error(\"Task group close error, taskGroupId:{}.\", id);\n        }\n    }\n\n    @Override\n    public void startTaskGroup(User loginUser, int id) {\n        if (!canOperatorPermissions(loginUser, null, AuthorizationType.TASK_GROUP,\n                ApiFuncIdentificationConstant.TASK_GROUP_CLOSE)) {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L191-L227","documentation":"Thrown by TaskGroupServiceImpl.closeTaskGroup when canOperatorPermissions fails for AuthorizationType.TASK_GROUP and the TASK_GROUP_CLOSE function id. Only users granted the TASK_GROUP authorization for the resource (or admins) may close a task group. Reported as Status.NO_CURRENT_OPERATING_PERMISSION (code 1400001).","triggerScenarios":"A non-admin user calls POST /task-group/close with a task group id on which they hold no TASK_GROUP permission, or without any task group authorization granted via the security center.","commonSituations":"Regular project users trying to manage task groups created by another user; missing authorization entry in t_ds_relation_user_taskgroup-style task group permissions; using a service account without the right role assignment.","solutions":["Grant the user TASK_GROUP permission for that task group in the security center (authorize task group to user).","Log in as an admin user to perform the close.","Check the function identifier ApiFuncIdentificationConstant.TASK_GROUP_CLOSE permission rules if a custom auth plugin is in play.","Verify the caller's userType and authorization relationships in the DB before calling the API."],"exampleFix":"// caller-side check before invoking the API\nif (loginUser.getUserType() != UserType.ADMIN_USER && !hasTaskGroupPerm(loginUser, taskGroupId)) {\n    throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);\n}\ncloseTaskGroup(loginUser, taskGroupId);","handlingStrategy":"validation","validationCode":"// Java: pre-check authorization before calling close\nboolean allowed = loginUser.getUserType() == UserType.ADMIN_USER\n        || permissionCheck.checkAdmin(ApiFuncIdentificationConstant.TASK_GROUP_CLOSE, loginUser, AuthorizationType.TASK_GROUP);\nif (!allowed) throw new ServiceException(Status.NO_CURRENT_OPERATING_PERMISSION);","typeGuard":"boolean canCloseTaskGroup(User loginUser) {\n    return loginUser != null && loginUser.getUserType() == UserType.ADMIN_USER;\n}","tryCatchPattern":"try {\n    taskGroupService.closeTaskGroup(loginUser, id);\n} catch (ServiceException e) {\n    if (e.getCode() == 1400001) {\n        // request TASK_GROUP permission or fall back to an admin account\n    }\n    throw e;\n}","preventionTips":["Grant TASK_GROUP authorization to every account that must manage task groups.","Prefer admin or owner accounts for task group lifecycle operations in automation.","Verify permission grants after role changes or user migrations.","Keep UI in sync with granted permissions to avoid surfacing actions users cannot take."],"tags":["permission","task-group","authorization"],"backgroundTag":"permission-denied","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}