{"record":{"id":"36477ed119b797e1","repo":"apache/dolphinscheduler","slug":"30001-36477e","errorCode":"30001","errorMessage":"user has no operation privilege","messagePattern":"user has no operation privilege","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java","lineNumber":126,"sourceCode":"     * @param email        email\n     * @param tenantId     tenant id\n     * @param phone        phone\n     * @param queue        queue\n     * @return create result code\n     * @throws Exception exception\n     */\n    @Override\n    @Transactional(rollbackFor = Exception.class)\n    public User createUser(User loginUser,\n                           String userName,\n                           String userPassword,\n                           String email,\n                           int tenantId,\n                           String phone,\n                           String queue,\n                           int state) throws Exception {\n        if (!isAdmin(loginUser)) {\n            throw new ServiceException(Status.USER_NO_OPERATION_PERM);\n        }\n\n        // check all user params\n        String msg = this.checkUserParams(userName, userPassword, email, phone);\n        if (!StringUtils.isEmpty(msg)) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, msg);\n        }\n\n        if (!checkTenantExists(tenantId)) {\n            log.warn(\"Tenant does not exist, tenantId:{}.\", tenantId);\n            throw new ServiceException(Status.TENANT_NOT_EXIST);\n        }\n\n        User user = createUser(userName, userPassword, email, tenantId, phone, queue, state);\n        log.info(\"User is created and id is {}.\", user.getId());\n        return user;\n    }\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java#L108-L144","documentation":"Thrown at the top of UsersServiceImpl.createUser when isAdmin(loginUser) is false: only users with the ADMIN role may create other users. It is an authorization guard firing because the caller's session user lacks admin privilege, not a data problem.","triggerScenarios":"Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log in with an account that has the ADMIN role before calling the create-user API","Grant the required admin role to the calling user via the security center if it legitimately needs user-management rights","Check that the correct session/token of the admin user is being sent, not a lower-privileged account"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}