{"record":{"id":"d7c406b35b639113","repo":"apache/dolphinscheduler","slug":"user-no-operation-perm-d7c406","errorCode":"USER_NO_OPERATION_PERM","errorMessage":"Status.USER_NO_OPERATION_PERM","messagePattern":"Status\\.USER_NO_OPERATION_PERM","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java","lineNumber":292,"sourceCode":"        DataSourceProcessor sshDataSourceProcessor = DataSourceUtils.getDatasourceProcessor(type);\n        boolean connectivity = sshDataSourceProcessor.checkDataSourceConnectivity(connectionParam);\n        if (connectivity) {\n            return;\n        }\n        throw new ServiceException(Status.CONNECTION_TEST_FAILURE);\n    }\n\n    @Override\n    public void connectionTest(User loginUser, int id) {\n        DataSource dataSource = dataSourceDao.queryById(id);\n\n        if (dataSource == null) {\n            throw new ServiceException(Status.RESOURCE_NOT_EXIST);\n        }\n\n        if (!canOperatorPermissions(loginUser, new Object[]{id}, AuthorizationType.DATASOURCE,\n                ApiFuncIdentificationConstant.DATASOURCE)) {\n            throw new ServiceException(Status.USER_NO_OPERATION_PERM);\n        }\n\n        checkConnection(dataSource.getType(),\n                DataSourceUtils.buildConnectionParams(dataSource.getType(), dataSource.getConnectionParams()));\n    }\n\n    @Override\n    @Transactional\n    public void delete(User loginUser, int datasourceId) {\n        // query datasource by id\n        DataSource dataSource = dataSourceDao.queryById(datasourceId);\n\n        if (dataSource == null) {\n            throw new ServiceException(Status.RESOURCE_NOT_EXIST);\n        }\n\n        if (!canOperatorPermissions(loginUser, new Object[]{datasourceId}, AuthorizationType.DATASOURCE,\n                DATASOURCE_DELETE)) {","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java#L274-L310","documentation":"Thrown by connectionTest when the caller is not permitted to operate on the data source. canOperatorPermissions rejects the DATASOURCE function for this user, raising Status.USER_NO_OPERATION_PERM before the connectivity check runs.","triggerScenarios":"POST /datasources/{id}/connect by a user who neither created the data source nor had it authorized to them.","commonSituations":"Service account testing a data source owned by another team; user session whose grants were revoked; non-admin calling admin-scope test endpoints.","solutions":["Grant the user access to the data source via Security Center > Data Source Authorize","Perform the test as an admin or the data source owner","Re-login after permission changes to refresh grants","Check the authorization type/user mapping in t_ds_user and t_relation_datasource_user"],"exampleFix":"// before\nconnectionTest(nonOwner, dsId); // 30001\n// after\ngrantDatasourceToUser(dsId, nonOwner.getId()); // admin action\nconnectionTest(nonOwner, dsId);","handlingStrategy":"try-catch","validationCode":"boolean authorized = loginUser.getUserType() == UserType.ADMIN_USER\n    || authorizedDatasourceService.getAuthorizedDatasource(loginUser, userId)\n        .stream().anyMatch(ds -> ds.getId() == id);","typeGuard":null,"tryCatchPattern":"try { service.connectionTest(user, id); } catch (ServiceException e) { if (e.getCode() == 30001) { requestAuthorization(id); } throw e; }","preventionTips":["Grant data source authorization before testing others' sources","Use owner/admin accounts for tests","Refresh sessions after grant changes"],"tags":["permissions","authorization","datasource"],"backgroundTag":"permission-denied","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}